aboutsummaryrefslogtreecommitdiff
path: root/ld/emulparams
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2018-10-12 12:06:40 +1030
committerAlan Modra <amodra@gmail.com>2018-10-13 20:33:23 +1030
commit2bf2bf23da5237f465fdbb759657aeb7825a08a3 (patch)
tree49a81efac8f227478ae0f19e6942f53795d6aa51 /ld/emulparams
parent8bca297856b2e54ac093674554f6abd82e7ce6b0 (diff)
downloadgdb-2bf2bf23da5237f465fdbb759657aeb7825a08a3.zip
gdb-2bf2bf23da5237f465fdbb759657aeb7825a08a3.tar.gz
gdb-2bf2bf23da5237f465fdbb759657aeb7825a08a3.tar.bz2
ELF ld -r scripts
"ld -r" generally should not combine object file sections with different names. For example, "ld -r" should not combine ".text", ".text.hot" and ".text.cold" into an output ".text" section. An exception needs to be made for linker created sections, for example, branch trampoline sections that might be created even for ld -r. "ld -r" also should not define symbols in linker scripts. Any definitions are likely to conflict with those defined at final link. A MEMORY spec is also not needed for ld -r. * Makefile.am (eelf32btsmip_fbsd.c, eelf32btsmipn32_fbsd.c), (eelf32epiphany.c, eelf32epiphany_4x4.c, eelf32ltsmip_fbsd.c), (eelf32ltsmipn32_fbsd.c, eelf32xc16x.c, eelf32xc16xl.c), (eelf32xc16xs.c, emcorepe.c, enios2elf.c, enios2linux.c), (eelf64btsmip_fbsd.c, eelf64ltsmip_fbsd.c): Correct dependencies. * Makefile.in: Regenerate. * emulparams/aarch64cloudabi.sh, * emulparams/aarch64fbsd.sh, * emulparams/aarch64linux.sh, * emulparams/aarch64linux32.sh, * emulparams/arc-nps.sh, * emulparams/elf32_spu.sh, * emulparams/elf32_tic6x_le.sh, * emulparams/elf32bmip.sh, * emulparams/elf32btsmipn32.sh, * emulparams/elf32lr5900n32.sh, * emulparams/elf32mep.sh, * emulparams/elf32metag.sh, * emulparams/elf64btsmip.sh, * emulparams/shelf_vxworks.sh, * emulparams/shlelf_fd.sh, * scripttempl/DWARF.sc, * scripttempl/alpha.sc, * scripttempl/alphavms.sc, * scripttempl/arclinux.sc, * scripttempl/armbpabi.sc, * scripttempl/avr.sc, * scripttempl/dlx.sc, * scripttempl/elf.sc, * scripttempl/elf32cr16.sc, * scripttempl/elf32cr16c.sc, * scripttempl/elf32crx.sc, * scripttempl/elf32msp430.sc, * scripttempl/elf32msp430_3.sc, * scripttempl/elf32xc16x.sc, * scripttempl/elf32xc16xl.sc, * scripttempl/elf32xc16xs.sc, * scripttempl/elf64hppa.sc, * scripttempl/elf_chaos.sc, * scripttempl/elfarc.sc, * scripttempl/elfarcv2.sc, * scripttempl/elfd10v.sc, * scripttempl/elfd30v.sc, * scripttempl/elfm68hc11.sc, * scripttempl/elfm68hc12.sc, * scripttempl/elfm9s12z.sc, * scripttempl/elfmicroblaze.sc, * scripttempl/elfxgate.sc, * scripttempl/elfxtensa.sc, * scripttempl/epiphany_4x4.sc, * scripttempl/ft32.sc, * scripttempl/hppaelf.sc, * scripttempl/ia64vms.sc, * scripttempl/ip2k.sc, * scripttempl/iq2000.sc, * scripttempl/mep.sc, * scripttempl/mmo.sc, * scripttempl/nds32elf.sc, * scripttempl/pru.sc, * scripttempl/sh.sc, * scripttempl/v850.sc, * scripttempl/v850_rh850.sc, * scripttempl/visium.sc, * scripttempl/xstormy16.sc: Condition various parts of scripts on ${RELOCATABLE} in order to prevent ld -r merging sections or defining symbols. Remove MEMORY and VERSION definitions from ld -r scripts too. * testsuite/ld-elf/group2.d, * testsuite/ld-elf/group4.d, * testsuite/ld-elf/group5.d, * testsuite/ld-elf/group6.d, * testsuite/ld-elf/group7.d, * testsuite/ld-elf/group8a.d, * testsuite/ld-elf/group8b.d, * testsuite/ld-elf/group9a.d, * testsuite/ld-elf/group9b.d, * testsuite/ld-elf/pr17550a.d, * testsuite/ld-elf/pr17550b.d, * testsuite/ld-elf/pr17550d.d: Don't xfail cr16 and crx. * testsuite/ld-elf/init-fini-arrays.d, * testsuite/ld-elf/pr22677.d: Likewise, and dont' xfail mep.
Diffstat (limited to 'ld/emulparams')
-rw-r--r--ld/emulparams/aarch64cloudabi.sh2
-rw-r--r--ld/emulparams/aarch64fbsd.sh2
-rw-r--r--ld/emulparams/aarch64linux.sh2
-rw-r--r--ld/emulparams/aarch64linux32.sh2
-rw-r--r--ld/emulparams/arc-nps.sh2
-rw-r--r--ld/emulparams/elf32_spu.sh4
-rw-r--r--ld/emulparams/elf32_tic6x_le.sh4
-rw-r--r--ld/emulparams/elf32bmip.sh8
-rw-r--r--ld/emulparams/elf32btsmipn32.sh8
-rw-r--r--ld/emulparams/elf32lr5900n32.sh8
-rw-r--r--ld/emulparams/elf32mep.sh3
-rw-r--r--ld/emulparams/elf32metag.sh2
-rw-r--r--ld/emulparams/elf64btsmip.sh8
-rw-r--r--ld/emulparams/shelf_vxworks.sh4
-rw-r--r--ld/emulparams/shlelf_fd.sh2
15 files changed, 33 insertions, 28 deletions
diff --git a/ld/emulparams/aarch64cloudabi.sh b/ld/emulparams/aarch64cloudabi.sh
index 1b8ca15..983a92b 100644
--- a/ld/emulparams/aarch64cloudabi.sh
+++ b/ld/emulparams/aarch64cloudabi.sh
@@ -34,4 +34,4 @@ OTHER_END_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__end__ = .${CREATE_SHLIB+)};"
OTHER_SECTIONS='.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }'
ATTRS_SECTIONS='.ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) }'
# Ensure each PLT entry is aligned to a cache line.
-PLT=".plt ${RELOCATING-0} : ALIGN(16) { *(.plt)${IREL_IN_PLT+ *(.iplt)} }"
+PLT=".plt ${RELOCATING-0} : ALIGN(16) { *(.plt)${RELOCATING+${IREL_IN_PLT+ *(.iplt)}} }"
diff --git a/ld/emulparams/aarch64fbsd.sh b/ld/emulparams/aarch64fbsd.sh
index 4a307cd..3a7a2e1 100644
--- a/ld/emulparams/aarch64fbsd.sh
+++ b/ld/emulparams/aarch64fbsd.sh
@@ -34,4 +34,4 @@ OTHER_END_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__end__ = .${CREATE_SHLIB+)};"
OTHER_SECTIONS='.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }'
ATTRS_SECTIONS='.ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) }'
# Ensure each PLT entry is aligned to a cache line.
-PLT=".plt ${RELOCATING-0} : ALIGN(16) { *(.plt)${IREL_IN_PLT+ *(.iplt)} }"
+PLT=".plt ${RELOCATING-0} : ALIGN(16) { *(.plt)${RELOCATING+${IREL_IN_PLT+ *(.iplt)}} }"
diff --git a/ld/emulparams/aarch64linux.sh b/ld/emulparams/aarch64linux.sh
index 2ba1d79..5df6ae1 100644
--- a/ld/emulparams/aarch64linux.sh
+++ b/ld/emulparams/aarch64linux.sh
@@ -34,7 +34,7 @@ OTHER_END_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__end__ = .${CREATE_SHLIB+)};"
OTHER_SECTIONS='.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }'
ATTRS_SECTIONS='.ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) }'
# Ensure each PLT entry is aligned to a cache line.
-PLT=".plt ${RELOCATING-0} : ALIGN(16) { *(.plt)${IREL_IN_PLT+ *(.iplt)} }"
+PLT=".plt ${RELOCATING-0} : ALIGN(16) { *(.plt)${RELOCATING+${IREL_IN_PLT+ *(.iplt)}} }"
# Linux modifies the default library search path to first include
# a 64-bit specific directory.
diff --git a/ld/emulparams/aarch64linux32.sh b/ld/emulparams/aarch64linux32.sh
index 0b4d4c9..3c60de0 100644
--- a/ld/emulparams/aarch64linux32.sh
+++ b/ld/emulparams/aarch64linux32.sh
@@ -34,7 +34,7 @@ OTHER_END_SYMBOLS="${CREATE_SHLIB+PROVIDE (}__end__ = .${CREATE_SHLIB+)};"
OTHER_SECTIONS='.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }'
ATTRS_SECTIONS='.ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) }'
# Ensure each PLT entry is aligned to a cache line.
-PLT=".plt ${RELOCATING-0} : ALIGN(16) { *(.plt)${IREL_IN_PLT+ *(.iplt)} }"
+PLT=".plt ${RELOCATING-0} : ALIGN(16) { *(.plt)${RELOCATING+${IREL_IN_PLT+ *(.iplt)}} }"
# Linux modifies the default library search path to first include
# a 32-bit specific directory.
diff --git a/ld/emulparams/arc-nps.sh b/ld/emulparams/arc-nps.sh
index 615e6d5..ecca2fe 100644
--- a/ld/emulparams/arc-nps.sh
+++ b/ld/emulparams/arc-nps.sh
@@ -1,3 +1,4 @@
+if test -n "${RELOCATING}"; then
OTHER_SECTIONS="
/* Start of symbols and sections required to support CMEM instructions
on NPS targets. */
@@ -76,3 +77,4 @@ OTHER_SECTIONS="
/* End of nps specific sections and symbols. */
${OTHER_SECTIONS}"
+fi
diff --git a/ld/emulparams/elf32_spu.sh b/ld/emulparams/elf32_spu.sh
index 6993ca7..235455f 100644
--- a/ld/emulparams/elf32_spu.sh
+++ b/ld/emulparams/elf32_spu.sh
@@ -19,9 +19,9 @@ MAXPAGESIZE=0x80
DATA_ADDR="ALIGN(${MAXPAGESIZE})"
OTHER_BSS_SECTIONS=".toe ALIGN(128) : { *(.toe) } = 0"
OTHER_SECTIONS=".note.spu_name 0 : { KEEP(*(.note.spu_name)) }
- ._ea 0 : { KEEP(*(._ea)) KEEP(*(._ea.*)) }"
+ ._ea 0 : { KEEP(*(._ea))${RELOCATING+ KEEP(*(._ea.*))} }"
OTHER_READONLY_SECTIONS="
.fixup ${RELOCATING-0} : {
- PROVIDE (__fixup_start = .);
+ ${RELOCATING+PROVIDE (__fixup_start = .);}
KEEP(*(.fixup))
}"
diff --git a/ld/emulparams/elf32_tic6x_le.sh b/ld/emulparams/elf32_tic6x_le.sh
index d9ebe58..62ea9eb 100644
--- a/ld/emulparams/elf32_tic6x_le.sh
+++ b/ld/emulparams/elf32_tic6x_le.sh
@@ -15,8 +15,8 @@ case ${target} in
TEXT_START_ADDR=0x0
GOT="
.got ${RELOCATING-0} : {
- *(.dsbt)
- *(.got.plt) *(.igot.plt) *(.got) *(.igot)
+ ${RELOCATING+*(.dsbt)
+ *(.got.plt) *(.igot.plt) }*(.got)${RELOCATING+ *(.igot)}
}"
;;
esac
diff --git a/ld/emulparams/elf32bmip.sh b/ld/emulparams/elf32bmip.sh
index da5e7fb..abbcb5b 100644
--- a/ld/emulparams/elf32bmip.sh
+++ b/ld/emulparams/elf32bmip.sh
@@ -58,9 +58,9 @@ OTHER_SDATA_SECTIONS="
TEXT_START_SYMBOLS="${CREATE_SHLIB+PROVIDE (}_ftext = .${CREATE_SHLIB+)};"
DATA_START_SYMBOLS="${CREATE_SHLIB+PROVIDE (}_fdata = .${CREATE_SHLIB+)};"
OTHER_BSS_SYMBOLS="${CREATE_SHLIB+PROVIDE (}_fbss = .${CREATE_SHLIB+)};"
-OTHER_SECTIONS='
- .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
- .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
+OTHER_SECTIONS="
+ .gptab.sdata : {${RELOCATING+ *(.gptab.data)} *(.gptab.sdata) }
+ .gptab.sbss : {${RELOCATING+ *(.gptab.bss)} *(.gptab.sbss) }
.mdebug.abi32 0 : { KEEP(*(.mdebug.abi32)) }
.mdebug.abiN32 0 : { KEEP(*(.mdebug.abiN32)) }
.mdebug.abi64 0 : { KEEP(*(.mdebug.abi64)) }
@@ -69,7 +69,7 @@ OTHER_SECTIONS='
.mdebug.eabi64 0 : { KEEP(*(.mdebug.eabi64)) }
.gcc_compiled_long32 0 : { KEEP(*(.gcc_compiled_long32)) }
.gcc_compiled_long64 0 : { KEEP(*(.gcc_compiled_long64)) }
-'
+"
ARCH=mips
MACHINE=
TEMPLATE_NAME=elf32
diff --git a/ld/emulparams/elf32btsmipn32.sh b/ld/emulparams/elf32btsmipn32.sh
index 10c5565..5fc325f 100644
--- a/ld/emulparams/elf32btsmipn32.sh
+++ b/ld/emulparams/elf32btsmipn32.sh
@@ -9,7 +9,7 @@ COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
# Magic sections.
OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)'
-OTHER_SECTIONS='
- .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
- .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
-'
+OTHER_SECTIONS="
+ .gptab.sdata : {${RELOCATING+ *(.gptab.data)} *(.gptab.sdata) }
+ .gptab.sbss : {${RELOCATING+ *(.gptab.bss)} *(.gptab.sbss) }
+"
diff --git a/ld/emulparams/elf32lr5900n32.sh b/ld/emulparams/elf32lr5900n32.sh
index 69f7afb..7a3c6d7 100644
--- a/ld/emulparams/elf32lr5900n32.sh
+++ b/ld/emulparams/elf32lr5900n32.sh
@@ -12,10 +12,10 @@ EMBEDDED=yes
DYNAMIC_LINK=FALSE
OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)'
-OTHER_SECTIONS='
- .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
- .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
-'
+OTHER_SECTIONS="
+ .gptab.sdata : {${RELOCATING+ *(.gptab.data)} *(.gptab.sdata) }
+ .gptab.sbss : {${RELOCATING+ *(.gptab.bss)} *(.gptab.sbss) }
+"
unset DATA_ADDR
SHLIB_TEXT_START_ADDR=0
diff --git a/ld/emulparams/elf32mep.sh b/ld/emulparams/elf32mep.sh
index 2ebbda1..7d93aba 100644
--- a/ld/emulparams/elf32mep.sh
+++ b/ld/emulparams/elf32mep.sh
@@ -7,6 +7,8 @@ MAXPAGESIZE=256
ENTRY=_start
EMBEDDED=yes
TEMPLATE_NAME=elf32
+
+if test -n "${RELOCATING}"; then
DATA_START_SYMBOLS='__data_start = . ;'
OTHER_GOT_SYMBOLS='
. = ALIGN(4);
@@ -53,3 +55,4 @@ OTHER_BSS_SECTIONS='
__assert_near_size = ASSERT (. <= 0x1000000, "near section overflow");
.farbss : { PROVIDE (__farbss_start = .); *(.farbss) *(.farbss.*) PROVIDE (__farbss_end = .); }
'
+fi
diff --git a/ld/emulparams/elf32metag.sh b/ld/emulparams/elf32metag.sh
index 2a1d072..9d71d7a 100644
--- a/ld/emulparams/elf32metag.sh
+++ b/ld/emulparams/elf32metag.sh
@@ -12,7 +12,7 @@ ENTRY=__start
NOP=0xa0fffffe
EXTRA_EM_FILE=metagelf
USER_LABEL_PREFIX=_
-OTHER_SECTIONS="
+test -n "${RELOCATING}" && OTHER_SECTIONS="
.core_text 0x80000000 :
{
*(.core_text)
diff --git a/ld/emulparams/elf64btsmip.sh b/ld/emulparams/elf64btsmip.sh
index b9e80bb..202585f 100644
--- a/ld/emulparams/elf64btsmip.sh
+++ b/ld/emulparams/elf64btsmip.sh
@@ -8,9 +8,9 @@ LITTLE_OUTPUT_FORMAT="elf64-tradlittlemips"
# Magic sections.
OTHER_TEXT_SECTIONS='*(.mips16.fn.*) *(.mips16.call.*)'
-OTHER_SECTIONS='
- .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
- .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
-'
+OTHER_SECTIONS="
+ .gptab.sdata : {${RELOCATING+ *(.gptab.data)} *(.gptab.sdata) }
+ .gptab.sbss : {${RELOCATING+ *(.gptab.bss)} *(.gptab.sbss) }
+"
TEXT_START_ADDR="0x120000000"
diff --git a/ld/emulparams/shelf_vxworks.sh b/ld/emulparams/shelf_vxworks.sh
index c450990..4b82e36 100644
--- a/ld/emulparams/shelf_vxworks.sh
+++ b/ld/emulparams/shelf_vxworks.sh
@@ -16,6 +16,6 @@ ENTRY=__start
SYMPREFIX=_
GOT=".got ${RELOCATING-0} : {
- PROVIDE(__GLOBAL_OFFSET_TABLE_ = .);
- *(.got.plt) *(.got) }"
+ ${RELOCATING+PROVIDE(__GLOBAL_OFFSET_TABLE_ = .);
+ *(.got.plt) }*(.got) }"
. ${srcdir}/emulparams/vxworks.sh
diff --git a/ld/emulparams/shlelf_fd.sh b/ld/emulparams/shlelf_fd.sh
index f1f4107..cf827e5 100644
--- a/ld/emulparams/shlelf_fd.sh
+++ b/ld/emulparams/shlelf_fd.sh
@@ -3,7 +3,7 @@
. ${srcdir}/emulparams/shlelf_linux.sh
OUTPUT_FORMAT="elf32-sh-fdpic"
-GOT=".got ${RELOCATING-0} : { *(.got.funcdesc) *(.got.plt) *(.got) }"
+GOT=".got ${RELOCATING-0} : {${RELOCATING+ *(.got.funcdesc) *(.got.plt)} *(.got) }"
OTHER_GOT_RELOC_SECTIONS="
.rela.got.funcdesc ${RELOCATING-0} : { *(.rela.got.funcdesc) }
"