X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=ld%2Fscripttempl%2Felf_chaos.sc;h=72f91c9c9fcd93bede04cd51845a25e87fe68103;hb=675b9d612cc59446e84e2c6d89b45500cb603a8d;hp=10abf4a0de4d77d1a301b0307e935e6a19d0b409;hpb=827a1c67ae64ca4502cf515e7cd5dfd7346c8818;p=thirdparty%2Fbinutils-gdb.git diff --git a/ld/scripttempl/elf_chaos.sc b/ld/scripttempl/elf_chaos.sc index 10abf4a0de4..72f91c9c9fc 100644 --- a/ld/scripttempl/elf_chaos.sc +++ b/ld/scripttempl/elf_chaos.sc @@ -1,3 +1,8 @@ +# Copyright (C) 2014-2023 Free Software Foundation, Inc. +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. # # Unusual variables checked by this code: # NOP - four byte opcode for no-op (defaults to 0) @@ -10,6 +15,7 @@ # OTHER_TEXT_SECTIONS - these get put in .text when relocating # OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ... # (e.g., .PARISC.global) +# ATTRS_SECTIONS - at the end # OTHER_SECTIONS - at the end # EXECUTABLE_SYMBOLS - symbols that must be defined for an # executable (e.g., _DYNAMIC_LINK) @@ -25,15 +31,15 @@ # DATA_PLT - .plt should be in data segment, not text segment. # BSS_PLT - .plt should be in bss segment # TEXT_DYNAMIC - .dynamic in text segment, not data segment. -# EMBEDDED - whether this is for an embedded system. +# EMBEDDED - whether this is for an embedded system. # SHLIB_TEXT_START_ADDR - if set, add to SIZEOF_HEADERS to set # start address of shared library. # INPUT_FILES - INPUT command of files to always include # WRITABLE_RODATA - if set, the .rodata section should be writable # INIT_START, INIT_END - statements just before and just after -# combination of .init sections. +# combination of .init sections. # FINI_START, FINI_END - statements just before and just after -# combination of .fini sections. +# combination of .fini sections. # STACK_ADDR - start of a .stack section. # OTHER_SYMBOLS - symbols to place right at the end of the script. # @@ -68,6 +74,7 @@ test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT} if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi test -z "${ELFSIZE}" && ELFSIZE=32 test -z "${ALIGNMENT}" && ALIGNMENT="${ELFSIZE} / 8" +test -z "$ATTRS_SECTIONS" && ATTRS_SECTIONS=".gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }" test "$LD_FLAG" = "N" && DATA_ADDR=. INTERP=".interp ${RELOCATING-0} : { *(.interp) }" PLT=".plt ${RELOCATING-0} : { *(.plt) }" @@ -88,7 +95,7 @@ if test -z "${NO_SMALL_DATA}"; then SDATA="/* We want the small data sections together, so single-instruction offsets can access them all, and initialized data all before uninitialized, so we can shorten the on-disk segment size. */ - .sdata ${RELOCATING-0} : + .sdata ${RELOCATING-0} : { ${RELOCATING+${SDATA_START_SYMBOLS}} *(.sdata${RELOCATING+ .sdata.* .gnu.linkonce.s.*}) @@ -115,22 +122,24 @@ CTOR=" doesn't matter which directory crtbegin.o is in. */ - KEEP (*crtbegin*.o(.ctors)) + KEEP (*crtbegin.o(.ctors)) + KEEP (*crtbegin?.o(.ctors)) /* We don't want to include the .ctor section from - from the crtend.o file until after the sorted ctors. + the crtend.o file until after the sorted ctors. The .ctor section from the crtend file contains the end of ctors marker and it must be last */ - KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors)) KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) ${CONSTRUCTING+${CTOR_END}} " DTOR=" ${CONSTRUCTING+${DTOR_START}} - KEEP (*crtbegin*.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .dtors)) + KEEP (*crtbegin.o(.dtors)) + KEEP (*crtbegin?.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors)) KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) ${CONSTRUCTING+${DTOR_END}} @@ -144,10 +153,16 @@ STACK=" .stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} : test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}" cat <