1# Copyright (C) 2014-2022 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 none) 9# NO_SMALL_DATA - no .sbss/.sbss2/.sdata/.sdata2 sections if not 10# empty. 11# HAVE_NOINIT - Include a .noinit output section in the script. 12# HAVE_PERSISTENT - Include a .persistent output section in the script. 13# HAVE_DT_RELR - Include a .relr.dyn output section in the script. 14# SMALL_DATA_CTOR - .ctors contains small data. 15# SMALL_DATA_DTOR - .dtors contains small data. 16# DATA_ADDR - if end-of-text-plus-one-page isn't right for data start 17# INITIAL_READONLY_SECTIONS - at start of text segment 18# OTHER_READONLY_SECTIONS - other than .text .init .rodata ... 19# (e.g., .PARISC.milli) 20# OTHER_TEXT_SECTIONS - these get put in .text when relocating 21# INITIAL_READWRITE_SECTIONS - at start of data segment (after relro) 22# OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ... 23# (e.g., .PARISC.global) 24# OTHER_RELRO_SECTIONS - other than .data.rel.ro ... 25# (e.g. PPC32 .fixup, .got[12]) 26# OTHER_RELRO_SECTIONS_2 - as above, but after .dynamic in text segment 27# OTHER_BSS_SECTIONS - other than .bss .sbss ... 28# ATTRS_SECTIONS - at the end 29# OTHER_SECTIONS - at the end 30# EXECUTABLE_SYMBOLS - symbols that must be defined for an 31# executable (e.g., _DYNAMIC_LINK) 32# TEXT_START_ADDR - the first byte of the text segment, after any 33# headers. 34# TEXT_BASE_ADDRESS - the first byte of the text segment. 35# TEXT_START_SYMBOLS - symbols that appear at the start of the 36# .text section. 37# DATA_START_SYMBOLS - symbols that appear at the start of the 38# .data section. 39# DATA_END_SYMBOLS - symbols that appear at the end of the 40# writeable data sections. 41# OTHER_GOT_SYMBOLS - symbols defined just before .got. 42# OTHER_GOT_SECTIONS - sections just after .got. 43# OTHER_PLT_SECTIONS - sections just after .plt. 44# OTHER_SDATA_SECTIONS - sections just after .sdata. 45# OTHER_BSS_SYMBOLS - symbols that appear at the start of the 46# .bss section besides __bss_start. 47# PLT_NEXT_DATA - .plt next to data segment when .plt is in text segment. 48# DATA_PLT - .plt should be in data segment, not text segment. 49# PLT_BEFORE_GOT - .plt just before .got when .plt is in data segement. 50# BSS_PLT - .plt should be in bss segment 51# NO_REL_RELOCS - Don't include .rel.* sections in script 52# NO_RELA_RELOCS - Don't include .rela.* sections in script 53# NON_ALLOC_DYN - Place dynamic sections after data segment. 54# TEXT_DYNAMIC - .dynamic in text segment, not data segment. 55# EMBEDDED - whether this is for an embedded system. 56# SHLIB_TEXT_START_ADDR - if set, add to SIZEOF_HEADERS to set 57# start address of shared library. 58# INPUT_FILES - INPUT command of files to always include 59# WRITABLE_RODATA - if set, the .rodata section should be writable 60# INIT_START, INIT_END - statements just before and just after 61# combination of .init sections. 62# FINI_START, FINI_END - statements just before and just after 63# combination of .fini sections. 64# STACK_ADDR - start of a .stack section. 65# OTHER_SYMBOLS - symbols to place right at the end of the script. 66# ETEXT_NAME - name of a symbol for the end of the text section, 67# normally etext. 68# ETEXT_LAST_IN_RODATA_SEGMENT - emit ETEXT_NAME after all sections in 69# the read-only data segment (which may or may not be equal to 70# the code segment), instead of after just the code parts. 71# SEPARATE_CODE - if set, .text and similar sections containing 72# actual machine instructions must be in wholly disjoint 73# pages from any other data, including headers 74# SEPARATE_GOTPLT - if set, .got.plt should be separate output section, 75# so that .got can be in the RELRO area. It should be set to 76# the number of bytes in the beginning of .got.plt which can be 77# in the RELRO area as well. 78# USER_LABEL_PREFIX - prefix to add to user-visible symbols. 79# RODATA_NAME, SDATA_NAME, SBSS_NAME, BSS_NAME - base parts of names 80# for standard sections, without initial "." or suffixes. 81# 82# When adding sections, do note that the names of some sections are used 83# when specifying the start address of the next. 84# 85 86# Many sections come in three flavours. There is the 'real' section, 87# like ".data". Then there are the per-procedure or per-variable 88# sections, generated by -ffunction-sections and -fdata-sections in GCC, 89# and useful for --gc-sections, which for a variable "foo" might be 90# ".data.foo". Then there are the linkonce sections, for which the linker 91# eliminates duplicates, which are named like ".gnu.linkonce.d.foo". 92# The exact correspondences are: 93# 94# Section Linkonce section 95# .text .gnu.linkonce.t.foo 96# .rodata .gnu.linkonce.r.foo 97# .data .gnu.linkonce.d.foo 98# .bss .gnu.linkonce.b.foo 99# .sdata .gnu.linkonce.s.foo 100# .sbss .gnu.linkonce.sb.foo 101# .sdata2 .gnu.linkonce.s2.foo 102# .sbss2 .gnu.linkonce.sb2.foo 103# .debug_info .gnu.linkonce.wi.foo 104# .tdata .gnu.linkonce.td.foo 105# .tbss .gnu.linkonce.tb.foo 106# .lrodata .gnu.linkonce.lr.foo 107# .ldata .gnu.linkonce.l.foo 108# .lbss .gnu.linkonce.lb.foo 109# .noinit .gnu.linkonce.n.foo 110# .persistent .gnu.linkonce.p.foo 111# 112# Each of these can also have corresponding .rel.* and .rela.* sections. 113 114test -z "$TEXT_START_SYMBOLS" && TEXT_START_SYMBOLS="PROVIDE_HIDDEN (__eprol = .);" 115test -z "$ENTRY" && ENTRY=_start 116if test -n "$NOP"; then 117 FILL="=$NOP" 118else 119 FILL= 120fi 121 122test -n "$CREATE_SHLIB$CREATE_PIE" && CREATE_PIC=" " 123test -z "$RODATA_NAME" && RODATA_NAME=rodata 124test -z "$SDATA_NAME" && SDATA_NAME=sdata 125test -z "$SBSS_NAME" && SBSS_NAME=sbss 126test -z "$BSS_NAME" && BSS_NAME=bss 127test -z "$ENTRY" && ENTRY=${USER_LABEL_PREFIX}_start 128test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT} 129test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT} 130if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi 131test -z "${ELFSIZE}" && ELFSIZE=32 132test -z "${ALIGNMENT}" && ALIGNMENT="${ELFSIZE} / 8" 133test "$LD_FLAG" = "N" && DATA_ADDR=. 134test -z "${ETEXT_NAME}" && ETEXT_NAME=${USER_LABEL_PREFIX}etext 135test -n "$RELRO_NOW" && unset SEPARATE_GOTPLT 136test -z "$ATTRS_SECTIONS" && ATTRS_SECTIONS=".gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }" 137if test -z "$DATA_SEGMENT_ALIGN"; then 138 test -n "$CREATE_SHLIB$CREATE_PIE" && test -n "$SHLIB_DATA_ADDR" && COMMONPAGESIZE="" 139 test -z "$CREATE_SHLIB$CREATE_PIE" && test -n "$DATA_ADDR" && COMMONPAGESIZE="" 140 DATA_SEGMENT_ALIGN="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))" 141 DATA_SEGMENT_RELRO_END="" 142 DATA_SEGMENT_END="" 143 if test -n "${COMMONPAGESIZE}"; then 144 if test "${SEGMENT_SIZE}" != "${MAXPAGESIZE}"; then 145 DATA_SEGMENT_ALIGN="ALIGN (${SEGMENT_SIZE}) - ((${MAXPAGESIZE} - .) & (${MAXPAGESIZE} - 1)); . = DATA_SEGMENT_ALIGN (${MAXPAGESIZE}, ${COMMONPAGESIZE})" 146 else 147 DATA_SEGMENT_ALIGN="DATA_SEGMENT_ALIGN (${MAXPAGESIZE}, ${COMMONPAGESIZE})" 148 fi 149 DATA_SEGMENT_END=". = DATA_SEGMENT_END (.);" 150 DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT-0}, .);" 151 fi 152fi 153if test -z "${INITIAL_READONLY_SECTIONS}${CREATE_SHLIB}"; then 154 INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp) }" 155fi 156if test -z "$PLT"; then 157 IPLT=".iplt ${RELOCATING-0} : { *(.iplt) }" 158 PLT=".plt ${RELOCATING-0} : { *(.plt)${RELOCATING+${IREL_IN_PLT+ *(.iplt)}} } 159 ${IREL_IN_PLT-$IPLT}" 160fi 161test -n "${DATA_PLT-${BSS_PLT-text}}" && TEXT_PLT= 162if test -z "$GOT"; then 163 if test -z "$SEPARATE_GOTPLT"; then 164 GOT=".got ${RELOCATING-0} : {${RELOCATING+ *(.got.plt) *(.igot.plt)} *(.got)${RELOCATING+ *(.igot)} }" 165 else 166 GOT=".got ${RELOCATING-0} : { *(.got)${RELOCATING+ *(.igot)} }" 167 GOTPLT=".got.plt ${RELOCATING-0} : { *(.got.plt)${RELOCATING+ *(.igot.plt)} }" 168 fi 169fi 170REL_IFUNC=".rel.ifunc ${RELOCATING-0} : { *(.rel.ifunc) }" 171RELA_IFUNC=".rela.ifunc ${RELOCATING-0} : { *(.rela.ifunc) }" 172REL_IPLT=".rel.iplt ${RELOCATING-0} : 173 { 174 ${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rel_iplt_start = .);}} 175 *(.rel.iplt) 176 ${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rel_iplt_end = .);}} 177 }" 178RELA_IPLT=".rela.iplt ${RELOCATING-0} : 179 { 180 ${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_start = .);}} 181 *(.rela.iplt) 182 ${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_end = .);}} 183 }" 184DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }" 185RODATA=".${RODATA_NAME} ${RELOCATING-0} : { *(.${RODATA_NAME}${RELOCATING+ .${RODATA_NAME}.* .gnu.linkonce.r.*}) }" 186DATARELRO=".data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }" 187DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }" 188if test -z "${NO_SMALL_DATA}"; then 189 SBSS=".${SBSS_NAME} ${RELOCATING-0} : 190 { 191 ${RELOCATING+${SBSS_START_SYMBOLS}} 192 ${CREATE_SHLIB+*(.${SBSS_NAME}2 .${SBSS_NAME}2.* .gnu.linkonce.sb2.*)} 193 ${RELOCATING+*(.dyn${SBSS_NAME})} 194 *(.${SBSS_NAME}${RELOCATING+ .${SBSS_NAME}.* .gnu.linkonce.sb.*}) 195 ${RELOCATING+*(.scommon)} 196 ${RELOCATING+${SBSS_END_SYMBOLS}} 197 }" 198 SBSS2=".${SBSS_NAME}2 ${RELOCATING-0} : { *(.${SBSS_NAME}2${RELOCATING+ .${SBSS_NAME}2.* .gnu.linkonce.sb2.*}) }" 199 SDATA="/* We want the small data sections together, so single-instruction offsets 200 can access them all, and initialized data all before uninitialized, so 201 we can shorten the on-disk segment size. */ 202 .${SDATA_NAME} ${RELOCATING-0} : 203 { 204 ${RELOCATING+${SDATA_START_SYMBOLS}} 205 ${CREATE_SHLIB+*(.${SDATA_NAME}2 .${SDATA_NAME}2.* .gnu.linkonce.s2.*)} 206 *(.${SDATA_NAME}${RELOCATING+ .${SDATA_NAME}.* .gnu.linkonce.s.*}) 207 }" 208 SDATA2=".${SDATA_NAME}2 ${RELOCATING-0} : 209 { 210 ${RELOCATING+${SDATA2_START_SYMBOLS}} 211 *(.${SDATA_NAME}2${RELOCATING+ .${SDATA_NAME}2.* .gnu.linkonce.s2.*}) 212 }" 213 REL_SDATA=".rel.${SDATA_NAME} ${RELOCATING-0} : { *(.rel.${SDATA_NAME}${RELOCATING+ .rel.${SDATA_NAME}.* .rel.gnu.linkonce.s.*}) } 214 .rela.${SDATA_NAME} ${RELOCATING-0} : { *(.rela.${SDATA_NAME}${RELOCATING+ .rela.${SDATA_NAME}.* .rela.gnu.linkonce.s.*}) }" 215 REL_SBSS=".rel.${SBSS_NAME} ${RELOCATING-0} : { *(.rel.${SBSS_NAME}${RELOCATING+ .rel.${SBSS_NAME}.* .rel.gnu.linkonce.sb.*}) } 216 .rela.${SBSS_NAME} ${RELOCATING-0} : { *(.rela.${SBSS_NAME}${RELOCATING+ .rela.${SBSS_NAME}.* .rela.gnu.linkonce.sb.*}) }" 217 REL_SDATA2=".rel.${SDATA_NAME}2 ${RELOCATING-0} : { *(.rel.${SDATA_NAME}2${RELOCATING+ .rel.${SDATA_NAME}2.* .rel.gnu.linkonce.s2.*}) } 218 .rela.${SDATA_NAME}2 ${RELOCATING-0} : { *(.rela.${SDATA_NAME}2${RELOCATING+ .rela.${SDATA_NAME}2.* .rela.gnu.linkonce.s2.*}) }" 219 REL_SBSS2=".rel.${SBSS_NAME}2 ${RELOCATING-0} : { *(.rel.${SBSS_NAME}2${RELOCATING+ .rel.${SBSS_NAME}2.* .rel.gnu.linkonce.sb2.*}) } 220 .rela.${SBSS_NAME}2 ${RELOCATING-0} : { *(.rela.${SBSS_NAME}2${RELOCATING+ .rela.${SBSS_NAME}2.* .rela.gnu.linkonce.sb2.*}) }" 221else 222 NO_SMALL_DATA=" " 223fi 224if test -z "${SDATA_GOT}${DATA_GOT}"; then 225 if test -n "${NO_SMALL_DATA}"; then 226 DATA_GOT=" " 227 fi 228fi 229if test -z "${SDATA_GOT}${DATA_GOT}"; then 230 if test -z "${NO_SMALL_DATA}"; then 231 SDATA_GOT=" " 232 fi 233fi 234test -n "$SEPARATE_GOTPLT" && SEPARATE_GOTPLT=" " 235test "${LARGE_SECTIONS}" = "yes" && REL_LARGE=" 236 .rel.ldata ${RELOCATING-0} : { *(.rel.ldata${RELOCATING+ .rel.ldata.* .rel.gnu.linkonce.l.*}) } 237 .rela.ldata ${RELOCATING-0} : { *(.rela.ldata${RELOCATING+ .rela.ldata.* .rela.gnu.linkonce.l.*}) } 238 .rel.lbss ${RELOCATING-0} : { *(.rel.lbss${RELOCATING+ .rel.lbss.* .rel.gnu.linkonce.lb.*}) } 239 .rela.lbss ${RELOCATING-0} : { *(.rela.lbss${RELOCATING+ .rela.lbss.* .rela.gnu.linkonce.lb.*}) } 240 .rel.lrodata ${RELOCATING-0} : { *(.rel.lrodata${RELOCATING+ .rel.lrodata.* .rel.gnu.linkonce.lr.*}) } 241 .rela.lrodata ${RELOCATING-0} : { *(.rela.lrodata${RELOCATING+ .rela.lrodata.* .rela.gnu.linkonce.lr.*}) }" 242test "${LARGE_SECTIONS}" = "yes" && LARGE_BSS=" 243 .lbss ${RELOCATING-0} : 244 { 245 ${RELOCATING+*(.dynlbss)} 246 *(.lbss${RELOCATING+ .lbss.* .gnu.linkonce.lb.*}) 247 ${RELOCATING+*(LARGE_COMMON)} 248 }" 249test "${LARGE_SECTIONS}" = "yes" && LARGE_SECTIONS=" 250 .lrodata ${RELOCATING-0} ${RELOCATING+ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))} : 251 { 252 *(.lrodata${RELOCATING+ .lrodata.* .gnu.linkonce.lr.*}) 253 } 254 .ldata ${RELOCATING-0} ${RELOCATING+ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))} : 255 { 256 *(.ldata${RELOCATING+ .ldata.* .gnu.linkonce.l.*}) 257 ${RELOCATING+. = ALIGN(. != 0 ? ${ALIGNMENT} : 1);} 258 }" 259if test "${ENABLE_INITFINI_ARRAY}" = "yes"; then 260 SORT_INIT_ARRAY="KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))" 261 SORT_FINI_ARRAY="KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))" 262 CTORS_IN_INIT_ARRAY="EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors" 263 DTORS_IN_FINI_ARRAY="EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors" 264else 265 SORT_INIT_ARRAY="KEEP (*(SORT(.init_array.*)))" 266 SORT_FINI_ARRAY="KEEP (*(SORT(.fini_array.*)))" 267 CTORS_IN_INIT_ARRAY= 268 DTORS_IN_FINI_ARRAY= 269fi 270PREINIT_ARRAY=".preinit_array : 271 { 272 ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_start = .);} 273 KEEP (*(.preinit_array)) 274 ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_end = .);} 275 }" 276INIT_ARRAY=".init_array : 277 { 278 ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_start = .);} 279 ${SORT_INIT_ARRAY} 280 KEEP (*(.init_array ${CTORS_IN_INIT_ARRAY})) 281 ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_end = .);} 282 }" 283FINI_ARRAY=".fini_array : 284 { 285 ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_start = .);} 286 ${SORT_FINI_ARRAY} 287 KEEP (*(.fini_array ${DTORS_IN_FINI_ARRAY})) 288 ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_end = .);} 289 }" 290CTOR=".ctors ${CONSTRUCTING-0} : 291 { 292 ${CONSTRUCTING+${CTOR_START}} 293 /* gcc uses crtbegin.o to find the start of 294 the constructors, so we make sure it is 295 first. Because this is a wildcard, it 296 doesn't matter if the user does not 297 actually link against crtbegin.o; the 298 linker won't look for a file to match a 299 wildcard. The wildcard also means that it 300 doesn't matter which directory crtbegin.o 301 is in. */ 302 303 KEEP (*crtbegin.o(.ctors)) 304 KEEP (*crtbegin?.o(.ctors)) 305 306 /* We don't want to include the .ctor section from 307 the crtend.o file until after the sorted ctors. 308 The .ctor section from the crtend file contains the 309 end of ctors marker and it must be last */ 310 311 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors)) 312 KEEP (*(SORT(.ctors.*))) 313 KEEP (*(.ctors)) 314 ${CONSTRUCTING+${CTOR_END}} 315 }" 316DTOR=".dtors ${CONSTRUCTING-0} : 317 { 318 ${CONSTRUCTING+${DTOR_START}} 319 KEEP (*crtbegin.o(.dtors)) 320 KEEP (*crtbegin?.o(.dtors)) 321 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors)) 322 KEEP (*(SORT(.dtors.*))) 323 KEEP (*(.dtors)) 324 ${CONSTRUCTING+${DTOR_END}} 325 }" 326STACK=".stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} : 327 { 328 ${RELOCATING+${USER_LABEL_PREFIX}_stack = .;} 329 *(.stack) 330 ${RELOCATING+${STACK_SENTINEL}} 331 }" 332test "${HAVE_NOINIT}" = "yes" && NOINIT=" 333 /* This section contains data that is not initialized during load, 334 or during the application's initialization sequence. */ 335 .noinit (NOLOAD) : 336 { 337 ${RELOCATING+. = ALIGN(${ALIGNMENT});} 338 ${RELOCATING+PROVIDE (__noinit_start = .);} 339 *(.noinit${RELOCATING+ .noinit.* .gnu.linkonce.n.*}) 340 ${RELOCATING+. = ALIGN(${ALIGNMENT});} 341 ${RELOCATING+PROVIDE (__noinit_end = .);} 342 }" 343test "${HAVE_PERSISTENT}" = "yes" && PERSISTENT=" 344 /* This section contains data that is initialized during load, 345 but not during the application's initialization sequence. */ 346 .persistent : 347 { 348 ${RELOCATING+. = ALIGN(${ALIGNMENT});} 349 ${RELOCATING+PROVIDE (__persistent_start = .);} 350 *(.persistent${RELOCATING+ .persistent.* .gnu.linkonce.p.*}) 351 ${RELOCATING+. = ALIGN(${ALIGNMENT});} 352 ${RELOCATING+PROVIDE (__persistent_end = .);} 353 }" 354 355TEXT_START_ADDR="SEGMENT_START(\"text-segment\", ${TEXT_START_ADDR})" 356SHLIB_TEXT_START_ADDR="SEGMENT_START(\"text-segment\", ${SHLIB_TEXT_START_ADDR:-0})" 357 358# Don't bother with separate code segment when there are data sections 359# between .plt and .text. 360if test -z "$TINY_READONLY_SECTION"; then 361 case "$LD_FLAG" in 362 *textonly*) 363 SEPARATE_TEXT=" " 364 TEXT_SEGMENT_ALIGN=". = ALIGN(${MAXPAGESIZE});" 365 ;; 366 esac 367fi 368 369if [ -z "$SEPARATE_CODE" ]; then 370 SIZEOF_HEADERS_CODE=" + SIZEOF_HEADERS" 371else 372 SIZEOF_HEADERS_CODE= 373fi 374 375# If this is for an embedded system, don't add SIZEOF_HEADERS. 376if [ -z "$EMBEDDED" ]; then 377 test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}${SIZEOF_HEADERS_CODE}" 378else 379 test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}" 380fi 381 382cat <<EOF 383/* Copyright (C) 2014-2022 Free Software Foundation, Inc. 384 385 Copying and distribution of this script, with or without modification, 386 are permitted in any medium without royalty provided the copyright 387 notice and this notice are preserved. */ 388 389OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", 390 "${LITTLE_OUTPUT_FORMAT}") 391OUTPUT_ARCH(${OUTPUT_ARCH}) 392${RELOCATING+ENTRY(${ENTRY})} 393 394${RELOCATING+${LIB_SEARCH_DIRS}} 395${RELOCATING+${CREATE_SHLIB-${EXECUTABLE_SYMBOLS}}} 396${RELOCATING+${INPUT_FILES}} 397${RELOCATING- /* For some reason, the Solaris linker makes bad executables 398 if gld -r is used and the intermediate file has sections starting 399 at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld 400 bug. But for now assigning the zero vmas works. */} 401 402SECTIONS 403{ 404 ${RELOCATING+${SEPARATE_TEXT-/* Read-only sections, merged into text segment: */}} 405 ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+PROVIDE (__executable_start = ${TEXT_START_ADDR}); . = ${TEXT_BASE_ADDRESS};}}} 406 ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR}${SIZEOF_HEADERS_CODE};}} 407 ${CREATE_PIE+${RELOCATING+PROVIDE (__executable_start = ${SHLIB_TEXT_START_ADDR}); . = ${SHLIB_TEXT_START_ADDR}${SIZEOF_HEADERS_CODE};}} 408EOF 409 410emit_early_ro() 411{ 412 cat <<EOF 413 ${INITIAL_READONLY_SECTIONS} 414 .note.gnu.build-id ${RELOCATING-0}: { *(.note.gnu.build-id) } 415EOF 416} 417 418test -n "${SEPARATE_CODE}" || emit_early_ro 419 420test -n "${RELOCATING+0}" || unset NON_ALLOC_DYN 421test -z "${NON_ALLOC_DYN}" || TEXT_DYNAMIC= 422cat > ldscripts/dyntmp.$$ <<EOF 423 ${TEXT_DYNAMIC+${DYNAMIC}} 424 .hash ${RELOCATING-0} : { *(.hash) } 425 .gnu.hash ${RELOCATING-0} : { *(.gnu.hash) } 426 .dynsym ${RELOCATING-0} : { *(.dynsym) } 427 .dynstr ${RELOCATING-0} : { *(.dynstr) } 428 .gnu.version ${RELOCATING-0} : { *(.gnu.version) } 429 .gnu.version_d ${RELOCATING-0}: { *(.gnu.version_d) } 430 .gnu.version_r ${RELOCATING-0}: { *(.gnu.version_r) } 431EOF 432 433if [ "x$COMBRELOC" = x ]; then 434 COMBRELOCCAT="cat >> ldscripts/dyntmp.$$" 435else 436 COMBRELOCCAT="cat > $COMBRELOC" 437fi 438eval $COMBRELOCCAT <<EOF 439 ${INITIAL_RELOC_SECTIONS} 440 .rel.init ${RELOCATING-0} : { *(.rel.init) } 441 .rela.init ${RELOCATING-0} : { *(.rela.init) } 442 .rel.text ${RELOCATING-0} : { *(.rel.text${RELOCATING+ .rel.text.* .rel.gnu.linkonce.t.*}) } 443 .rela.text ${RELOCATING-0} : { *(.rela.text${RELOCATING+ .rela.text.* .rela.gnu.linkonce.t.*}) } 444 .rel.fini ${RELOCATING-0} : { *(.rel.fini) } 445 .rela.fini ${RELOCATING-0} : { *(.rela.fini) } 446 .rel.${RODATA_NAME} ${RELOCATING-0} : { *(.rel.${RODATA_NAME}${RELOCATING+ .rel.${RODATA_NAME}.* .rel.gnu.linkonce.r.*}) } 447 .rela.${RODATA_NAME} ${RELOCATING-0} : { *(.rela.${RODATA_NAME}${RELOCATING+ .rela.${RODATA_NAME}.* .rela.gnu.linkonce.r.*}) } 448 ${OTHER_READONLY_RELOC_SECTIONS} 449 .rel.data.rel.ro ${RELOCATING-0} : { *(.rel.data.rel.ro${RELOCATING+ .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*}) } 450 .rela.data.rel.ro ${RELOCATING-0} : { *(.rela.data.rel.ro${RELOCATING+ .rela.data.rel.ro.* .rela.gnu.linkonce.d.rel.ro.*}) } 451 .rel.data ${RELOCATING-0} : { *(.rel.data${RELOCATING+ .rel.data.* .rel.gnu.linkonce.d.*}) } 452 .rela.data ${RELOCATING-0} : { *(.rela.data${RELOCATING+ .rela.data.* .rela.gnu.linkonce.d.*}) } 453 ${OTHER_READWRITE_RELOC_SECTIONS} 454 .rel.tdata ${RELOCATING-0} : { *(.rel.tdata${RELOCATING+ .rel.tdata.* .rel.gnu.linkonce.td.*}) } 455 .rela.tdata ${RELOCATING-0} : { *(.rela.tdata${RELOCATING+ .rela.tdata.* .rela.gnu.linkonce.td.*}) } 456 .rel.tbss ${RELOCATING-0} : { *(.rel.tbss${RELOCATING+ .rel.tbss.* .rel.gnu.linkonce.tb.*}) } 457 .rela.tbss ${RELOCATING-0} : { *(.rela.tbss${RELOCATING+ .rela.tbss.* .rela.gnu.linkonce.tb.*}) } 458 .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) } 459 .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) } 460 .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) } 461 .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) } 462 .rel.got ${RELOCATING-0} : { *(.rel.got) } 463 .rela.got ${RELOCATING-0} : { *(.rela.got) } 464 ${OTHER_GOT_RELOC_SECTIONS} 465 ${REL_SDATA} 466 ${REL_SBSS} 467 ${REL_SDATA2} 468 ${REL_SBSS2} 469 .rel.${BSS_NAME} ${RELOCATING-0} : { *(.rel.${BSS_NAME}${RELOCATING+ .rel.${BSS_NAME}.* .rel.gnu.linkonce.b.*}) } 470 .rela.${BSS_NAME} ${RELOCATING-0} : { *(.rela.${BSS_NAME}${RELOCATING+ .rela.${BSS_NAME}.* .rela.gnu.linkonce.b.*}) } 471 ${REL_LARGE} 472 ${IREL_IN_PLT+$REL_IFUNC} 473 ${IREL_IN_PLT+$RELA_IFUNC} 474 ${IREL_IN_PLT-$REL_IPLT} 475 ${IREL_IN_PLT-$RELA_IPLT} 476EOF 477 478if [ -n "$COMBRELOC" ]; then 479cat >> ldscripts/dyntmp.$$ <<EOF 480 .rel.dyn ${RELOCATING-0} : 481 { 482EOF 483sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rela\./d;/__rela_iplt_/d;s/^.*: { *\(.*\)}$/ \1/' $COMBRELOC >> ldscripts/dyntmp.$$ 484cat >> ldscripts/dyntmp.$$ <<EOF 485 } 486 .rela.dyn ${RELOCATING-0} : 487 { 488EOF 489sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rel\./d;/__rel_iplt_/d;s/^.*: { *\(.*\)}/ \1/' $COMBRELOC >> ldscripts/dyntmp.$$ 490cat >> ldscripts/dyntmp.$$ <<EOF 491 } 492EOF 493fi 494 495cat >> ldscripts/dyntmp.$$ <<EOF 496 .rel.plt ${RELOCATING-0} : 497 { 498 *(.rel.plt) 499 ${IREL_IN_PLT+${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rel_iplt_start = .);}}} 500 ${IREL_IN_PLT+${RELOCATING+*(.rel.iplt)}} 501 ${IREL_IN_PLT+${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rel_iplt_end = .);}}} 502 } 503 .rela.plt ${RELOCATING-0} : 504 { 505 *(.rela.plt) 506 ${IREL_IN_PLT+${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_start = .);}}} 507 ${IREL_IN_PLT+${RELOCATING+*(.rela.iplt)}} 508 ${IREL_IN_PLT+${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_end = .);}}} 509 } 510 ${OTHER_PLT_RELOC_SECTIONS} 511EOF 512 513emit_dyn() 514{ 515 if test -z "${NO_REL_RELOCS}${NO_RELA_RELOCS}"; then 516 cat ldscripts/dyntmp.$$ 517 else 518 if test -z "${NO_REL_RELOCS}"; then 519 sed -e '/^[ ]*\.rela\.[^}]*$/,/}/d;/^[ ]*\.rela\./d;/__rela_iplt_/d' ldscripts/dyntmp.$$ 520 fi 521 if test -z "${NO_RELA_RELOCS}"; then 522 sed -e '/^[ ]*\.rel\.[^}]*$/,/}/d;/^[ ]*\.rel\./d;/__rel_iplt_/d' ldscripts/dyntmp.$$ 523 fi 524 fi 525 rm -f ldscripts/dyntmp.$$ 526 if test -n "${HAVE_DT_RELR}"; then 527 echo " .relr.dyn : { *(.relr.dyn) }" 528 fi 529} 530 531test -n "${NON_ALLOC_DYN}${SEPARATE_CODE}" || emit_dyn 532 533cat <<EOF 534 ${RELOCATING+${TEXT_SEGMENT_ALIGN}} 535 536 .init ${RELOCATING-0}${RELOCATING+${INIT_ADDR}} : 537 { 538 ${RELOCATING+${INIT_START}} 539 KEEP (*(SORT_NONE(.init))) 540 ${RELOCATING+${INIT_END}} 541 } ${FILL} 542 543 ${TEXT_PLT+${PLT_NEXT_DATA-${PLT} ${OTHER_PLT_SECTIONS}}} 544 ${TINY_READONLY_SECTION} 545 .text ${RELOCATING-0} : 546 { 547 ${RELOCATING+${TEXT_START_SYMBOLS}} 548 *(.text) 549 ${RELOCATING+*(.text.unlikely .text.*_unlikely .text.unlikely.*)} 550 ${RELOCATING+*(.text.exit .text.exit.*)} 551 ${RELOCATING+*(.text.startup .text.startup.*)} 552 ${RELOCATING+*(.text.hot .text.hot.*)} 553 ${RELOCATING+*(SORT(.text.sorted.*))} 554 *(.text .stub${RELOCATING+ .text.* .gnu.linkonce.t.*}) 555 /* .gnu.warning sections are handled specially by elf.em. */ 556 *(.gnu.warning) 557 ${RELOCATING+${OTHER_TEXT_SECTIONS}} 558 } ${FILL} 559 .fini ${RELOCATING-0}${RELOCATING+${FINI_ADDR}} : 560 { 561 ${RELOCATING+${FINI_START}} 562 KEEP (*(SORT_NONE(.fini))) 563 ${RELOCATING+${FINI_END}} 564 } ${FILL} 565 ${RELOCATING+${ETEXT_LAST_IN_RODATA_SEGMENT-PROVIDE (__${ETEXT_NAME} = .);}} 566 ${RELOCATING+${ETEXT_LAST_IN_RODATA_SEGMENT-PROVIDE (_${ETEXT_NAME} = .);}} 567 ${RELOCATING+${ETEXT_LAST_IN_RODATA_SEGMENT-PROVIDE (${ETEXT_NAME} = .);}} 568 ${RELOCATING+${TEXT_SEGMENT_ALIGN}} 569EOF 570 571if test -n "${SEPARATE_CODE}${SEPARATE_TEXT}"; then 572 if test -n "${RODATA_ADDR}"; then 573 RODATA_ADDR="\ 574SEGMENT_START(\"rodata-segment\", ${RODATA_ADDR}) + SIZEOF_HEADERS" 575 else 576 RODATA_ADDR="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))" 577 RODATA_ADDR="SEGMENT_START(\"rodata-segment\", ${RODATA_ADDR})" 578 fi 579 if test -n "${SHLIB_RODATA_ADDR}"; then 580 SHLIB_RODATA_ADDR="\ 581SEGMENT_START(\"rodata-segment\", ${SHLIB_RODATA_ADDR}) + SIZEOF_HEADERS" 582 else 583 SHLIB_RODATA_ADDR="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))" 584 SHLIB_RODATA_ADDR="SEGMENT_START(\"rodata-segment\", ${SHLIB_RODATA_ADDR})" 585 fi 586 cat <<EOF 587 ${RELOCATING+/* Adjust the address for the rodata segment. We want to adjust up to 588 the same address within the page on the next page up. */ 589 ${CREATE_SHLIB-${CREATE_PIE-. = ${RODATA_ADDR};}} 590 ${CREATE_SHLIB+. = ${SHLIB_RODATA_ADDR};} 591 ${CREATE_PIE+. = ${SHLIB_RODATA_ADDR};}} 592EOF 593 if test -n "${SEPARATE_CODE}"; then 594 emit_early_ro 595 emit_dyn 596 fi 597fi 598 599cat <<EOF 600 ${WRITABLE_RODATA-${RODATA}} 601 .${RODATA_NAME}1 ${RELOCATING-0} : { *(.${RODATA_NAME}1) } 602 ${CREATE_SHLIB-${SDATA2}} 603 ${CREATE_SHLIB-${SBSS2}} 604 ${OTHER_READONLY_SECTIONS} 605 .eh_frame_hdr ${RELOCATING-0} : { *(.eh_frame_hdr)${RELOCATING+ *(.eh_frame_entry .eh_frame_entry.*)} } 606 .eh_frame ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame))${RELOCATING+ *(.eh_frame.*)} } 607 .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table${RELOCATING+ .gcc_except_table.*}) } 608 .gnu_extab ${RELOCATING-0} : ONLY_IF_RO { *(.gnu_extab*) } 609 /* These sections are generated by the Sun/Oracle C++ compiler. */ 610 .exception_ranges ${RELOCATING-0} : ONLY_IF_RO { *(.exception_ranges${RELOCATING+*}) } 611 ${TEXT_PLT+${PLT_NEXT_DATA+${PLT} ${OTHER_PLT_SECTIONS}}} 612 613 ${RELOCATING+${ETEXT_LAST_IN_RODATA_SEGMENT+PROVIDE (__${ETEXT_NAME} = .);}} 614 ${RELOCATING+${ETEXT_LAST_IN_RODATA_SEGMENT+PROVIDE (_${ETEXT_NAME} = .);}} 615 ${RELOCATING+${ETEXT_LAST_IN_RODATA_SEGMENT+PROVIDE (${ETEXT_NAME} = .);}} 616 617 ${RELOCATING+/* Adjust the address for the data segment. We want to adjust up to 618 the same address within the page on the next page up. */} 619 ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+. = ${DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}} 620 ${CREATE_SHLIB+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};} 621 ${CREATE_PIE+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};} 622 623 /* Exception handling */ 624 .eh_frame ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.eh_frame))${RELOCATING+ *(.eh_frame.*)} } 625 .gnu_extab ${RELOCATING-0} : ONLY_IF_RW { *(.gnu_extab) } 626 .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table${RELOCATING+ .gcc_except_table.*}) } 627 .exception_ranges ${RELOCATING-0} : ONLY_IF_RW { *(.exception_ranges${RELOCATING+*}) } 628 629 /* Thread Local Storage sections */ 630 .tdata ${RELOCATING-0} : 631 { 632 ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__tdata_start = .);}} 633 *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) 634 } 635 .tbss ${RELOCATING-0} : { *(.tbss${RELOCATING+ .tbss.* .gnu.linkonce.tb.*})${RELOCATING+ *(.tcommon)} } 636 637 ${RELOCATING+${PREINIT_ARRAY}} 638 ${RELOCATING+${INIT_ARRAY}} 639 ${RELOCATING+${FINI_ARRAY}} 640 ${SMALL_DATA_CTOR-${RELOCATING+${CTOR}}} 641 ${SMALL_DATA_DTOR-${RELOCATING+${DTOR}}} 642 .jcr ${RELOCATING-0} : { KEEP (*(.jcr)) } 643 644 ${RELOCATING+${DATARELRO}} 645 ${OTHER_RELRO_SECTIONS} 646 ${TEXT_DYNAMIC-${DYNAMIC}} 647 ${OTHER_RELRO_SECTIONS_2} 648 ${DATA_GOT+${RELRO_NOW+${DATA_PLT+${PLT_BEFORE_GOT+${PLT}}}}} 649 ${DATA_GOT+${RELRO_NOW+${GOT}}} 650 ${DATA_GOT+${RELRO_NOW+${GOTPLT}}} 651 ${DATA_GOT+${RELRO_NOW-${SEPARATE_GOTPLT+${GOT}}}} 652 ${RELOCATING+${DATA_SEGMENT_RELRO_END}} 653 ${INITIAL_READWRITE_SECTIONS} 654 ${DATA_SDATA+${SDATA}} 655 ${DATA_SDATA+${OTHER_SDATA_SECTIONS}} 656 ${DATA_SDATA+${SBSS}} 657 ${DATA_GOT+${RELRO_NOW-${DATA_PLT+${PLT_BEFORE_GOT+${PLT}}}}} 658 ${DATA_GOT+${RELRO_NOW-${SEPARATE_GOTPLT-${GOT}}}} 659 ${DATA_GOT+${RELRO_NOW-${GOTPLT}}} 660 661 ${DATA_PLT+${PLT_BEFORE_GOT-${PLT}}} 662 663 .data ${RELOCATING-0} : 664 { 665 ${RELOCATING+${DATA_START_SYMBOLS}} 666 *(.data${RELOCATING+ .data.* .gnu.linkonce.d.*}) 667 ${CONSTRUCTING+SORT(CONSTRUCTORS)} 668 } 669 .data1 ${RELOCATING-0} : { *(.data1) } 670 ${WRITABLE_RODATA+${RODATA}} 671 ${OTHER_READWRITE_SECTIONS} 672 ${SMALL_DATA_CTOR+${RELOCATING+${CTOR}}} 673 ${SMALL_DATA_DTOR+${RELOCATING+${DTOR}}} 674 ${SDATA_GOT+${DATA_PLT+${PLT_BEFORE_GOT+${PLT}}}} 675 ${SDATA_GOT+${RELOCATING+${OTHER_GOT_SYMBOLS+. = .; ${OTHER_GOT_SYMBOLS}}}} 676 ${SDATA_GOT+${GOT}} 677 ${SDATA_GOT+${OTHER_GOT_SECTIONS}} 678 ${DATA_SDATA-${SDATA}} 679 ${DATA_SDATA-${OTHER_SDATA_SECTIONS}} 680 ${RELOCATING+${DATA_END_SYMBOLS-${CREATE_SHLIB+PROVIDE (}${USER_LABEL_PREFIX}_edata = .${CREATE_SHLIB+)}; PROVIDE (${USER_LABEL_PREFIX}edata = .);}} 681 ${PERSISTENT} 682 ${RELOCATING+. = .;} 683 ${RELOCATING+${CREATE_SHLIB+PROVIDE (}${USER_LABEL_PREFIX}__bss_start = .${CREATE_SHLIB+)};} 684 ${RELOCATING+${OTHER_BSS_SYMBOLS}} 685 ${DATA_SDATA-${SBSS}} 686 ${BSS_PLT+${PLT}} 687 .${BSS_NAME} ${RELOCATING-0} : 688 { 689 ${RELOCATING+*(.dynbss)} 690 *(.${BSS_NAME}${RELOCATING+ .${BSS_NAME}.* .gnu.linkonce.b.*}) 691 ${RELOCATING+*(COMMON) 692 /* Align here to ensure that the .bss section occupies space up to 693 _end. Align after .bss to ensure correct alignment even if the 694 .bss section disappears because there are no input sections. 695 FIXME: Why do we need it? When there is no .bss section, we do not 696 pad the .data section. */ 697 . = ALIGN(. != 0 ? ${ALIGNMENT} : 1);} 698 } 699 ${OTHER_BSS_SECTIONS} 700 ${LARGE_BSS_AFTER_BSS+${LARGE_BSS}} 701 ${RELOCATING+${OTHER_BSS_END_SYMBOLS}} 702 ${NOINIT} 703 ${RELOCATING+. = ALIGN(${ALIGNMENT});} 704EOF 705 706LARGE_DATA_ADDR=". = SEGMENT_START(\"ldata-segment\", ${LARGE_DATA_ADDR-.});" 707SHLIB_LARGE_DATA_ADDR=". = SEGMENT_START(\"ldata-segment\", ${SHLIB_LARGE_DATA_ADDR-.});" 708 709cat <<EOF 710 ${RELOCATING+${CREATE_SHLIB-${CREATE_PIE-${LARGE_DATA_ADDR}}}} 711 ${CREATE_SHLIB+${SHLIB_LARGE_DATA_ADDR}} 712 ${CREATE_PIE+${SHLIB_LARGE_DATA_ADDR}} 713 ${LARGE_SECTIONS} 714 ${LARGE_BSS_AFTER_BSS-${LARGE_BSS}} 715 ${RELOCATING+. = ALIGN(${ALIGNMENT});} 716 ${RELOCATING+${OTHER_END_SYMBOLS}} 717 ${RELOCATING+${END_SYMBOLS-${CREATE_SHLIB+PROVIDE (}${USER_LABEL_PREFIX}_end = .${CREATE_SHLIB+)}; PROVIDE (${USER_LABEL_PREFIX}end = .);}} 718 ${RELOCATING+${DATA_SEGMENT_END}} 719 ${TINY_DATA_SECTION} 720 ${TINY_BSS_SECTION} 721 ${STACK_ADDR+${STACK}} 722EOF 723 724test -z "${NON_ALLOC_DYN}" || emit_dyn 725 726cat <<EOF 727 /* Stabs debugging sections. */ 728 .stab 0 : { *(.stab) } 729 .stabstr 0 : { *(.stabstr) } 730 .stab.excl 0 : { *(.stab.excl) } 731 .stab.exclstr 0 : { *(.stab.exclstr) } 732 .stab.index 0 : { *(.stab.index) } 733 .stab.indexstr 0 : { *(.stab.indexstr) } 734 735 .comment 0 : { *(.comment) } 736 737 .gnu.build.attributes : { *(.gnu.build.attributes${RELOCATING+ .gnu.build.attributes.*}) } 738 739EOF 740 741. $srcdir/scripttempl/DWARF.sc 742 743cat <<EOF 744 ${ATTRS_SECTIONS} 745 ${OTHER_SECTIONS} 746 ${RELOCATING+${OTHER_SYMBOLS}} 747 ${RELOCATING+${DISCARDED}} 748} 749EOF 750