1/* 2 * Copyright (C) 2000 Russell King 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License version 2 as 6 * published by the Free Software Foundation. 7 */ 8 9#ifdef CONFIG_CPU_ENDIAN_BE8 10#define ZIMAGE_MAGIC(x) ( (((x) >> 24) & 0x000000ff) | \ 11 (((x) >> 8) & 0x0000ff00) | \ 12 (((x) << 8) & 0x00ff0000) | \ 13 (((x) << 24) & 0xff000000) ) 14#else 15#define ZIMAGE_MAGIC(x) (x) 16#endif 17 18OUTPUT_ARCH(arm) 19ENTRY(_start) 20SECTIONS 21{ 22 /DISCARD/ : { 23 *(.ARM.exidx*) 24 *(.ARM.extab*) 25 /* 26 * Discard any r/w data - this produces a link error if we have any, 27 * which is required for PIC decompression. Local data generates 28 * GOTOFF relocations, which prevents it being relocated independently 29 * of the text/got segments. 30 */ 31 *(.data) 32 } 33 34 . = TEXT_START; 35 _text = .; 36 37 .text : { 38 _start = .; 39 *(.start) 40 *(.text) 41 *(.text.*) 42 *(.fixup) 43 *(.gnu.warning) 44 *(.glue_7t) 45 *(.glue_7) 46 } 47 .rodata : { 48 *(.rodata) 49 *(.rodata.*) 50 } 51 .piggydata : { 52 *(.piggydata) 53 } 54 55 . = ALIGN(4); 56 _etext = .; 57 58 .got.plt : { *(.got.plt) } 59 _got_start = .; 60 .got : { *(.got) } 61 _got_end = .; 62 63 /* ensure the zImage file size is always a multiple of 64 bits */ 64 /* (without a dummy byte, ld just ignores the empty section) */ 65 .pad : { BYTE(0); . = ALIGN(8); } 66 67#ifdef CONFIG_EFI_STUB 68 .data : ALIGN(4096) { 69 __pecoff_data_start = .; 70 /* 71 * The EFI stub always executes from RAM, and runs strictly before the 72 * decompressor, so we can make an exception for its r/w data, and keep it 73 */ 74 *(.data.efistub) 75 __pecoff_data_end = .; 76 77 /* 78 * PE/COFF mandates a file size which is a multiple of 512 bytes if the 79 * section size equals or exceeds 4 KB 80 */ 81 . = ALIGN(512); 82 } 83 __pecoff_data_rawsize = . - ADDR(.data); 84#endif 85 86 _edata = .; 87 88 /* 89 * The image_end section appears after any additional loadable sections 90 * that the linker may decide to insert in the binary image. Having 91 * this symbol allows further debug in the near future. 92 */ 93 .image_end (NOLOAD) : { 94 _edata_real = .; 95 } 96 97 _magic_sig = ZIMAGE_MAGIC(0x016f2818); 98 _magic_start = ZIMAGE_MAGIC(_start); 99 _magic_end = ZIMAGE_MAGIC(_edata); 100 101 . = BSS_START; 102 __bss_start = .; 103 .bss : { *(.bss) } 104 _end = .; 105 106 . = ALIGN(8); /* the stack must be 64-bit aligned */ 107 .stack : { *(.stack) } 108 109 PROVIDE(__pecoff_data_size = ALIGN(512) - ADDR(.data)); 110 PROVIDE(__pecoff_end = ALIGN(512)); 111 112 .stab 0 : { *(.stab) } 113 .stabstr 0 : { *(.stabstr) } 114 .stab.excl 0 : { *(.stab.excl) } 115 .stab.exclstr 0 : { *(.stab.exclstr) } 116 .stab.index 0 : { *(.stab.index) } 117 .stab.indexstr 0 : { *(.stab.indexstr) } 118 .comment 0 : { *(.comment) } 119} 120