Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  *  Copyright (C) 2000 Russell King
0004  */
0005 #include <asm/vmlinux.lds.h>
0006 
0007 #ifdef CONFIG_CPU_ENDIAN_BE8
0008 #define ZIMAGE_MAGIC(x) ( (((x) >> 24) & 0x000000ff) | \
0009               (((x) >>  8) & 0x0000ff00) | \
0010               (((x) <<  8) & 0x00ff0000) | \
0011               (((x) << 24) & 0xff000000) )
0012 #else
0013 #define ZIMAGE_MAGIC(x) (x)
0014 #endif
0015 
0016 OUTPUT_ARCH(arm)
0017 ENTRY(_start)
0018 SECTIONS
0019 {
0020   /DISCARD/ : {
0021     COMMON_DISCARDS
0022     *(.ARM.exidx*)
0023     *(.ARM.extab*)
0024     *(.note.*)
0025     *(.rel.*)
0026     /*
0027      * Discard any r/w data - this produces a link error if we have any,
0028      * which is required for PIC decompression.  Local data generates
0029      * GOTOFF relocations, which prevents it being relocated independently
0030      * of the text/got segments.
0031      */
0032     *(.data)
0033   }
0034 
0035   . = TEXT_START;
0036   _text = .;
0037 
0038   .text : {
0039     _start = .;
0040     *(.start)
0041     *(.text)
0042     *(.text.*)
0043     ARM_STUBS_TEXT
0044   }
0045   .table : ALIGN(4) {
0046     _table_start = .;
0047     LONG(ZIMAGE_MAGIC(6))
0048     LONG(ZIMAGE_MAGIC(0x5a534c4b))
0049     LONG(ZIMAGE_MAGIC(__piggy_size_addr - _start))
0050     LONG(ZIMAGE_MAGIC(_kernel_bss_size))
0051     LONG(ZIMAGE_MAGIC(TEXT_OFFSET))
0052     LONG(ZIMAGE_MAGIC(MALLOC_SIZE))
0053     LONG(0)
0054     _table_end = .;
0055   }
0056   .rodata : {
0057     *(.rodata)
0058     *(.rodata.*)
0059     *(.data.rel.ro)
0060   }
0061   .piggydata : {
0062     *(.piggydata)
0063     __piggy_size_addr = . - 4;
0064   }
0065 
0066   . = ALIGN(4);
0067   _etext = .;
0068 
0069   .got.plt      : { *(.got.plt) }
0070 #ifndef CONFIG_EFI_STUB
0071   _got_start = .;
0072   .got          : { *(.got) }
0073   _got_end = .;
0074 #endif
0075 
0076   /* ensure the zImage file size is always a multiple of 64 bits */
0077   /* (without a dummy byte, ld just ignores the empty section) */
0078   .pad          : { BYTE(0); . = ALIGN(8); }
0079 
0080 #ifdef CONFIG_EFI_STUB
0081   .data : ALIGN(4096) {
0082     __pecoff_data_start = .;
0083     _got_start = .;
0084     *(.got)
0085     _got_end = .;
0086     /*
0087      * The EFI stub always executes from RAM, and runs strictly before the
0088      * decompressor, so we can make an exception for its r/w data, and keep it
0089      */
0090     *(.data.efistub .bss.efistub)
0091     __pecoff_data_end = .;
0092 
0093     /*
0094      * PE/COFF mandates a file size which is a multiple of 512 bytes if the
0095      * section size equals or exceeds 4 KB
0096      */
0097     . = ALIGN(512);
0098   }
0099   __pecoff_data_rawsize = . - ADDR(.data);
0100 #endif
0101 
0102   _edata = .;
0103 
0104   /*
0105    * The image_end section appears after any additional loadable sections
0106    * that the linker may decide to insert in the binary image.  Having
0107    * this symbol allows further debug in the near future.
0108    */
0109   .image_end (NOLOAD) : {
0110     /*
0111      * EFI requires that the image is aligned to 512 bytes, and appended
0112      * DTB requires that we know where the end of the image is.  Ensure
0113      * that both are satisfied by ensuring that there are no additional
0114      * sections emitted into the decompressor image.
0115      */
0116     _edata_real = .;
0117   }
0118 
0119   _magic_sig = ZIMAGE_MAGIC(0x016f2818);
0120   _magic_start = ZIMAGE_MAGIC(_start);
0121   _magic_end = ZIMAGE_MAGIC(_edata);
0122   _magic_table = ZIMAGE_MAGIC(_table_start - _start);
0123 
0124   . = BSS_START;
0125   __bss_start = .;
0126   .bss          : { *(.bss) }
0127   _end = .;
0128 
0129   . = ALIGN(8);     /* the stack must be 64-bit aligned */
0130   .stack        : { *(.stack) }
0131 
0132   PROVIDE(__pecoff_data_size = ALIGN(512) - ADDR(.data));
0133   PROVIDE(__pecoff_end = ALIGN(512));
0134 
0135   STABS_DEBUG
0136   DWARF_DEBUG
0137   ARM_DETAILS
0138 
0139   ARM_ASSERTS
0140 }
0141 ASSERT(_edata_real == _edata, "error: zImage file size is incorrect");