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