X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=ld%2Fscripttempl%2Felfxtensa.sc;h=c8d3859fcca00ebcf4d1e3d063160ad2bd495e3d;hb=e2c8dab6ae8654a928ab9364d5090781a4a6f62f;hp=7d5d5ee082d80373f88622466cac37bd78602f3a;hpb=34734a010beee3b56b382dc93249b6cd27c9a373;p=deliverable%2Fbinutils-gdb.git diff --git a/ld/scripttempl/elfxtensa.sc b/ld/scripttempl/elfxtensa.sc index 7d5d5ee082..c8d3859fcc 100644 --- a/ld/scripttempl/elfxtensa.sc +++ b/ld/scripttempl/elfxtensa.sc @@ -1,3 +1,8 @@ +# Copyright (C) 2014-2020 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) @@ -40,15 +45,15 @@ # NO_RELA_RELOCS - Don't include .rela.* sections in script # NON_ALLOC_DYN - Place dynamic sections after data 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. # ETEXT_NAME - name of a symbol for the end of the text section, @@ -93,7 +98,7 @@ # # plus Xtensa-specific literal sections: # .literal .gnu.linkonce.literal.foo -# .lit4 .gnu.linkonce.lit4.foo +# .lit4 .gnu.linkonce.lit4.foo # # plus Xtensa-specific "property table" sections: # .xt.lit .gnu.linkonce.p.foo @@ -131,7 +136,7 @@ fi test -n "${DATA_PLT-${BSS_PLT-text}}" && TEXT_PLT=yes if test -z "$GOT"; then if test -z "$SEPARATE_GOTPLT"; then - GOT=".got ${RELOCATING-0} : { *(.got.plt) *(.got) }" + GOT=".got ${RELOCATING-0} : {${RELOCATING+ *(.got.plt)} *(.got) }" else GOT=".got ${RELOCATING-0} : { *(.got) }" GOTPLT=".got.plt ${RELOCATING-0} : { *(.got.plt) }" @@ -139,12 +144,12 @@ if test -z "$GOT"; then fi DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }" RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }" -DATARELRO=".data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }" +DATARELRO=".data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }" DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }" INIT_LIT=".init.literal 0 : { *(.init.literal) }" -INIT=".init 0 : { *(.init) }" +INIT=".init 0 : { KEEP (*(SORT_NONE(.init))) }" FINI_LIT=".fini.literal 0 : { *(.fini.literal) }" -FINI=".fini 0 : { *(.fini) }" +FINI=".fini 0 : { KEEP (*(SORT_NONE(.fini))) }" if test -z "${NO_SMALL_DATA}"; then SBSS=".sbss ${RELOCATING-0} : { @@ -159,7 +164,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}} ${CREATE_SHLIB+*(.sdata2 .sdata2.* .gnu.linkonce.s2.*)} @@ -231,7 +236,7 @@ FINI_ARRAY=".fini_array ${RELOCATING-0} : KEEP (*(.fini_array)) ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_end = .);}} }" -CTOR=".ctors ${CONSTRUCTING-0} : +CTOR=".ctors ${CONSTRUCTING-0} : { ${CONSTRUCTING+${CTOR_START}} /* gcc uses crtbegin.o to find the start of @@ -267,13 +272,14 @@ DTOR=".dtors ${CONSTRUCTING-0} : KEEP (*(.dtors)) ${CONSTRUCTING+${DTOR_END}} }" -STACK=" .stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} : +STACK=".stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} : { - ${RELOCATING+_stack = .;} + ${RELOCATING+${USER_LABEL_PREFIX}_stack = .;} *(.stack) + ${RELOCATING+${STACK_SENTINEL}} }" -# if this is for an embedded system, don't add SIZEOF_HEADERS. +# If this is for an embedded system, don't add SIZEOF_HEADERS. if [ -z "$EMBEDDED" ]; then test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR} + SIZEOF_HEADERS" else @@ -281,6 +287,12 @@ else fi cat <> ldscripts/dyntmp.$$ <> ldscripts/dyntmp.$$ +sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rela\./d;s/^.*: { *\(.*\)}$/ \1/' $COMBRELOC >> ldscripts/dyntmp.$$ cat >> ldscripts/dyntmp.$$ <> ldscripts/dyntmp.$$ +sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rel\./d;s/^.*: { *\(.*\)}/ \1/' $COMBRELOC >> ldscripts/dyntmp.$$ cat >> ldscripts/dyntmp.$$ <