| 1 | # Copyright (C) 2014-2019 Free Software Foundation, Inc. |
| 2 | # |
| 3 | # Copying and distribution of this file, with or without modification, |
| 4 | # are permitted in any medium without royalty provided the copyright |
| 5 | # notice and this notice are preserved. |
| 6 | # |
| 7 | # Unusual variables checked by this code: |
| 8 | # NOP - four byte opcode for no-op (defaults to 0) |
| 9 | # NO_SMALL_DATA - no .sbss/.sbss2/.sdata/.sdata2 sections if not |
| 10 | # empty. |
| 11 | # SMALL_DATA_CTOR - .ctors contains small data. |
| 12 | # SMALL_DATA_DTOR - .dtors contains small data. |
| 13 | # DATA_ADDR - if end-of-text-plus-one-page isn't right for data start |
| 14 | # INITIAL_READONLY_SECTIONS - at start of text segment |
| 15 | # OTHER_READONLY_SECTIONS - other than .text .init .rodata ... |
| 16 | # (e.g., .PARISC.milli) |
| 17 | # OTHER_TEXT_SECTIONS - these get put in .text when relocating |
| 18 | # OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ... |
| 19 | # (e.g., .PARISC.global) |
| 20 | # OTHER_RELRO_SECTIONS - other than .data.rel.ro ... |
| 21 | # (e.g. PPC32 .fixup, .got[12]) |
| 22 | # OTHER_BSS_SECTIONS - other than .bss .sbss ... |
| 23 | # OTHER_SECTIONS - at the end |
| 24 | # EXECUTABLE_SYMBOLS - symbols that must be defined for an |
| 25 | # executable (e.g., _DYNAMIC_LINK) |
| 26 | # TEXT_START_ADDR - the first byte of the text segment, after any |
| 27 | # headers. |
| 28 | # TEXT_BASE_ADDRESS - the first byte of the text segment. |
| 29 | # TEXT_START_SYMBOLS - symbols that appear at the start of the |
| 30 | # .text section. |
| 31 | # DATA_START_SYMBOLS - symbols that appear at the start of the |
| 32 | # .data section. |
| 33 | # OTHER_GOT_SYMBOLS - symbols defined just before .got. |
| 34 | # OTHER_GOT_SECTIONS - sections just after .got. |
| 35 | # OTHER_SDATA_SECTIONS - sections just after .sdata. |
| 36 | # OTHER_BSS_SYMBOLS - symbols that appear at the start of the |
| 37 | # .bss section besides __bss_start. |
| 38 | # DATA_PLT - .plt should be in data segment, not text segment. |
| 39 | # PLT_BEFORE_GOT - .plt just before .got when .plt is in data segement. |
| 40 | # BSS_PLT - .plt should be in bss segment |
| 41 | # TEXT_DYNAMIC - .dynamic in text segment, not data segment. |
| 42 | # EMBEDDED - whether this is for an embedded system. |
| 43 | # SHLIB_TEXT_START_ADDR - if set, add to SIZEOF_HEADERS to set |
| 44 | # start address of shared library. |
| 45 | # INPUT_FILES - INPUT command of files to always include |
| 46 | # WRITABLE_RODATA - if set, the .rodata section should be writable |
| 47 | # INIT_START, INIT_END - statements just before and just after |
| 48 | # combination of .init sections. |
| 49 | # FINI_START, FINI_END - statements just before and just after |
| 50 | # combination of .fini sections. |
| 51 | # STACK_ADDR - start of a .stack section. |
| 52 | # OTHER_END_SYMBOLS - symbols to place right at the end of the script. |
| 53 | # SEPARATE_GOTPLT - if set, .got.plt should be separate output section, |
| 54 | # so that .got can be in the RELRO area. It should be set to |
| 55 | # the number of bytes in the beginning of .got.plt which can be |
| 56 | # in the RELRO area as well. |
| 57 | # |
| 58 | # When adding sections, do note that the names of some sections are used |
| 59 | # when specifying the start address of the next. |
| 60 | # |
| 61 | |
| 62 | # Many sections come in three flavours. There is the 'real' section, |
| 63 | # like ".data". Then there are the per-procedure or per-variable |
| 64 | # sections, generated by -ffunction-sections and -fdata-sections in GCC, |
| 65 | # and useful for --gc-sections, which for a variable "foo" might be |
| 66 | # ".data.foo". Then there are the linkonce sections, for which the linker |
| 67 | # eliminates duplicates, which are named like ".gnu.linkonce.d.foo". |
| 68 | # The exact correspondences are: |
| 69 | # |
| 70 | # Section Linkonce section |
| 71 | # .text .gnu.linkonce.t.foo |
| 72 | # .rodata .gnu.linkonce.r.foo |
| 73 | # .data .gnu.linkonce.d.foo |
| 74 | # .bss .gnu.linkonce.b.foo |
| 75 | # .sdata .gnu.linkonce.s.foo |
| 76 | # .sbss .gnu.linkonce.sb.foo |
| 77 | # .sdata2 .gnu.linkonce.s2.foo |
| 78 | # .sbss2 .gnu.linkonce.sb2.foo |
| 79 | # .debug_info .gnu.linkonce.wi.foo |
| 80 | # .tdata .gnu.linkonce.td.foo |
| 81 | # .tbss .gnu.linkonce.tb.foo |
| 82 | # |
| 83 | # Each of these can also have corresponding .rel.* and .rela.* sections. |
| 84 | |
| 85 | test -z "$ENTRY" && ENTRY=_start |
| 86 | test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT} |
| 87 | test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT} |
| 88 | if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi |
| 89 | test -z "${ELFSIZE}" && ELFSIZE=32 |
| 90 | test -z "${ALIGNMENT}" && ALIGNMENT="${ELFSIZE} / 8" |
| 91 | test "$LD_FLAG" = "N" && DATA_ADDR=. |
| 92 | test -n "$CREATE_SHLIB$CREATE_PIE" && test -n "$SHLIB_DATA_ADDR" && COMMONPAGESIZE="" |
| 93 | test -z "$CREATE_SHLIB$CREATE_PIE" && test -n "$DATA_ADDR" && COMMONPAGESIZE="" |
| 94 | test -n "$RELRO_NOW" && unset SEPARATE_GOTPLT |
| 95 | DATA_SEGMENT_ALIGN="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))" |
| 96 | DATA_SEGMENT_RELRO_END="" |
| 97 | DATA_SEGMENT_RELRO_GOTPLT_END="" |
| 98 | DATA_SEGMENT_END="" |
| 99 | if test -n "${COMMONPAGESIZE}"; then |
| 100 | DATA_SEGMENT_ALIGN="ALIGN (${SEGMENT_SIZE}) - ((${MAXPAGESIZE} - .) & (${MAXPAGESIZE} - 1)); . = DATA_SEGMENT_ALIGN (${MAXPAGESIZE}, ${COMMONPAGESIZE})" |
| 101 | DATA_SEGMENT_END=". = DATA_SEGMENT_END (.);" |
| 102 | if test -n "${SEPARATE_GOTPLT}"; then |
| 103 | DATA_SEGMENT_RELRO_GOTPLT_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT}, .);" |
| 104 | else |
| 105 | DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (0, .);" |
| 106 | fi |
| 107 | fi |
| 108 | INTERP=".interp ${RELOCATING-0} : { *(.interp) }" |
| 109 | PLT=".plt ${RELOCATING-0} : { *(.plt) }" |
| 110 | if test -z "$GOT"; then |
| 111 | if test -z "$SEPARATE_GOTPLT"; then |
| 112 | GOT=".got ${RELOCATING-0} : {${RELOCATING+ *(.got.plt)} *(.got) }" |
| 113 | else |
| 114 | GOT=".got ${RELOCATING-0} : { *(.got) }" |
| 115 | GOTPLT="${RELOCATING+${DATA_SEGMENT_RELRO_GOTPLT_END}} |
| 116 | .got.plt ${RELOCATING-0} : { *(.got.plt) }" |
| 117 | fi |
| 118 | fi |
| 119 | DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }" |
| 120 | RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }" |
| 121 | DATARELRO=".data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro .data.rel.ro.*) }" |
| 122 | DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }" |
| 123 | if test -z "${NO_SMALL_DATA}"; then |
| 124 | SBSS=".sbss ${RELOCATING-0} : |
| 125 | { |
| 126 | ${RELOCATING+PROVIDE (__sbss_start = .);} |
| 127 | ${RELOCATING+PROVIDE (___sbss_start = .);} |
| 128 | ${CREATE_SHLIB+*(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)} |
| 129 | ${RELOCATING+*(.dynsbss)} |
| 130 | *(.sbss${RELOCATING+ .sbss.* .gnu.linkonce.sb.*}) |
| 131 | ${RELOCATING+*(.scommon)} |
| 132 | ${RELOCATING+PROVIDE (__sbss_end = .);} |
| 133 | ${RELOCATING+PROVIDE (___sbss_end = .);} |
| 134 | }" |
| 135 | SBSS2=".sbss2 ${RELOCATING-0} : { *(.sbss2${RELOCATING+ .sbss2.* .gnu.linkonce.sb2.*}) }" |
| 136 | SDATA="/* We want the small data sections together, so single-instruction offsets |
| 137 | can access them all, and initialized data all before uninitialized, so |
| 138 | we can shorten the on-disk segment size. */ |
| 139 | .sdata ${RELOCATING-0} : |
| 140 | { |
| 141 | ${RELOCATING+${SDATA_START_SYMBOLS}} |
| 142 | ${CREATE_SHLIB+*(.sdata2 .sdata2.* .gnu.linkonce.s2.*)} |
| 143 | *(.sdata${RELOCATING+ .sdata.* .gnu.linkonce.s.*}) |
| 144 | }" |
| 145 | SDATA2=".sdata2 ${RELOCATING-0} : { *(.sdata2${RELOCATING+ .sdata2.* .gnu.linkonce.s2.*}) }" |
| 146 | REL_SDATA=".rel.sdata ${RELOCATING-0} : { *(.rel.sdata${RELOCATING+ .rel.sdata.* .rel.gnu.linkonce.s.*}) } |
| 147 | .rela.sdata ${RELOCATING-0} : { *(.rela.sdata${RELOCATING+ .rela.sdata.* .rela.gnu.linkonce.s.*}) }" |
| 148 | REL_SBSS=".rel.sbss ${RELOCATING-0} : { *(.rel.sbss${RELOCATING+ .rel.sbss.* .rel.gnu.linkonce.sb.*}) } |
| 149 | .rela.sbss ${RELOCATING-0} : { *(.rela.sbss${RELOCATING+ .rela.sbss.* .rela.gnu.linkonce.sb.*}) }" |
| 150 | REL_SDATA2=".rel.sdata2 ${RELOCATING-0} : { *(.rel.sdata2${RELOCATING+ .rel.sdata2.* .rel.gnu.linkonce.s2.*}) } |
| 151 | .rela.sdata2 ${RELOCATING-0} : { *(.rela.sdata2${RELOCATING+ .rela.sdata2.* .rela.gnu.linkonce.s2.*}) }" |
| 152 | REL_SBSS2=".rel.sbss2 ${RELOCATING-0} : { *(.rel.sbss2${RELOCATING+ .rel.sbss2.* .rel.gnu.linkonce.sb2.*}) } |
| 153 | .rela.sbss2 ${RELOCATING-0} : { *(.rela.sbss2${RELOCATING+ .rela.sbss2.* .rela.gnu.linkonce.sb2.*}) }" |
| 154 | else |
| 155 | NO_SMALL_DATA=" " |
| 156 | fi |
| 157 | test -n "$SEPARATE_GOTPLT" && SEPARATE_GOTPLT=" " |
| 158 | CTOR=".ctors ${CONSTRUCTING-0} : |
| 159 | { |
| 160 | ${CONSTRUCTING+${CTOR_START}} |
| 161 | /* gcc uses crtbegin.o to find the start of |
| 162 | the constructors, so we make sure it is |
| 163 | first. Because this is a wildcard, it |
| 164 | doesn't matter if the user does not |
| 165 | actually link against crtbegin.o; the |
| 166 | linker won't look for a file to match a |
| 167 | wildcard. The wildcard also means that it |
| 168 | doesn't matter which directory crtbegin.o |
| 169 | is in. */ |
| 170 | |
| 171 | KEEP (*crtbegin*.o(.ctors)) |
| 172 | |
| 173 | /* We don't want to include the .ctor section from |
| 174 | from the crtend.o file until after the sorted ctors. |
| 175 | The .ctor section from the crtend file contains the |
| 176 | end of ctors marker and it must be last */ |
| 177 | |
| 178 | KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .ctors)) |
| 179 | KEEP (*(SORT(.ctors.*))) |
| 180 | KEEP (*(.ctors)) |
| 181 | ${CONSTRUCTING+${CTOR_END}} |
| 182 | }" |
| 183 | DTOR=".dtors ${CONSTRUCTING-0} : |
| 184 | { |
| 185 | ${CONSTRUCTING+${DTOR_START}} |
| 186 | KEEP (*crtbegin*.o(.dtors)) |
| 187 | KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .dtors)) |
| 188 | KEEP (*(SORT(.dtors.*))) |
| 189 | KEEP (*(.dtors)) |
| 190 | ${CONSTRUCTING+${DTOR_END}} |
| 191 | }" |
| 192 | STACK=" .stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} : |
| 193 | { |
| 194 | ${RELOCATING+_stack = .;} |
| 195 | *(.stack) |
| 196 | }" |
| 197 | |
| 198 | # If this is for an embedded system, don't add SIZEOF_HEADERS. |
| 199 | if [ -z "$EMBEDDED" ]; then |
| 200 | test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR} + SIZEOF_HEADERS" |
| 201 | else |
| 202 | test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}" |
| 203 | fi |
| 204 | |
| 205 | cat <<EOF |
| 206 | /* Copyright (C) 2014-2019 Free Software Foundation, Inc. |
| 207 | |
| 208 | Copying and distribution of this script, with or without modification, |
| 209 | are permitted in any medium without royalty provided the copyright |
| 210 | notice and this notice are preserved. */ |
| 211 | |
| 212 | OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", |
| 213 | "${LITTLE_OUTPUT_FORMAT}") |
| 214 | OUTPUT_ARCH(${OUTPUT_ARCH}) |
| 215 | ${RELOCATING+ENTRY(${ENTRY})} |
| 216 | |
| 217 | ${RELOCATING+${LIB_SEARCH_DIRS}} |
| 218 | ${RELOCATING+/* Do we need any of these for elf? |
| 219 | __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */} |
| 220 | ${RELOCATING+${EXECUTABLE_SYMBOLS}} |
| 221 | ${RELOCATING+${INPUT_FILES}} |
| 222 | ${RELOCATING- /* For some reason, the Solaris linker makes bad executables |
| 223 | if gld -r is used and the intermediate file has sections starting |
| 224 | at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld |
| 225 | bug. But for now assigning the zero vmas works. */} |
| 226 | |
| 227 | SECTIONS |
| 228 | { |
| 229 | /* Read-only sections, merged into text segment: */ |
| 230 | ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+PROVIDE (__executable_start = ${TEXT_START_ADDR}); . = ${TEXT_BASE_ADDRESS};}}} |
| 231 | ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}} |
| 232 | ${CREATE_PIE+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}} |
| 233 | ${CREATE_SHLIB-${INTERP}} |
| 234 | ${INITIAL_READONLY_SECTIONS} |
| 235 | ${TEXT_DYNAMIC+${DYNAMIC}} |
| 236 | .hash ${RELOCATING-0} : { *(.hash) } |
| 237 | .dynsym ${RELOCATING-0} : { *(.dynsym) } |
| 238 | .dynstr ${RELOCATING-0} : { *(.dynstr) } |
| 239 | .gnu.version ${RELOCATING-0} : { *(.gnu.version) } |
| 240 | .gnu.version_d ${RELOCATING-0}: { *(.gnu.version_d) } |
| 241 | .gnu.version_r ${RELOCATING-0}: { *(.gnu.version_r) } |
| 242 | |
| 243 | EOF |
| 244 | if [ "x$COMBRELOC" = x ]; then |
| 245 | COMBRELOCCAT=cat |
| 246 | else |
| 247 | COMBRELOCCAT="cat > $COMBRELOC" |
| 248 | fi |
| 249 | eval $COMBRELOCCAT <<EOF |
| 250 | .rel.init ${RELOCATING-0} : { *(.rel.init) } |
| 251 | .rela.init ${RELOCATING-0} : { *(.rela.init) } |
| 252 | .rel.text ${RELOCATING-0} : { *(.rel.text${RELOCATING+ .rel.text.* .rel.gnu.linkonce.t.*}) } |
| 253 | .rela.text ${RELOCATING-0} : { *(.rela.text${RELOCATING+ .rela.text.* .rela.gnu.linkonce.t.*}) } |
| 254 | .rel.fini ${RELOCATING-0} : { *(.rel.fini) } |
| 255 | .rela.fini ${RELOCATING-0} : { *(.rela.fini) } |
| 256 | .rel.rodata ${RELOCATING-0} : { *(.rel.rodata${RELOCATING+ .rel.rodata.* .rel.gnu.linkonce.r.*}) } |
| 257 | .rela.rodata ${RELOCATING-0} : { *(.rela.rodata${RELOCATING+ .rela.rodata.* .rela.gnu.linkonce.r.*}) } |
| 258 | ${OTHER_READONLY_RELOC_SECTIONS} |
| 259 | .rel.data.rel.ro ${RELOCATING-0} : { *(.rel.data.rel.ro${RELOCATING+ .rel.data.rel.ro.*}) } |
| 260 | .rela.data.rel.ro ${RELOCATING-0} : { *(.rela.data.rel.ro${RELOCATING+ .rela.data.rel.ro.*}) } |
| 261 | .rel.data ${RELOCATING-0} : { *(.rel.data${RELOCATING+ .rel.data.* .rel.gnu.linkonce.d.*}) } |
| 262 | .rela.data ${RELOCATING-0} : { *(.rela.data${RELOCATING+ .rela.data.* .rela.gnu.linkonce.d.*}) } |
| 263 | .rel.tdata ${RELOCATING-0} : { *(.rel.tdata${RELOCATING+ .rel.tdata.* .rel.gnu.linkonce.td.*}) } |
| 264 | .rela.tdata ${RELOCATING-0} : { *(.rela.tdata${RELOCATING+ .rela.tdata.* .rela.gnu.linkonce.td.*}) } |
| 265 | .rel.tbss ${RELOCATING-0} : { *(.rel.tbss${RELOCATING+ .rel.tbss.* .rel.gnu.linkonce.tb.*}) } |
| 266 | .rela.tbss ${RELOCATING-0} : { *(.rela.tbss${RELOCATING+ .rela.tbss.* .rela.gnu.linkonce.tb.*}) } |
| 267 | .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) } |
| 268 | .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } |
| 269 | .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) } |
| 270 | .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } |
| 271 | .rel.got ${RELOCATING-0} : { *(.rel.got) } |
| 272 | .rela.got ${RELOCATING-0} : { *(.rela.got) } |
| 273 | ${OTHER_GOT_RELOC_SECTIONS} |
| 274 | ${REL_SDATA} |
| 275 | ${REL_SBSS} |
| 276 | ${REL_SDATA2} |
| 277 | ${REL_SBSS2} |
| 278 | .rel.bss ${RELOCATING-0} : { *(.rel.bss${RELOCATING+ .rel.bss.* .rel.gnu.linkonce.b.*}) } |
| 279 | .rela.bss ${RELOCATING-0} : { *(.rela.bss${RELOCATING+ .rela.bss.* .rela.gnu.linkonce.b.*}) } |
| 280 | EOF |
| 281 | if [ -n "$COMBRELOC" ]; then |
| 282 | cat <<EOF |
| 283 | .rel.dyn ${RELOCATING-0} : |
| 284 | { |
| 285 | EOF |
| 286 | sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rela\./d;s/^.*: { *\(.*\)}$/ \1/' $COMBRELOC |
| 287 | cat <<EOF |
| 288 | } |
| 289 | .rela.dyn ${RELOCATING-0} : |
| 290 | { |
| 291 | EOF |
| 292 | sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rel\./d;s/^.*: { *\(.*\)}/ \1/' $COMBRELOC |
| 293 | cat <<EOF |
| 294 | } |
| 295 | EOF |
| 296 | fi |
| 297 | cat <<EOF |
| 298 | .rel.plt ${RELOCATING-0} : { *(.rel.plt) } |
| 299 | .rela.plt ${RELOCATING-0} : { *(.rela.plt) } |
| 300 | ${OTHER_PLT_RELOC_SECTIONS} |
| 301 | |
| 302 | .init ${RELOCATING-0} : |
| 303 | { |
| 304 | ${RELOCATING+${INIT_START}} |
| 305 | KEEP (*(.init)) |
| 306 | ${RELOCATING+${INIT_END}} |
| 307 | } =${NOP-0} |
| 308 | |
| 309 | ${DATA_PLT-${BSS_PLT-${PLT}}} |
| 310 | .text ${RELOCATING-0} : |
| 311 | { |
| 312 | ${RELOCATING+${TEXT_START_SYMBOLS}} |
| 313 | *(.text .stub${RELOCATING+ .text.* .gnu.linkonce.t.*}) |
| 314 | /* .gnu.warning sections are handled specially by elf32.em. */ |
| 315 | *(.gnu.warning) |
| 316 | ${RELOCATING+${OTHER_TEXT_SECTIONS}} |
| 317 | } =${NOP-0} |
| 318 | .fini ${RELOCATING-0} : |
| 319 | { |
| 320 | ${RELOCATING+${FINI_START}} |
| 321 | KEEP (*(.fini)) |
| 322 | ${RELOCATING+${FINI_END}} |
| 323 | } =${NOP-0} |
| 324 | ${RELOCATING+PROVIDE (__etext = .);} |
| 325 | ${RELOCATING+PROVIDE (_etext = .);} |
| 326 | ${RELOCATING+PROVIDE (etext = .);} |
| 327 | ${WRITABLE_RODATA-${RODATA}} |
| 328 | .rodata1 ${RELOCATING-0} : { *(.rodata1) } |
| 329 | ${CREATE_SHLIB-${SDATA2}} |
| 330 | ${CREATE_SHLIB-${SBSS2}} |
| 331 | ${OTHER_READONLY_SECTIONS} |
| 332 | .eh_frame_hdr ${RELOCATING-0} : { *(.eh_frame_hdr) } |
| 333 | .eh_frame ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame)) } |
| 334 | .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.gcc_except_table${RELOCATING+ .gcc_except_table.*})) } |
| 335 | |
| 336 | /* Adjust the address for the data segment. We want to adjust up to |
| 337 | the same address within the page on the next page up. */ |
| 338 | ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+. = ${DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}} |
| 339 | ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}} |
| 340 | ${CREATE_PIE+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}} |
| 341 | |
| 342 | /* Exception handling */ |
| 343 | .eh_frame ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.eh_frame)) } |
| 344 | .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.gcc_except_table${RELOCATING+ .gcc_except_table.*})) } |
| 345 | |
| 346 | /* Thread Local Storage sections */ |
| 347 | .tdata ${RELOCATING-0} : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) } |
| 348 | .tbss ${RELOCATING-0} : { *(.tbss${RELOCATING+ .tbss.* .gnu.linkonce.tb.*})${RELOCATING+ *(.tcommon)} } |
| 349 | |
| 350 | .preinit_array ${RELOCATING-0} : { KEEP (*(.preinit_array)) } |
| 351 | .init_array ${RELOCATING-0} : { KEEP (*(.init_array)) } |
| 352 | .fini_array ${RELOCATING-0} : { KEEP (*(.fini_array)) } |
| 353 | |
| 354 | ${SMALL_DATA_CTOR-${RELOCATING+${CTOR}}} |
| 355 | ${SMALL_DATA_DTOR-${RELOCATING+${DTOR}}} |
| 356 | .jcr ${RELOCATING-0} : { KEEP (*(.jcr)) } |
| 357 | |
| 358 | ${RELOCATING+${DATARELRO}} |
| 359 | ${OTHER_RELRO_SECTIONS} |
| 360 | ${TEXT_DYNAMIC-${DYNAMIC}} |
| 361 | ${NO_SMALL_DATA+${RELRO_NOW+${GOT}}} |
| 362 | ${NO_SMALL_DATA+${RELRO_NOW-${SEPARATE_GOTPLT+${GOT}}}} |
| 363 | ${NO_SMALL_DATA+${RELRO_NOW-${SEPARATE_GOTPLT+${GOTPLT}}}} |
| 364 | ${RELOCATING+${DATA_SEGMENT_RELRO_END}} |
| 365 | ${NO_SMALL_DATA+${RELRO_NOW-${SEPARATE_GOTPLT-${GOT}}}} |
| 366 | |
| 367 | ${DATA_PLT+${PLT_BEFORE_GOT-${PLT}}} |
| 368 | |
| 369 | .data ${RELOCATING-0} : |
| 370 | { |
| 371 | ${RELOCATING+${DATA_START_SYMBOLS}} |
| 372 | *(.data${RELOCATING+ .data.* .gnu.linkonce.d.*}) |
| 373 | ${CONSTRUCTING+SORT(CONSTRUCTORS)} |
| 374 | } |
| 375 | .data1 ${RELOCATING-0} : { *(.data1) } |
| 376 | ${WRITABLE_RODATA+${RODATA}} |
| 377 | ${OTHER_READWRITE_SECTIONS} |
| 378 | ${SMALL_DATA_CTOR+${RELOCATING+${CTOR}}} |
| 379 | ${SMALL_DATA_DTOR+${RELOCATING+${DTOR}}} |
| 380 | ${DATA_PLT+${PLT_BEFORE_GOT+${PLT}}} |
| 381 | ${RELOCATING+${OTHER_GOT_SYMBOLS}} |
| 382 | ${NO_SMALL_DATA-${GOT}} |
| 383 | ${OTHER_GOT_SECTIONS} |
| 384 | ${SDATA} |
| 385 | ${OTHER_SDATA_SECTIONS} |
| 386 | ${RELOCATING+_edata = .;} |
| 387 | ${RELOCATING+PROVIDE (edata = .);} |
| 388 | ${RELOCATING+__bss_start = .;} |
| 389 | ${RELOCATING+${OTHER_BSS_SYMBOLS}} |
| 390 | ${SBSS} |
| 391 | ${BSS_PLT+${PLT}} |
| 392 | .bss ${RELOCATING-0} : |
| 393 | { |
| 394 | ${RELOCATING+*(.dynbss)} |
| 395 | *(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*}) |
| 396 | ${RELOCATING+*(COMMON) |
| 397 | /* Align here to ensure that the .bss section occupies space up to |
| 398 | _end. Align after .bss to ensure correct alignment even if the |
| 399 | .bss section disappears because there are no input sections. */ |
| 400 | . = ALIGN(${ALIGNMENT});} |
| 401 | } |
| 402 | ${OTHER_BSS_SECTIONS} |
| 403 | ${RELOCATING+. = ALIGN(${ALIGNMENT});} |
| 404 | ${RELOCATING+_end = .;} |
| 405 | ${RELOCATING+${OTHER_BSS_END_SYMBOLS}} |
| 406 | ${RELOCATING+PROVIDE (end = .);} |
| 407 | ${RELOCATING+${DATA_SEGMENT_END}} |
| 408 | |
| 409 | /* Stabs debugging sections. */ |
| 410 | .stab 0 : { *(.stab) } |
| 411 | .stabstr 0 : { *(.stabstr) } |
| 412 | .stab.excl 0 : { *(.stab.excl) } |
| 413 | .stab.exclstr 0 : { *(.stab.exclstr) } |
| 414 | .stab.index 0 : { *(.stab.index) } |
| 415 | .stab.indexstr 0 : { *(.stab.indexstr) } |
| 416 | |
| 417 | .comment 0 : { *(.comment) } |
| 418 | |
| 419 | EOF |
| 420 | |
| 421 | . $srcdir/scripttempl/DWARF.sc |
| 422 | |
| 423 | cat <<EOF |
| 424 | ${STACK_ADDR+${STACK}} |
| 425 | ${OTHER_SECTIONS} |
| 426 | ${RELOCATING+${OTHER_END_SYMBOLS}} |
| 427 | ${RELOCATING+${DISCARDED}} |
| 428 | } |
| 429 | EOF |