|
| 1 | + |
| 2 | +OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") |
| 3 | +OUTPUT_ARCH(arm) |
| 4 | +ENTRY(_start) |
| 5 | + |
| 6 | +PHDRS |
| 7 | +{ |
| 8 | + code PT_LOAD FLAGS(5) /* Read | Execute */; |
| 9 | + rodata PT_LOAD FLAGS(4) /* Read */; |
| 10 | + data PT_LOAD FLAGS(6) /* Read | Write */; |
| 11 | +} |
| 12 | + |
| 13 | +SECTIONS |
| 14 | +{ |
| 15 | + /* =========== CODE section =========== */ |
| 16 | + |
| 17 | + PROVIDE(__start__ = 0x07000100); |
| 18 | + . = __start__; |
| 19 | + |
| 20 | + .text ALIGN(4) : |
| 21 | + { |
| 22 | + /* .init */ |
| 23 | + KEEP( *(.crt0) ) |
| 24 | + KEEP( *(.init) ) |
| 25 | + . = ALIGN(4); |
| 26 | + |
| 27 | + /* .text */ |
| 28 | + *(.text) |
| 29 | + *(.text.*) |
| 30 | + *(.glue_7) |
| 31 | + *(.glue_7t) |
| 32 | + *(.stub) |
| 33 | + *(.gnu.warning) |
| 34 | + *(.gnu.linkonce.t*) |
| 35 | + . = ALIGN(4); |
| 36 | + |
| 37 | + /* .fini */ |
| 38 | + KEEP( *(.fini) ) |
| 39 | + . = ALIGN(4); |
| 40 | + } : code |
| 41 | + |
| 42 | + /* =========== RODATA section =========== */ |
| 43 | + |
| 44 | + .rodata ALIGN(0x4) : |
| 45 | + { |
| 46 | + *(.rodata) |
| 47 | + *(.roda) |
| 48 | + *(.rodata.*) |
| 49 | + *all.rodata*(*) |
| 50 | + *(.gnu.linkonce.r*) |
| 51 | + SORT(CONSTRUCTORS) |
| 52 | + . = ALIGN(4); |
| 53 | + __tdata_align = .; |
| 54 | + LONG (ALIGNOF(.tdata)); |
| 55 | + . = ALIGN(4); |
| 56 | + } : rodata |
| 57 | + |
| 58 | + .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } : rodata |
| 59 | + __exidx_start = .; |
| 60 | + ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } : rodata |
| 61 | + __exidx_end = .; |
| 62 | + |
| 63 | + /* =========== DATA section =========== */ |
| 64 | + |
| 65 | + .data ALIGN(4): |
| 66 | + { |
| 67 | + *(.data) |
| 68 | + *(.data.*) |
| 69 | + *(.gnu.linkonce.d*) |
| 70 | + CONSTRUCTORS |
| 71 | + . = ALIGN(4); |
| 72 | + } : data |
| 73 | + |
| 74 | + .tdata ALIGN(4) : |
| 75 | + { |
| 76 | + __tdata_lma = .; |
| 77 | + *(.tdata) |
| 78 | + *(.tdata.*) |
| 79 | + *(.gnu.linkonce.td.*) |
| 80 | + . = ALIGN(4); |
| 81 | + __tdata_lma_end = .; |
| 82 | + } : data |
| 83 | + |
| 84 | + .tbss ALIGN(4) : |
| 85 | + { |
| 86 | + *(.tbss) |
| 87 | + *(.tbss.*) |
| 88 | + *(.gnu.linkonce.tb.*) |
| 89 | + *(.tcommon) |
| 90 | + . = ALIGN(4); |
| 91 | + } : data |
| 92 | + |
| 93 | + .preinit_array ALIGN(4) : |
| 94 | + { |
| 95 | + PROVIDE (__preinit_array_start = .); |
| 96 | + KEEP (*(.preinit_array)) |
| 97 | + PROVIDE (__preinit_array_end = .); |
| 98 | + } : data |
| 99 | + |
| 100 | + .init_array ALIGN(4) : |
| 101 | + { |
| 102 | + PROVIDE (__init_array_start = .); |
| 103 | + KEEP (*(SORT(.init_array.*))) |
| 104 | + KEEP (*(.init_array)) |
| 105 | + PROVIDE (__init_array_end = .); |
| 106 | + } : data |
| 107 | + |
| 108 | + .fini_array ALIGN(4) : |
| 109 | + { |
| 110 | + PROVIDE (__fini_array_start = .); |
| 111 | + KEEP (*(.fini_array)) |
| 112 | + KEEP (*(SORT(.fini_array.*))) |
| 113 | + PROVIDE (__fini_array_end = .); |
| 114 | + } : data |
| 115 | + |
| 116 | + .ctors ALIGN(4) : |
| 117 | + { |
| 118 | + KEEP (*crtbegin.o(.ctors)) /* MUST be first -- GCC requires it */ |
| 119 | + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) |
| 120 | + KEEP (*(SORT(.ctors.*))) |
| 121 | + KEEP (*(.ctors)) |
| 122 | + } : data |
| 123 | + |
| 124 | + .dtors ALIGN(4) : |
| 125 | + { |
| 126 | + KEEP (*crtbegin.o(.dtors)) |
| 127 | + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) |
| 128 | + KEEP (*(SORT(.dtors.*))) |
| 129 | + KEEP (*(.dtors)) |
| 130 | + } : data |
| 131 | + |
| 132 | + __bss_start__ = .; |
| 133 | + .bss ALIGN(4) : |
| 134 | + { |
| 135 | + *(.dynbss) |
| 136 | + *(.bss) |
| 137 | + *(.bss.*) |
| 138 | + *(.gnu.linkonce.b*) |
| 139 | + *(COMMON) |
| 140 | + |
| 141 | + /* Reserve space for the TLS segment of the main thread. |
| 142 | + We need (__tls_start - 8) to be aligned the same as .tdata, to account for |
| 143 | + the 8-byte ARM TLS header. Since the header is not actually used for |
| 144 | + ARM_TLS_LE32 relocation, we just fake it by subtracting 8 from the data |
| 145 | + offset. |
| 146 | + */ |
| 147 | + . = 8 + ABSOLUTE(ALIGN(ABSOLUTE(. - 8), MAX(4, ALIGNOF(.tdata)))); |
| 148 | + __tls_start = .; |
| 149 | + . += SIZEOF(.tdata) + SIZEOF(.tbss); |
| 150 | + __tls_end = .; |
| 151 | + } : data |
| 152 | + __bss_end__ = .; |
| 153 | + |
| 154 | + __end__ = ABSOLUTE(.) ; |
| 155 | + |
| 156 | + /* ================== |
| 157 | + ==== Metadata ==== |
| 158 | + ================== */ |
| 159 | + |
| 160 | + /* Discard sections that difficult post-processing */ |
| 161 | + /DISCARD/ : { *(.group .comment .note) } |
| 162 | + |
| 163 | + /* Stabs debugging sections. */ |
| 164 | + .stab 0 : { *(.stab) } |
| 165 | + .stabstr 0 : { *(.stabstr) } |
| 166 | + .stab.excl 0 : { *(.stab.excl) } |
| 167 | + .stab.exclstr 0 : { *(.stab.exclstr) } |
| 168 | + .stab.index 0 : { *(.stab.index) } |
| 169 | + .stab.indexstr 0 : { *(.stab.indexstr) } |
| 170 | + |
| 171 | + /* DWARF debug sections. |
| 172 | + Symbols in the DWARF debugging sections are relative to the beginning |
| 173 | + of the section so we begin them at 0. */ |
| 174 | + |
| 175 | + /* DWARF 1 */ |
| 176 | + .debug 0 : { *(.debug) } |
| 177 | + .line 0 : { *(.line) } |
| 178 | + |
| 179 | + /* GNU DWARF 1 extensions */ |
| 180 | + .debug_srcinfo 0 : { *(.debug_srcinfo) } |
| 181 | + .debug_sfnames 0 : { *(.debug_sfnames) } |
| 182 | + |
| 183 | + /* DWARF 1.1 and DWARF 2 */ |
| 184 | + .debug_aranges 0 : { *(.debug_aranges) } |
| 185 | + .debug_pubnames 0 : { *(.debug_pubnames) } |
| 186 | + |
| 187 | + /* DWARF 2 */ |
| 188 | + .debug_info 0 : { *(.debug_info) } |
| 189 | + .debug_abbrev 0 : { *(.debug_abbrev) } |
| 190 | + .debug_line 0 : { *(.debug_line) } |
| 191 | + .debug_frame 0 : { *(.debug_frame) } |
| 192 | + .debug_str 0 : { *(.debug_str) } |
| 193 | + .debug_loc 0 : { *(.debug_loc) } |
| 194 | + .debug_macinfo 0 : { *(.debug_macinfo) } |
| 195 | +} |
0 commit comments