From bdd32e03c5e87bd38e63e9cc3fd35375241db58f Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Sun, 18 Jun 2017 09:19:34 +0930 Subject: [PATCH] is_underscore_target for ld-elf tests and correct targ_underscore in config.bfd bfd/ * config.bfd: Correct targ_underscore for epiphany, ip2k, m32c, mn10200, pru, rl78, rx, crisv32 and v850. ld/ * testsuite/lib/ld-lib.exp (is_underscore_target): New. * testsuite/ld-elf/elf.exp (ASFLAGS): Define UNDERSCORE. * testsuite/ld-elf/pr21562a.s: If UNDERSCORE defined, reference sym with prefix. * testsuite/ld-elf/pr21562b.s: Likewise. * testsuite/ld-elf/sizeof.s: Likewise. * testsuite/ld-elf/startof.s: Likewise. * testsuite/ld-elf/pr14156a.d: Adjust for extra symbols. * testsuite/ld-elf/pr21562a.d: Remove underscore target from xfails, and match prefixed symbol. * testsuite/ld-elf/pr21562b.d: Likewise. * testsuite/ld-elf/pr21562c.d: Likewise. * testsuite/ld-elf/pr21562d.d: Likewise. * testsuite/ld-elf/pr21562e.d: Likewise. * testsuite/ld-elf/pr21562f.d: Likewise. * testsuite/ld-elf/pr21562g.d: Likewise. * testsuite/ld-elf/pr21562h.d: Likewise. * testsuite/ld-elf/pr21562i.d: Likewise. * testsuite/ld-elf/pr21562j.d: Likewise. * testsuite/ld-elf/pr21562k.d: Likewise. * testsuite/ld-elf/pr21562l.d: Likewise. * testsuite/ld-elf/pr21562m.d: Likewise. * testsuite/ld-elf/pr21562n.d: Likewise. * testsuite/ld-elf/sizeofa.d: Likewise. * testsuite/ld-elf/sizeofb.d: Likewise. * testsuite/ld-elf/sizeofc.d: Likewise. * testsuite/ld-elf/startofa.d: Likewise. * testsuite/ld-elf/startofb.d: Likewise. * testsuite/ld-elf/startofc.d: Likewise. --- bfd/ChangeLog | 5 +++++ bfd/config.bfd | 17 ++++++++++++++--- ld/ChangeLog | 32 ++++++++++++++++++++++++++++++++ ld/testsuite/ld-elf/elf.exp | 4 ++++ ld/testsuite/ld-elf/pr14156a.d | 1 + ld/testsuite/ld-elf/pr21562a.d | 6 +----- ld/testsuite/ld-elf/pr21562a.s | 4 ++++ ld/testsuite/ld-elf/pr21562b.d | 6 +----- ld/testsuite/ld-elf/pr21562b.s | 4 ++++ ld/testsuite/ld-elf/pr21562c.d | 6 +----- ld/testsuite/ld-elf/pr21562d.d | 6 +----- ld/testsuite/ld-elf/pr21562e.d | 6 +----- ld/testsuite/ld-elf/pr21562f.d | 6 +----- ld/testsuite/ld-elf/pr21562g.d | 6 +----- ld/testsuite/ld-elf/pr21562h.d | 6 +----- ld/testsuite/ld-elf/pr21562i.d | 6 +----- ld/testsuite/ld-elf/pr21562j.d | 6 +----- ld/testsuite/ld-elf/pr21562k.d | 6 +----- ld/testsuite/ld-elf/pr21562l.d | 6 +----- ld/testsuite/ld-elf/pr21562m.d | 6 +----- ld/testsuite/ld-elf/pr21562n.d | 6 +----- ld/testsuite/ld-elf/sizeof.s | 4 ++++ ld/testsuite/ld-elf/sizeofa.d | 7 +------ ld/testsuite/ld-elf/sizeofb.d | 6 +----- ld/testsuite/ld-elf/sizeofc.d | 2 +- ld/testsuite/ld-elf/startof.s | 4 ++++ ld/testsuite/ld-elf/startofa.d | 9 ++------- ld/testsuite/ld-elf/startofb.d | 6 +----- ld/testsuite/ld-elf/startofc.d | 2 +- ld/testsuite/lib/ld-lib.exp | 19 +++++++++++++++++++ 30 files changed, 112 insertions(+), 98 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index c51dffc1dd1..f2f9b459f87 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2017-06-18 Alan Modra + + * config.bfd: Correct targ_underscore for epiphany, ip2k, + m32c, mn10200, pru, rl78, rx, crisv32 and v850. + 2017-06-16 Nick Clifton * elflink.c (bfd_elf_size_dynsym_hash_dynstr): Do not fail if the diff --git a/bfd/config.bfd b/bfd/config.bfd index d0b509dc803..f8a26f46cbc 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -500,10 +500,15 @@ case "${targ}" in targ_underscore=yes ;; - cris-*-* | crisv32-*-*) + cris-*-*) + targ_defvec=cris_aout_vec + targ_selvecs="cris_elf32_us_vec cris_elf32_vec ieee_vec" + targ_underscore=yes + ;; + + crisv32-*-*) targ_defvec=cris_aout_vec targ_selvecs="cris_elf32_us_vec cris_elf32_vec ieee_vec" - targ_underscore=yes # Note: not true for cris_elf32_vec. ;; crx-*-elf*) @@ -526,6 +531,7 @@ case "${targ}" in epiphany-*-*) targ_defvec=epiphany_elf32_vec + targ_underscore=yes ;; fido-*-elf* ) @@ -913,6 +919,7 @@ case "${targ}" in ip2k-*-elf) targ_defvec=ip2k_elf32_vec + targ_underscore=yes ;; iq2000-*-elf) @@ -931,6 +938,7 @@ case "${targ}" in m32c-*-elf | m32c-*-rtems*) targ_defvec=m32c_elf32_vec + targ_underscore=yes ;; m32r*le-*-linux*) @@ -1231,6 +1239,7 @@ case "${targ}" in #endif mn10200-*-*) targ_defvec=mn10200_elf32_vec + targ_underscore=yes ;; mn10300-*-*) @@ -1435,7 +1444,6 @@ case "${targ}" in pru-*-*) targ_defvec=pru_elf32_vec - targ_underscore=yes ;; #ifdef BFD64 @@ -1453,11 +1461,13 @@ case "${targ}" in rl78-*-elf) targ_defvec=rl78_elf32_vec + targ_underscore=yes ;; rx-*-elf) targ_defvec=rx_elf32_le_vec targ_selvecs="rx_elf32_be_vec rx_elf32_le_vec rx_elf32_be_ns_vec" + targ_underscore=yes ;; s390-*-linux*) @@ -1767,6 +1777,7 @@ case "${targ}" in v850*-*-*) targ_defvec=v850_elf32_vec targ_selvecs="v800_elf32_vec" + targ_underscore=yes ;; vax-*-netbsdelf*) diff --git a/ld/ChangeLog b/ld/ChangeLog index 583a936d0ba..b16551f98e8 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,35 @@ +2017-06-18 Alan Modra + + * testsuite/lib/ld-lib.exp (is_underscore_target): New. + * testsuite/ld-elf/elf.exp (ASFLAGS): Define UNDERSCORE. + * testsuite/ld-elf/pr21562a.s: If UNDERSCORE defined, + reference sym with prefix. + * testsuite/ld-elf/pr21562b.s: Likewise. + * testsuite/ld-elf/sizeof.s: Likewise. + * testsuite/ld-elf/startof.s: Likewise. + * testsuite/ld-elf/pr14156a.d: Adjust for extra symbols. + * testsuite/ld-elf/pr21562a.d: Remove underscore target from + xfails, and match prefixed symbol. + * testsuite/ld-elf/pr21562b.d: Likewise. + * testsuite/ld-elf/pr21562c.d: Likewise. + * testsuite/ld-elf/pr21562d.d: Likewise. + * testsuite/ld-elf/pr21562e.d: Likewise. + * testsuite/ld-elf/pr21562f.d: Likewise. + * testsuite/ld-elf/pr21562g.d: Likewise. + * testsuite/ld-elf/pr21562h.d: Likewise. + * testsuite/ld-elf/pr21562i.d: Likewise. + * testsuite/ld-elf/pr21562j.d: Likewise. + * testsuite/ld-elf/pr21562k.d: Likewise. + * testsuite/ld-elf/pr21562l.d: Likewise. + * testsuite/ld-elf/pr21562m.d: Likewise. + * testsuite/ld-elf/pr21562n.d: Likewise. + * testsuite/ld-elf/sizeofa.d: Likewise. + * testsuite/ld-elf/sizeofb.d: Likewise. + * testsuite/ld-elf/sizeofc.d: Likewise. + * testsuite/ld-elf/startofa.d: Likewise. + * testsuite/ld-elf/startofb.d: Likewise. + * testsuite/ld-elf/startofc.d: Likewise. + 2017-06-16 Alan Modra PR ld/20022 diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp index f889070f5d8..80a8c42bf9f 100644 --- a/ld/testsuite/ld-elf/elf.exp +++ b/ld/testsuite/ld-elf/elf.exp @@ -178,6 +178,10 @@ if { [check_shared_lib_support] } then { {pr20995a.s} {{readelf {-S --wide} pr20995.r}} "pr20995-2"]] } +if [is_underscore_target] { + set ASFLAGS "$ASFLAGS --defsym UNDERSCORE=1" +} + set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]] foreach t $test_list { # We need to strip the ".d", but can leave the dirname. diff --git a/ld/testsuite/ld-elf/pr14156a.d b/ld/testsuite/ld-elf/pr14156a.d index efdc8461fb8..ffc6bfc5521 100644 --- a/ld/testsuite/ld-elf/pr14156a.d +++ b/ld/testsuite/ld-elf/pr14156a.d @@ -10,6 +10,7 @@ #... [0-9a-f]+ T foo [0-9a-f]+ t foo1 +#... [0-9a-f]+ t foo2 [0-9a-f]+ t foo3 [0-9a-f]+ t last diff --git a/ld/testsuite/ld-elf/pr21562a.d b/ld/testsuite/ld-elf/pr21562a.d index 1f57569d3ea..ecf013f432c 100644 --- a/ld/testsuite/ld-elf/pr21562a.d +++ b/ld/testsuite/ld-elf/pr21562a.d @@ -3,14 +3,10 @@ #target: *-*-linux* *-*-gnu* #xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-* #xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-* -#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-* -#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-* -#xfail: rl78-*-* rx-*-* v850*-*-* -# Targets with a leading char will fail this test. # generic linker targets don't support --gc-sections, nor do a bunch of others #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +__start_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562a.s b/ld/testsuite/ld-elf/pr21562a.s index ec36da4b8e5..a9ac1fb91d1 100644 --- a/ld/testsuite/ld-elf/pr21562a.s +++ b/ld/testsuite/ld-elf/pr21562a.s @@ -5,4 +5,8 @@ .data .type bar, %object bar: + .ifdef UNDERSCORE + .dc.a ___start_scnfoo + .else .dc.a __start_scnfoo + .endif diff --git a/ld/testsuite/ld-elf/pr21562b.d b/ld/testsuite/ld-elf/pr21562b.d index dd28b66ca69..063a141741a 100644 --- a/ld/testsuite/ld-elf/pr21562b.d +++ b/ld/testsuite/ld-elf/pr21562b.d @@ -3,14 +3,10 @@ #target: *-*-linux* *-*-gnu* #xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-* #xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-* -#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-* -#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-* -#xfail: rl78-*-* rx-*-* v850*-*-* -# Targets with a leading char will fail this test. # generic linker targets don't support --gc-sections, nor do a bunch of others #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +__stop_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562b.s b/ld/testsuite/ld-elf/pr21562b.s index 1732ee24b20..d79694c3d56 100644 --- a/ld/testsuite/ld-elf/pr21562b.s +++ b/ld/testsuite/ld-elf/pr21562b.s @@ -5,4 +5,8 @@ .data .type bar, %object bar: + .ifdef UNDERSCORE + .dc.a ___stop_scnfoo + .else .dc.a __stop_scnfoo + .endif diff --git a/ld/testsuite/ld-elf/pr21562c.d b/ld/testsuite/ld-elf/pr21562c.d index 69eb6aacb4d..1d72a0d02f1 100644 --- a/ld/testsuite/ld-elf/pr21562c.d +++ b/ld/testsuite/ld-elf/pr21562c.d @@ -4,14 +4,10 @@ #target: *-*-linux* *-*-gnu* #xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-* #xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-* -#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-* -#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-* -#xfail: rl78-*-* rx-*-* v850*-*-* -# Targets with a leading char will fail this test. # generic linker targets don't support --gc-sections, nor do a bunch of others #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +__start_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562d.d b/ld/testsuite/ld-elf/pr21562d.d index 7e138219033..f752a2465a2 100644 --- a/ld/testsuite/ld-elf/pr21562d.d +++ b/ld/testsuite/ld-elf/pr21562d.d @@ -4,14 +4,10 @@ #target: *-*-linux* *-*-gnu* #xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-* #xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-* -#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-* -#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-* -#xfail: rl78-*-* rx-*-* v850*-*-* -# Targets with a leading char will fail this test. # generic linker targets don't support --gc-sections, nor do a bunch of others #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +__stop_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562e.d b/ld/testsuite/ld-elf/pr21562e.d index 0172a069d8b..769f2f8a4bd 100644 --- a/ld/testsuite/ld-elf/pr21562e.d +++ b/ld/testsuite/ld-elf/pr21562e.d @@ -2,13 +2,9 @@ #ld: -shared -z defs #readelf: -s -S --wide #target: *-*-linux* *-*-gnu* -#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-* -#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-* -#xfail: rl78-*-* rx-*-* v850*-*-* -# Targets with a leading char will fail this test. #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +__start_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562f.d b/ld/testsuite/ld-elf/pr21562f.d index a0f1a24d82a..cb81c2a36bf 100644 --- a/ld/testsuite/ld-elf/pr21562f.d +++ b/ld/testsuite/ld-elf/pr21562f.d @@ -2,13 +2,9 @@ #ld: -shared -z defs #readelf: -s -S --wide #target: *-*-linux* *-*-gnu* -#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-* -#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-* -#xfail: rl78-*-* rx-*-* v850*-*-* -# Targets with a leading char will fail this test. #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +__stop_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562g.d b/ld/testsuite/ld-elf/pr21562g.d index 289ab75191b..9926416abe9 100644 --- a/ld/testsuite/ld-elf/pr21562g.d +++ b/ld/testsuite/ld-elf/pr21562g.d @@ -2,13 +2,9 @@ #ld: -shared -z defs -T pr21562a.t #readelf: -s -S --wide #target: *-*-linux* *-*-gnu* -#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-* -#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-* -#xfail: rl78-*-* rx-*-* v850*-*-* -# Targets with a leading char will fail this test. #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +__start_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562h.d b/ld/testsuite/ld-elf/pr21562h.d index c94e63669f2..1e723ba0990 100644 --- a/ld/testsuite/ld-elf/pr21562h.d +++ b/ld/testsuite/ld-elf/pr21562h.d @@ -2,13 +2,9 @@ #ld: -shared -z defs -T pr21562a.t #readelf: -s -S --wide #target: *-*-linux* *-*-gnu* -#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-* -#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-* -#xfail: rl78-*-* rx-*-* v850*-*-* -# Targets with a leading char will fail this test. #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +__stop_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562i.d b/ld/testsuite/ld-elf/pr21562i.d index 2670f60537d..f5b59c54b8b 100644 --- a/ld/testsuite/ld-elf/pr21562i.d +++ b/ld/testsuite/ld-elf/pr21562i.d @@ -4,14 +4,10 @@ #target: *-*-linux* *-*-gnu* #xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-* #xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-* -#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-* -#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-* -#xfail: rl78-*-* rx-*-* v850*-*-* -# Targets with a leading char will fail this test. # generic linker targets don't support --gc-sections, nor do a bunch of others #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +__start_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562j.d b/ld/testsuite/ld-elf/pr21562j.d index 7c5508a5b43..70e311e231d 100644 --- a/ld/testsuite/ld-elf/pr21562j.d +++ b/ld/testsuite/ld-elf/pr21562j.d @@ -4,14 +4,10 @@ #target: *-*-linux* *-*-gnu* #xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-* #xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-* -#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-* -#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-* -#xfail: rl78-*-* rx-*-* v850*-*-* -# Targets with a leading char will fail this test. # generic linker targets don't support --gc-sections, nor do a bunch of others #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +__stop_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562k.d b/ld/testsuite/ld-elf/pr21562k.d index 7f76d08c82c..4c62eb7966e 100644 --- a/ld/testsuite/ld-elf/pr21562k.d +++ b/ld/testsuite/ld-elf/pr21562k.d @@ -4,14 +4,10 @@ #target: *-*-linux* *-*-gnu* #xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-* #xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-* -#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-* -#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-* -#xfail: rl78-*-* rx-*-* v850*-*-* -# Targets with a leading char will fail this test. # generic linker targets don't support --gc-sections, nor do a bunch of others #... \[[ 0-9]+\] \.foo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +__start_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562l.d b/ld/testsuite/ld-elf/pr21562l.d index 1ad601c554e..b0ba90dd3c0 100644 --- a/ld/testsuite/ld-elf/pr21562l.d +++ b/ld/testsuite/ld-elf/pr21562l.d @@ -4,14 +4,10 @@ #target: *-*-linux* *-*-gnu* #xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-* #xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-* -#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-* -#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-* -#xfail: rl78-*-* rx-*-* v850*-*-* -# Targets with a leading char will fail this test. # generic linker targets don't support --gc-sections, nor do a bunch of others #... \[[ 0-9]+\] \.foo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +__stop_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562m.d b/ld/testsuite/ld-elf/pr21562m.d index 2fedacdb5f8..fbcf76f4761 100644 --- a/ld/testsuite/ld-elf/pr21562m.d +++ b/ld/testsuite/ld-elf/pr21562m.d @@ -4,14 +4,10 @@ #target: *-*-linux* *-*-gnu* #xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-* #xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-* -#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-* -#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-* -#xfail: rl78-*-* rx-*-* v850*-*-* -# Targets with a leading char will fail this test. # generic linker targets don't support --gc-sections, nor do a bunch of others #... \[[ 0-9]+\] \.foo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +__start_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562n.d b/ld/testsuite/ld-elf/pr21562n.d index f12b23d7ea0..2453169999f 100644 --- a/ld/testsuite/ld-elf/pr21562n.d +++ b/ld/testsuite/ld-elf/pr21562n.d @@ -4,14 +4,10 @@ #target: *-*-linux* *-*-gnu* #xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-* #xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-* -#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-* -#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-* -#xfail: rl78-*-* rx-*-* v850*-*-* -# Targets with a leading char will fail this test. # generic linker targets don't support --gc-sections, nor do a bunch of others #... \[[ 0-9]+\] \.foo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +__stop_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo #pass diff --git a/ld/testsuite/ld-elf/sizeof.s b/ld/testsuite/ld-elf/sizeof.s index 016ac60fd1a..c275549cd4f 100644 --- a/ld/testsuite/ld-elf/sizeof.s +++ b/ld/testsuite/ld-elf/sizeof.s @@ -7,5 +7,9 @@ .type bar, %object .size bar, 8 bar: + .ifdef UNDERSCORE + .dc.a ___stop_scnfoo + .else .dc.a __stop_scnfoo + .endif .dc.a .sizeof. (scnfoo) diff --git a/ld/testsuite/ld-elf/sizeofa.d b/ld/testsuite/ld-elf/sizeofa.d index 340456de8a3..fc64cf54111 100644 --- a/ld/testsuite/ld-elf/sizeofa.d +++ b/ld/testsuite/ld-elf/sizeofa.d @@ -1,17 +1,12 @@ #source: sizeof.s #ld: -Ur #readelf: -sW -#xfail: bfin-*-* cr16-*-* cr16c-*-* cris*-*-elf crx-*-* epiphany-*-* -#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-* -#xfail: rl78-*-* rx-*-* sh*-*-elf* sh*-*-kaos* sh*-*-nto* sh-*-rtems* -#xfail: sh*-*-symbianelf* sh*-*-vxworks v850*-*-* -# Targets with a leading char will fail this test. Symbol table '\.symtab' contains [0-9]+ entries: +Num: +Value +Size Type +Bind +Vis +Ndx Name +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND + #... - +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +(LOC|GLOB)AL +DEFAULT +[0-9]+ +__stop_scnfoo + +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +(LOC|GLOB)AL +DEFAULT +[0-9]+ +___?stop_scnfoo #... +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +UND +.sizeof.scnfoo #pass diff --git a/ld/testsuite/ld-elf/sizeofb.d b/ld/testsuite/ld-elf/sizeofb.d index e25d88f06fe..ac4a6a474e3 100644 --- a/ld/testsuite/ld-elf/sizeofb.d +++ b/ld/testsuite/ld-elf/sizeofb.d @@ -2,16 +2,12 @@ #ld: -shared #readelf: -sW #target: *-*-linux* *-*-gnu* -#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-* -#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-* -#xfail: rl78-*-* rx-*-* v850*-*-* -# Targets with a leading char will fail this test. Symbol table '\.dynsym' contains [0-9]+ entries: +Num: +Value +Size Type +Bind +Vis +Ndx Name +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND + #... - +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +LOCAL +DEFAULT +[0-9]+ +__stop_scnfoo + +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo #... +[0-9]+: 0+10 + +0 +NOTYPE +LOCAL +DEFAULT +ABS +.sizeof.scnfoo #pass diff --git a/ld/testsuite/ld-elf/sizeofc.d b/ld/testsuite/ld-elf/sizeofc.d index 1cff854b439..219caad1076 100644 --- a/ld/testsuite/ld-elf/sizeofc.d +++ b/ld/testsuite/ld-elf/sizeofc.d @@ -6,7 +6,7 @@ Symbol table '\.symtab' contains [0-9]+ entries: +Num: +Value +Size Type +Bind +Vis +Ndx Name +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND + #... - +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +UND +__stop_scnfoo + +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +UND +___?stop_scnfoo #... +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +UND +.sizeof.scnfoo #pass diff --git a/ld/testsuite/ld-elf/startof.s b/ld/testsuite/ld-elf/startof.s index 982f347a383..a1bb4655443 100644 --- a/ld/testsuite/ld-elf/startof.s +++ b/ld/testsuite/ld-elf/startof.s @@ -7,5 +7,9 @@ .type bar, %object .size bar, 8 bar: + .ifdef UNDERSCORE + .dc.a ___start_scnfoo + .else .dc.a __start_scnfoo + .endif .dc.a .startof. (scnfoo) diff --git a/ld/testsuite/ld-elf/startofa.d b/ld/testsuite/ld-elf/startofa.d index 19ac29d2ee1..b0bf95b1a26 100644 --- a/ld/testsuite/ld-elf/startofa.d +++ b/ld/testsuite/ld-elf/startofa.d @@ -1,17 +1,12 @@ #source: startof.s #ld: -Ur #readelf: -sW -#xfail: bfin-*-* cr16-*-* cr16c-*-* cris*-*-elf crx-*-* epiphany-*-* -#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-* -#xfail: rl78-*-* rx-*-* sh*-*-elf* sh*-*-kaos* sh*-*-nto* sh-*-rtems* -#xfail: sh*-*-symbianelf* sh*-*-vxworks v850*-*-* -# Targets with a leading char will fail this test. Symbol table '\.symtab' contains [0-9]+ entries: +Num: +Value +Size Type +Bind +Vis +Ndx Name +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND + #... - +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +(LOCAL +DEFAULT +[0-9]+ +__start_scnfoo|GLOBAL +DEFAULT +UND +.startof.scnfoo) + +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +(LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo|GLOBAL +DEFAULT +UND +.startof.scnfoo) #... - +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +(UND +.startof.scnfoo|[0-9]+ +__start_scnfoo) + +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +(UND +.startof.scnfoo|[0-9]+ +___?start_scnfoo) #pass diff --git a/ld/testsuite/ld-elf/startofb.d b/ld/testsuite/ld-elf/startofb.d index 2cc1b861490..5d659bb8e5e 100644 --- a/ld/testsuite/ld-elf/startofb.d +++ b/ld/testsuite/ld-elf/startofb.d @@ -2,10 +2,6 @@ #ld: -shared #readelf: -sW #target: *-*-linux* *-*-gnu* -#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-* -#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-* -#xfail: rl78-*-* rx-*-* v850*-*-* -# Targets with a leading char will fail this test. Symbol table '\.dynsym' contains [0-9]+ entries: +Num: +Value +Size Type +Bind +Vis +Ndx Name @@ -13,5 +9,5 @@ Symbol table '\.dynsym' contains [0-9]+ entries: #... +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +LOCAL +DEFAULT +[0-9]+ +.startof.scnfoo #... - +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +LOCAL +DEFAULT +[0-9]+ +__start_scnfoo + +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo #pass diff --git a/ld/testsuite/ld-elf/startofc.d b/ld/testsuite/ld-elf/startofc.d index 4005625a0b8..6cde35aa057 100644 --- a/ld/testsuite/ld-elf/startofc.d +++ b/ld/testsuite/ld-elf/startofc.d @@ -8,5 +8,5 @@ Symbol table '\.symtab' contains [0-9]+ entries: #... +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +UND +.startof.scnfoo #... - +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +UND +__start_scnfoo + +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +UND +___?start_scnfoo #pass diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp index aecc7008385..cddcaf834b2 100644 --- a/ld/testsuite/lib/ld-lib.exp +++ b/ld/testsuite/lib/ld-lib.exp @@ -1858,6 +1858,25 @@ proc is_generic_elf { } { return 0; } +proc is_underscore_target { } { + global is_underscore_target_saved + global target_triplet + global srcdir + + if { ![info exists is_underscore_target_saved] } { + set cmd "targ=$target_triplet . $srcdir/../../bfd/config.bfd &&" + append cmd { echo "$targ_underscore"} + verbose -log "$cmd" + set status [catch {exec sh -c $cmd} result] + if { $status == 0 && [string match "yes" $result] } { + set is_underscore_target_saved 1 + } else { + set is_underscore_target_saved 0 + } + } + return $is_underscore_target_saved +} + # Returns true if the target ld supports the plugin API. proc check_plugin_api_available { } { global plugin_api_available_saved -- 2.30.2