From 4e95fbcd79b84308417fc25ce12cacdb2a61c0d0 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Sat, 3 Dec 2016 20:59:43 +1030 Subject: [PATCH] PowerPC64 dot-sym testsuite fixes This illustrates quite well why dot-symbols had to go. PowerPC64 gcc for Linux stopped producing them 12 years ago, but the Linux kernel still persists in using them so it's necessary to keep and regression test ld support. * testsuite/ld-elf/indirect1b.c: Give dot-symbol a version too. * testsuite/ld-elf/indirect2.c: Likewise. * testsuite/ld-elf/indirect3b.c: Likewise. * testsuite/ld-elf/indirect4b.c: Likewise. * testsuite/ld-elf/pr18718.c: Likewise. * testsuite/ld-elf/pr18720b.c: Likewise. * testsuite/ld-elf/pr19553c.c: Likewise. * testsuite/ld-elfvers/vers.h (FUNC_SYMVER): Define. * testsuite/ld-elfvers/vers1.c: Use FUNC_SYMVER for functions. * testsuite/ld-elfvers/vers4.c: Likewise. * testsuite/ld-elfvers/vers5.c: Likewise. * testsuite/ld-elfvers/vers6.c: Likewise. * testsuite/ld-elfvers/vers7a.c: Likewise. * testsuite/ld-elfvers/vers9.c: Likewise. * testsuite/ld-elfvers/vers15.c: Likewise. * testsuite/ld-elfvers/vers18.c: Likewise. * testsuite/ld-elfvers/vers22a.c: Likewise. * testsuite/ld-elfvers/vers23a.c: Likewise. * testsuite/ld-elfvers/vers27d1.c: Likewise. * testsuite/ld-elfvers/vers21.c: Likewise. (_old_bar): Use attribute weak rather than asm weak. * testsuite/ld-ifunc/pr16467b.c: Give dot-symbol a version. * testsuite/ld-plugin/pr12760b.c: Define warning on .bar rather than bar for ppc64 -mcall-aixdesc. * testsuite/ld-plugin/pr16746a.c: Similarly for foobar. * testsuite/ld-plugin/pr16746b.c: Likewise. * testsuite/ld-elf/shared.exp: Allow dot-symbol in warnings and errors. * testsuite/ld-plugin/lto.exp: Likewise. * testsuite/ld-plugin/plugin-6.d: Likewise. * testsuite/ld-plugin/plugin-7.d: Likewise. * testsuite/ld-plugin/plugin-8.d: Likewise. * testsuite/ld-plugin/plugin-13.d: Likewise. * testsuite/ld-plugin/plugin-14.d: Likewise. * testsuite/ld-plugin/plugin-15.d: Likewise. * testsuite/ld-plugin/plugin-16.d: Likewise. * testsuite/ld-plugin/plugin-20.d: Likewise. * testsuite/ld-plugin/plugin-21.d: Likewise. * testsuite/ld-plugin/plugin-22.d: Likewise. * testsuite/ld-plugin/plugin-23.d: Likewise. * testsuite/ld-plugin/plugin.exp: Define .main and .puts for ppc64 -mcall-aixdesc. * testsuite/ld-elfvers/vers.exp (test_ar): Trim dot-symbols. (objdump_dynsymstuff): Likewise. (objdump_symstuff): Likewise. Pack flags to keep column count consistent. * testsuite/ld-elfweak/elfweak.exp (objdump_dynsymstuff, objdump_symstuff): As for vers.exp. * testsuite/ld-elfvers/vers6.sym: Allow dot-symbols. * testsuite/ld-elfvers/vers1.sym: Allow missing F flag for -mcall-aixdesc .opd syms and adjust for flag packing. * testsuite/ld-elfvers/vers4.sym: Likewise. * testsuite/ld-elfvers/vers4a.sym: Likewise. * testsuite/ld-elfvers/vers7a.sym: Likewise. * testsuite/ld-elfvers/vers9.sym: Likewise. * testsuite/ld-elfvers/vers15.sym: Likewise. * testsuite/ld-elfvers/vers18.sym: Likewise. * testsuite/ld-elfvers/vers21.sym: Likewise. * testsuite/ld-elfvers/vers22a.sym: Likewise. * testsuite/ld-elfvers/vers23a.sym: Likewise. * testsuite/ld-elfvers/vers27d.sym: Likewise. * testsuite/ld-elfweak/strong.sym: Likewise. * testsuite/ld-elfweak/strongcomm.sym: Likewise. * testsuite/ld-elfweak/strongdata.sym: Likewise. --- ld/ChangeLog | 66 ++++++++++++++++++++++++++ ld/testsuite/ld-elf/indirect1b.c | 3 ++ ld/testsuite/ld-elf/indirect2.c | 3 ++ ld/testsuite/ld-elf/indirect3b.c | 3 ++ ld/testsuite/ld-elf/indirect4b.c | 6 +++ ld/testsuite/ld-elf/pr18718.c | 3 ++ ld/testsuite/ld-elf/pr18720b.c | 5 ++ ld/testsuite/ld-elf/pr19553c.c | 3 ++ ld/testsuite/ld-elf/shared.exp | 4 +- ld/testsuite/ld-elfvers/vers.exp | 24 +++++----- ld/testsuite/ld-elfvers/vers.h | 7 +++ ld/testsuite/ld-elfvers/vers1.c | 16 +++---- ld/testsuite/ld-elfvers/vers1.sym | 8 ++-- ld/testsuite/ld-elfvers/vers15.c | 6 +-- ld/testsuite/ld-elfvers/vers15.sym | 6 +-- ld/testsuite/ld-elfvers/vers18.c | 8 ++-- ld/testsuite/ld-elfvers/vers18.sym | 8 ++-- ld/testsuite/ld-elfvers/vers21.c | 7 ++- ld/testsuite/ld-elfvers/vers21.sym | 6 +-- ld/testsuite/ld-elfvers/vers22a.c | 2 +- ld/testsuite/ld-elfvers/vers22a.sym | 2 +- ld/testsuite/ld-elfvers/vers23a.c | 2 +- ld/testsuite/ld-elfvers/vers23a.sym | 2 +- ld/testsuite/ld-elfvers/vers27d.sym | 2 +- ld/testsuite/ld-elfvers/vers27d1.c | 2 +- ld/testsuite/ld-elfvers/vers4.c | 2 +- ld/testsuite/ld-elfvers/vers4.sym | 2 +- ld/testsuite/ld-elfvers/vers4a.sym | 2 +- ld/testsuite/ld-elfvers/vers5.c | 8 ++-- ld/testsuite/ld-elfvers/vers6.c | 8 ++-- ld/testsuite/ld-elfvers/vers6.sym | 8 ++-- ld/testsuite/ld-elfvers/vers7a.c | 4 +- ld/testsuite/ld-elfvers/vers7a.sym | 4 +- ld/testsuite/ld-elfvers/vers9.c | 8 ++-- ld/testsuite/ld-elfvers/vers9.sym | 8 ++-- ld/testsuite/ld-elfweak/elfweak.exp | 18 +++---- ld/testsuite/ld-elfweak/strong.sym | 2 +- ld/testsuite/ld-elfweak/strongcomm.sym | 4 +- ld/testsuite/ld-elfweak/strongdata.sym | 4 +- ld/testsuite/ld-ifunc/pr16467b.c | 3 ++ ld/testsuite/ld-plugin/lto.exp | 12 ++--- ld/testsuite/ld-plugin/plugin-13.d | 2 +- ld/testsuite/ld-plugin/plugin-14.d | 2 +- ld/testsuite/ld-plugin/plugin-15.d | 2 +- ld/testsuite/ld-plugin/plugin-16.d | 2 +- ld/testsuite/ld-plugin/plugin-20.d | 2 +- ld/testsuite/ld-plugin/plugin-21.d | 2 +- ld/testsuite/ld-plugin/plugin-22.d | 2 +- ld/testsuite/ld-plugin/plugin-23.d | 2 +- ld/testsuite/ld-plugin/plugin-6.d | 2 +- ld/testsuite/ld-plugin/plugin-7.d | 2 +- ld/testsuite/ld-plugin/plugin-8.d | 2 +- ld/testsuite/ld-plugin/plugin.exp | 7 +++ ld/testsuite/ld-plugin/pr12760b.c | 15 +++--- ld/testsuite/ld-plugin/pr16746a.c | 8 +++- ld/testsuite/ld-plugin/pr16746b.c | 6 +++ 56 files changed, 241 insertions(+), 118 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 86a4fce21b..b1c6b8cd51 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,69 @@ +2016-12-03 Alan Modra + + * testsuite/ld-elf/indirect1b.c: Give dot-symbol a version too. + * testsuite/ld-elf/indirect2.c: Likewise. + * testsuite/ld-elf/indirect3b.c: Likewise. + * testsuite/ld-elf/indirect4b.c: Likewise. + * testsuite/ld-elf/pr18718.c: Likewise. + * testsuite/ld-elf/pr18720b.c: Likewise. + * testsuite/ld-elf/pr19553c.c: Likewise. + * testsuite/ld-elfvers/vers.h (FUNC_SYMVER): Define. + * testsuite/ld-elfvers/vers1.c: Use FUNC_SYMVER for functions. + * testsuite/ld-elfvers/vers4.c: Likewise. + * testsuite/ld-elfvers/vers5.c: Likewise. + * testsuite/ld-elfvers/vers6.c: Likewise. + * testsuite/ld-elfvers/vers7a.c: Likewise. + * testsuite/ld-elfvers/vers9.c: Likewise. + * testsuite/ld-elfvers/vers15.c: Likewise. + * testsuite/ld-elfvers/vers18.c: Likewise. + * testsuite/ld-elfvers/vers22a.c: Likewise. + * testsuite/ld-elfvers/vers23a.c: Likewise. + * testsuite/ld-elfvers/vers27d1.c: Likewise. + * testsuite/ld-elfvers/vers21.c: Likewise. + (_old_bar): Use attribute weak rather than asm weak. + * testsuite/ld-ifunc/pr16467b.c: Give dot-symbol a version. + * testsuite/ld-plugin/pr12760b.c: Define warning on .bar rather than + bar for ppc64 -mcall-aixdesc. + * testsuite/ld-plugin/pr16746a.c: Similarly for foobar. + * testsuite/ld-plugin/pr16746b.c: Likewise. + * testsuite/ld-elf/shared.exp: Allow dot-symbol in warnings and errors. + * testsuite/ld-plugin/lto.exp: Likewise. + * testsuite/ld-plugin/plugin-6.d: Likewise. + * testsuite/ld-plugin/plugin-7.d: Likewise. + * testsuite/ld-plugin/plugin-8.d: Likewise. + * testsuite/ld-plugin/plugin-13.d: Likewise. + * testsuite/ld-plugin/plugin-14.d: Likewise. + * testsuite/ld-plugin/plugin-15.d: Likewise. + * testsuite/ld-plugin/plugin-16.d: Likewise. + * testsuite/ld-plugin/plugin-20.d: Likewise. + * testsuite/ld-plugin/plugin-21.d: Likewise. + * testsuite/ld-plugin/plugin-22.d: Likewise. + * testsuite/ld-plugin/plugin-23.d: Likewise. + * testsuite/ld-plugin/plugin.exp: Define .main and .puts for ppc64 + -mcall-aixdesc. + * testsuite/ld-elfvers/vers.exp (test_ar): Trim dot-symbols. + (objdump_dynsymstuff): Likewise. + (objdump_symstuff): Likewise. Pack flags to keep column count + consistent. + * testsuite/ld-elfweak/elfweak.exp (objdump_dynsymstuff, + objdump_symstuff): As for vers.exp. + * testsuite/ld-elfvers/vers6.sym: Allow dot-symbols. + * testsuite/ld-elfvers/vers1.sym: Allow missing F flag for + -mcall-aixdesc .opd syms and adjust for flag packing. + * testsuite/ld-elfvers/vers4.sym: Likewise. + * testsuite/ld-elfvers/vers4a.sym: Likewise. + * testsuite/ld-elfvers/vers7a.sym: Likewise. + * testsuite/ld-elfvers/vers9.sym: Likewise. + * testsuite/ld-elfvers/vers15.sym: Likewise. + * testsuite/ld-elfvers/vers18.sym: Likewise. + * testsuite/ld-elfvers/vers21.sym: Likewise. + * testsuite/ld-elfvers/vers22a.sym: Likewise. + * testsuite/ld-elfvers/vers23a.sym: Likewise. + * testsuite/ld-elfvers/vers27d.sym: Likewise. + * testsuite/ld-elfweak/strong.sym: Likewise. + * testsuite/ld-elfweak/strongcomm.sym: Likewise. + * testsuite/ld-elfweak/strongdata.sym: Likewise. + 2016-12-03 Alan Modra * testsuite/ld-elfvers/vers.exp (objdump_dynsymstuff): Don't abort diff --git a/ld/testsuite/ld-elf/indirect1b.c b/ld/testsuite/ld-elf/indirect1b.c index 51740f9078..60f34527f4 100644 --- a/ld/testsuite/ld-elf/indirect1b.c +++ b/ld/testsuite/ld-elf/indirect1b.c @@ -4,3 +4,6 @@ foo (void) } asm (".symver foo,foo@FOO"); +#if defined __powerpc64__ && defined _CALL_AIXDESC && !defined _CALL_LINUX +asm (".symver .foo,.foo@FOO"); +#endif diff --git a/ld/testsuite/ld-elf/indirect2.c b/ld/testsuite/ld-elf/indirect2.c index 6df29bed2d..e36532d1e7 100644 --- a/ld/testsuite/ld-elf/indirect2.c +++ b/ld/testsuite/ld-elf/indirect2.c @@ -1,6 +1,9 @@ extern void foo (void); asm (".symver foo,foo@@@FOO"); +#if defined __powerpc64__ && defined _CALL_AIXDESC && !defined _CALL_LINUX +asm (".symver .foo,.foo@@@FOO"); +#endif void bar (void) diff --git a/ld/testsuite/ld-elf/indirect3b.c b/ld/testsuite/ld-elf/indirect3b.c index dbb37c3a80..74cc461f99 100644 --- a/ld/testsuite/ld-elf/indirect3b.c +++ b/ld/testsuite/ld-elf/indirect3b.c @@ -7,3 +7,6 @@ foo (void) } asm (".symver foo,foo@FOO"); +#if defined __powerpc64__ && defined _CALL_AIXDESC && !defined _CALL_LINUX +asm (".symver .foo,.foo@FOO"); +#endif diff --git a/ld/testsuite/ld-elf/indirect4b.c b/ld/testsuite/ld-elf/indirect4b.c index b8db9d0807..06739b55ea 100644 --- a/ld/testsuite/ld-elf/indirect4b.c +++ b/ld/testsuite/ld-elf/indirect4b.c @@ -7,6 +7,9 @@ foo2 (void) } asm (".symver foo2,foo@@FOO2"); +#if defined __powerpc64__ && defined _CALL_AIXDESC && !defined _CALL_LINUX +asm (".symver .foo2,.foo@@FOO2"); +#endif void foo1 (void) @@ -15,3 +18,6 @@ foo1 (void) } asm (".symver foo1,foo@FOO1"); +#if defined __powerpc64__ && defined _CALL_AIXDESC && !defined _CALL_LINUX +asm (".symver .foo1,.foo@FOO1"); +#endif diff --git a/ld/testsuite/ld-elf/pr18718.c b/ld/testsuite/ld-elf/pr18718.c index 5ec1b9ebff..9cf15e8c05 100644 --- a/ld/testsuite/ld-elf/pr18718.c +++ b/ld/testsuite/ld-elf/pr18718.c @@ -10,6 +10,9 @@ new_foo (void) } __asm__(".symver new_foo, foo@@VERS_2.0"); +#if defined __powerpc64__ && defined _CALL_AIXDESC && !defined _CALL_LINUX +__asm__(".symver .new_foo, .foo@@VERS_2.0"); +#endif #if defined(__GNUC__) && (__GNUC__ * 1000 + __GNUC_MINOR__) >= 4005 __attribute__ ((noinline, noclone)) diff --git a/ld/testsuite/ld-elf/pr18720b.c b/ld/testsuite/ld-elf/pr18720b.c index 90d376b68e..6a2975dca7 100644 --- a/ld/testsuite/ld-elf/pr18720b.c +++ b/ld/testsuite/ld-elf/pr18720b.c @@ -9,3 +9,8 @@ foo (void) asm (".symver foo,foo@FOO"); asm (".set foo_alias,foo"); asm (".global foo_alias"); +#if defined __powerpc64__ && defined _CALL_AIXDESC && !defined _CALL_LINUX +asm (".symver .foo,.foo@FOO"); +asm (".set .foo_alias,.foo"); +asm (".global .foo_alias"); +#endif diff --git a/ld/testsuite/ld-elf/pr19553c.c b/ld/testsuite/ld-elf/pr19553c.c index d80dfc9fc3..7587b4afbe 100644 --- a/ld/testsuite/ld-elf/pr19553c.c +++ b/ld/testsuite/ld-elf/pr19553c.c @@ -7,3 +7,6 @@ foo (void) } asm (".symver foo,foo@FOO"); +#if defined __powerpc64__ && defined _CALL_AIXDESC && !defined _CALL_LINUX +asm (".symver .foo,.foo@FOO"); +#endif diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp index f3b6f18a09..f1d741f7be 100644 --- a/ld/testsuite/ld-elf/shared.exp +++ b/ld/testsuite/ld-elf/shared.exp @@ -454,14 +454,14 @@ if { [ regexp "tmpdir/libneeded1b.so: .*: DSO missing" $exec_output ] } { } set testname "--no-add-needed -shared" set exec_output [run_host_cmd "$CC" "-shared tmpdir/libneeded1pic.o -Wl,--no-add-needed,-z,defs -Ltmpdir -lneeded1a"] -if { [ regexp "undefined reference to `bar'" $exec_output ] } { +if { [ regexp "undefined reference to `\.?bar'" $exec_output ] } { pass $testname } { fail $testname } set testname "--no-copy-dt-needed-entries -shared" set exec_output [run_host_cmd "$CC" "-shared tmpdir/libneeded1pic.o -Wl,--no-copy-dt-needed-entries,-z,defs -Ltmpdir -lneeded1a"] -if { [ regexp "undefined reference to `bar'" $exec_output ] } { +if { [ regexp "undefined reference to `\.?bar'" $exec_output ] } { pass $testname } { fail $testname diff --git a/ld/testsuite/ld-elfvers/vers.exp b/ld/testsuite/ld-elfvers/vers.exp index a2a678b924..4c423422a2 100644 --- a/ld/testsuite/ld-elfvers/vers.exp +++ b/ld/testsuite/ld-elfvers/vers.exp @@ -122,9 +122,9 @@ proc test_ar { test lib object expect } { return } - verbose -log "$nm --print-armap $tmpdir/$lib | grep \" in \" | egrep \"VERS\\|bar\\|foo\" | sort > $tmpdir/nm.out" - - catch "exec $nm --print-armap $tmpdir/$lib | grep \\\ in\\\ | egrep VERS\\\|bar\\\|foo | sort > $tmpdir/nm.out" exec_output + set cmd "$nm --print-armap $tmpdir/$lib | grep \\\ in\\\ | egrep VERS\\\|bar\\\|foo | grep -v ^\\\\. | sort > $tmpdir/nm.out" + verbose -log $cmd + catch "exec $cmd" exec_output if [string match "" $exec_output] then { catch "exec sort $srcdir/$subdir/$expect | $diff $tmpdir/nm.out -" exec_output set exec_output [prune_warnings $exec_output] @@ -245,9 +245,9 @@ proc objdump_symstuff { objdump object expectfile } { if ![info exists SOBJDUMP_FLAGS] { set SOBJDUMP_FLAGS "" } - verbose -log "$objdump $SOBJDUMP_FLAGS $object | grep \@ | sort -k 6 > $tmpdir/objdump.out" - - catch "exec $objdump $SOBJDUMP_FLAGS $object | grep \@ | sort -k 6 > $tmpdir/objdump.out" exec_output + set cmd "$objdump $SOBJDUMP_FLAGS $object | sed -n {s/^\\(\[0-9a-f\]* *\\)\\(\[gw\]\\)\\( *\\)\\(\[FO\]\\)/\\1\\2\\4\\3/;/\@/p} | sort -k 5 > $tmpdir/objdump.out" + verbose -log $cmd + catch "exec $cmd" exec_output set exec_output [prune_warnings $exec_output] if [string match "" $exec_output] then { @@ -286,7 +286,8 @@ proc objdump_symstuff { objdump object expectfile } { close $file_a while { [gets $file_b line] != $eof } { - if [regexp "^#.*$" $line] then { + if [regexp {\.text.* \.[^ ]*$} $line] then { + # Discard defined powerpc64 dot-symbols continue } else { lappend list_b $line @@ -340,9 +341,9 @@ proc objdump_dynsymstuff { objdump object expectfile } { if ![info exists DOBJDUMP_FLAGS] { set DOBJDUMP_FLAGS "" } - verbose -log "$objdump $DOBJDUMP_FLAGS $object | sed -n /VERS/p\\\;/show/p | sort | uniq > $tmpdir/objdump.out" - - catch "exec $objdump $DOBJDUMP_FLAGS $object | sed -n /VERS/p\\\;/show/p | sort | uniq > $tmpdir/objdump.out" exec_output + set cmd "$objdump $DOBJDUMP_FLAGS $object | sed -n /VERS/p\\\;/show/p | sort | uniq > $tmpdir/objdump.out" + verbose -log $cmd + catch "exec $cmd" exec_output set exec_output [prune_warnings $exec_output] if [string match "" $exec_output] then { @@ -381,7 +382,8 @@ proc objdump_dynsymstuff { objdump object expectfile } { close $file_a while { [gets $file_b line] != $eof } { - if [regexp "^#.*$" $line] then { + if [regexp {\.text.* \.[^ ]*$} $line] then { + # Discard defined powerpc64 dot-symbols continue } else { lappend list_b $line diff --git a/ld/testsuite/ld-elfvers/vers.h b/ld/testsuite/ld-elfvers/vers.h index 4455527457..00385f096e 100644 --- a/ld/testsuite/ld-elfvers/vers.h +++ b/ld/testsuite/ld-elfvers/vers.h @@ -7,3 +7,10 @@ /* Generate a .symver reference with symbol prefixes. Usage: SYMVER(foo, foobar@ver); */ #define SYMVER(name, name2) __asm__(".symver " SYMPFX(name) "," SYMPFX(name2)) + +#if defined __powerpc64__ && defined _CALL_AIXDESC && !defined _CALL_LINUX +#define FUNC_SYMVER(name, name2) SYMVER(name, name2); \ + __asm__(".symver ." SYMPFX(name) ",." SYMPFX(name2)) +#else +#define FUNC_SYMVER(name, name2) SYMVER(name, name2) +#endif diff --git a/ld/testsuite/ld-elfvers/vers1.c b/ld/testsuite/ld-elfvers/vers1.c index 86e2bd2ba1..9813fd3f4c 100644 --- a/ld/testsuite/ld-elfvers/vers1.c +++ b/ld/testsuite/ld-elfvers/vers1.c @@ -49,10 +49,10 @@ hide_new_foo() } -SYMVER(hide_original_foo, show_foo@); -SYMVER(hide_old_foo, show_foo@VERS_1.1); -SYMVER(hide_old_foo1, show_foo@VERS_1.2); -SYMVER(hide_new_foo, show_foo@@VERS_2.0); +FUNC_SYMVER(hide_original_foo, show_foo@); +FUNC_SYMVER(hide_old_foo, show_foo@VERS_1.1); +FUNC_SYMVER(hide_old_foo1, show_foo@VERS_1.2); +FUNC_SYMVER(hide_new_foo, show_foo@@VERS_2.0); @@ -65,7 +65,7 @@ hide_new_bogus_foo() return 1000+bar(); } -SYMVER(hide_new_bogus_foo, show_foo@VERS_2.2); +FUNC_SYMVER(hide_new_bogus_foo, show_foo@VERS_2.2); #endif @@ -83,8 +83,8 @@ xyzzz() bar33(); } -SYMVER(new2_foo, fooVERS_2.0); -SYMVER(bar33, bar@@VERS_2.0); +FUNC_SYMVER(new2_foo, fooVERS_2.0); +FUNC_SYMVER(bar33, bar@@VERS_2.0); #endif #ifdef DO_TEST12 @@ -99,5 +99,5 @@ xyzzz() bar33(); } -SYMVER(bar33, bar@@VERS_2.0); +FUNC_SYMVER(bar33, bar@@VERS_2.0); #endif diff --git a/ld/testsuite/ld-elfvers/vers1.sym b/ld/testsuite/ld-elfvers/vers1.sym index 0196109c96..206863fd18 100644 --- a/ld/testsuite/ld-elfvers/vers1.sym +++ b/ld/testsuite/ld-elfvers/vers1.sym @@ -1,4 +1,4 @@ -[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@ -[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@@VERS_2\.0 -[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@VERS_1\.1 -[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@VERS_1\.2 +[0-9a-f]+ g(F +\.text|F? +\.opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@ +[0-9a-f]+ g(F +\.text|F? +\.opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@@VERS_2\.0 +[0-9a-f]+ g(F +\.text|F? +\.opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@VERS_1\.1 +[0-9a-f]+ g(F +\.text|F? +\.opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@VERS_1\.2 diff --git a/ld/testsuite/ld-elfvers/vers15.c b/ld/testsuite/ld-elfvers/vers15.c index 2457d29755..a7c044a201 100644 --- a/ld/testsuite/ld-elfvers/vers15.c +++ b/ld/testsuite/ld-elfvers/vers15.c @@ -32,6 +32,6 @@ main() return 0; } -SYMVER(foo_1, show_foo@); -SYMVER(foo_2, show_foo@VERS_1.1); -SYMVER(foo_3, show_foo@@VERS_1.2); +FUNC_SYMVER(foo_1, show_foo@); +FUNC_SYMVER(foo_2, show_foo@VERS_1.1); +FUNC_SYMVER(foo_3, show_foo@@VERS_1.2); diff --git a/ld/testsuite/ld-elfvers/vers15.sym b/ld/testsuite/ld-elfvers/vers15.sym index fe56a2419b..ccf4f4d4b3 100644 --- a/ld/testsuite/ld-elfvers/vers15.sym +++ b/ld/testsuite/ld-elfvers/vers15.sym @@ -1,3 +1,3 @@ -[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@ -[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@@VERS_1\.2 -[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@VERS_1\.1 +[0-9a-f]+ g(F +\.text|F? +\.opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@ +[0-9a-f]+ g(F +\.text|F? +\.opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@@VERS_1\.2 +[0-9a-f]+ g(F +\.text|F? +\.opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@VERS_1\.1 diff --git a/ld/testsuite/ld-elfvers/vers18.c b/ld/testsuite/ld-elfvers/vers18.c index 9965b88a02..fe1017b67e 100644 --- a/ld/testsuite/ld-elfvers/vers18.c +++ b/ld/testsuite/ld-elfvers/vers18.c @@ -38,7 +38,7 @@ hide_new_foo () return 1000 + bar (); } -SYMVER(hide_original_foo, show_foo@); -SYMVER(hide_old_foo, show_foo@VERS_1.1); -SYMVER(hide_old_foo1, show_foo@VERS_1.2); -SYMVER(hide_new_foo, show_foo@@VERS_2.0); +FUNC_SYMVER(hide_original_foo, show_foo@); +FUNC_SYMVER(hide_old_foo, show_foo@VERS_1.1); +FUNC_SYMVER(hide_old_foo1, show_foo@VERS_1.2); +FUNC_SYMVER(hide_new_foo, show_foo@@VERS_2.0); diff --git a/ld/testsuite/ld-elfvers/vers18.sym b/ld/testsuite/ld-elfvers/vers18.sym index 62890d7ad5..04fa49cf3b 100644 --- a/ld/testsuite/ld-elfvers/vers18.sym +++ b/ld/testsuite/ld-elfvers/vers18.sym @@ -1,4 +1,4 @@ -[0-9a-f]+ +w +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@ -[0-9a-f]+ +w +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@@VERS_2\.0 -[0-9a-f]+ +w +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@VERS_1\.1 -[0-9a-f]+ +w +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@VERS_1\.2 +[0-9a-f]+ +w(F +\.text|F? +\.opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@ +[0-9a-f]+ +w(F +\.text|F? +\.opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@@VERS_2\.0 +[0-9a-f]+ +w(F +\.text|F? +\.opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@VERS_1\.1 +[0-9a-f]+ +w(F +\.text|F? +\.opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@VERS_1\.2 diff --git a/ld/testsuite/ld-elfvers/vers21.c b/ld/testsuite/ld-elfvers/vers21.c index 3a75b48add..4a994a19fe 100644 --- a/ld/testsuite/ld-elfvers/vers21.c +++ b/ld/testsuite/ld-elfvers/vers21.c @@ -1,9 +1,8 @@ #include "vers.h" -SYMVER(_old_foo, foo@VERS.0); -SYMVER(_old_bar, bar@VERS.0); +FUNC_SYMVER(_old_foo, foo@VERS.0); +FUNC_SYMVER(_old_bar, bar@VERS.0); SYMVER(_old_foobar, foobar@VERS.0); -__asm__(".weak " SYMPFX(_old_bar)); int bar () @@ -11,7 +10,7 @@ bar () return 1; } -int +int __attribute__ ((weak)) _old_bar () { return bar (); diff --git a/ld/testsuite/ld-elfvers/vers21.sym b/ld/testsuite/ld-elfvers/vers21.sym index 271ca797e8..f5ade0b793 100644 --- a/ld/testsuite/ld-elfvers/vers21.sym +++ b/ld/testsuite/ld-elfvers/vers21.sym @@ -1,3 +1,3 @@ -[0-9a-f]+[ ]+w[ ]+F[ ]+\.(text|opd)[ ]+[0-9a-f]+ (0x[0-9a-f]+ )?_?bar@VERS\.0 -[0-9a-f]+[ ]+g[ ]+F[ ]+\.(text|opd)[ ]+[0-9a-f]+ (0x[0-9a-f]+ )?_?foo@VERS\.0 -[0-9a-f]+[ ]+g[ ]+O[ ]+\.s?data[ ]+[0-9a-f]+ (0x[0-9a-f]+ )?_?foobar@VERS\.0 +[0-9a-f]+ +w(F +\.text|F? +\.opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?bar@VERS\.0 +[0-9a-f]+ +g(F +\.text|F? +\.opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?foo@VERS\.0 +[0-9a-f]+ +gO +\.s?data [0-9a-f]+ (0x[0-9a-f]+ )?_?foobar@VERS\.0 diff --git a/ld/testsuite/ld-elfvers/vers22a.c b/ld/testsuite/ld-elfvers/vers22a.c index bc5777bb83..9a5fcac816 100644 --- a/ld/testsuite/ld-elfvers/vers22a.c +++ b/ld/testsuite/ld-elfvers/vers22a.c @@ -1,6 +1,6 @@ #include "vers.h" -SYMVER(_old_bar, bar@VERS.0); +FUNC_SYMVER(_old_bar, bar@VERS.0); void _old_bar () diff --git a/ld/testsuite/ld-elfvers/vers22a.sym b/ld/testsuite/ld-elfvers/vers22a.sym index c3f4150cca..cddf0c6cd9 100644 --- a/ld/testsuite/ld-elfvers/vers22a.sym +++ b/ld/testsuite/ld-elfvers/vers22a.sym @@ -1 +1 @@ -[0-9a-f]+[ ]+g[ ]+F[ ]+\.(text|opd)[ ]+[0-9a-f]+ (0x[0-9a-f]+ )?_?bar@VERS.0 +[0-9a-f]+ +g(F +\.text|F? +\.opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?bar@VERS.0 diff --git a/ld/testsuite/ld-elfvers/vers23a.c b/ld/testsuite/ld-elfvers/vers23a.c index 13c8edd6e3..9edbba353b 100644 --- a/ld/testsuite/ld-elfvers/vers23a.c +++ b/ld/testsuite/ld-elfvers/vers23a.c @@ -1,6 +1,6 @@ #include "vers.h" -SYMVER(_old_bar, bar@VERS.0); +FUNC_SYMVER(_old_bar, bar@VERS.0); void _old_bar (void) diff --git a/ld/testsuite/ld-elfvers/vers23a.sym b/ld/testsuite/ld-elfvers/vers23a.sym index c3f4150cca..cddf0c6cd9 100644 --- a/ld/testsuite/ld-elfvers/vers23a.sym +++ b/ld/testsuite/ld-elfvers/vers23a.sym @@ -1 +1 @@ -[0-9a-f]+[ ]+g[ ]+F[ ]+\.(text|opd)[ ]+[0-9a-f]+ (0x[0-9a-f]+ )?_?bar@VERS.0 +[0-9a-f]+ +g(F +\.text|F? +\.opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?bar@VERS.0 diff --git a/ld/testsuite/ld-elfvers/vers27d.sym b/ld/testsuite/ld-elfvers/vers27d.sym index d20bd1d234..9133ed0ab2 100644 --- a/ld/testsuite/ld-elfvers/vers27d.sym +++ b/ld/testsuite/ld-elfvers/vers27d.sym @@ -1 +1 @@ -[0-9a-f]+[ ]+g[ ]+F[ ]+\.(text|opd)[ ]+[0-9a-f]+ (0x[0-9a-f]+ )?_?foo@VERS\.0 +[0-9a-f]+ +g(F +\.text|F? +\.opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?foo@VERS\.0 diff --git a/ld/testsuite/ld-elfvers/vers27d1.c b/ld/testsuite/ld-elfvers/vers27d1.c index 107e1c1de8..00fab8d465 100644 --- a/ld/testsuite/ld-elfvers/vers27d1.c +++ b/ld/testsuite/ld-elfvers/vers27d1.c @@ -5,4 +5,4 @@ foo () { } -SYMVER(foo, foo@VERS.0); +FUNC_SYMVER(foo, foo@VERS.0); diff --git a/ld/testsuite/ld-elfvers/vers4.c b/ld/testsuite/ld-elfvers/vers4.c index 46ac43258d..eed059589a 100644 --- a/ld/testsuite/ld-elfvers/vers4.c +++ b/ld/testsuite/ld-elfvers/vers4.c @@ -22,7 +22,7 @@ new_foo() } -SYMVER(new_foo, foo@@VERS_2.0); +FUNC_SYMVER(new_foo, foo@@VERS_2.0); int main() diff --git a/ld/testsuite/ld-elfvers/vers4.sym b/ld/testsuite/ld-elfvers/vers4.sym index c48d1bb09f..6511fc3639 100644 --- a/ld/testsuite/ld-elfvers/vers4.sym +++ b/ld/testsuite/ld-elfvers/vers4.sym @@ -1 +1 @@ -[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?foo@@VERS_2\.0 +[0-9a-f]+ g(F +\.text|F? +\.opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?foo@@VERS_2\.0 diff --git a/ld/testsuite/ld-elfvers/vers4a.sym b/ld/testsuite/ld-elfvers/vers4a.sym index c48d1bb09f..6511fc3639 100644 --- a/ld/testsuite/ld-elfvers/vers4a.sym +++ b/ld/testsuite/ld-elfvers/vers4a.sym @@ -1 +1 @@ -[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?foo@@VERS_2\.0 +[0-9a-f]+ g(F +\.text|F? +\.opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?foo@@VERS_2\.0 diff --git a/ld/testsuite/ld-elfvers/vers5.c b/ld/testsuite/ld-elfvers/vers5.c index 3cae67ebc9..8b1b5360c8 100644 --- a/ld/testsuite/ld-elfvers/vers5.c +++ b/ld/testsuite/ld-elfvers/vers5.c @@ -41,10 +41,10 @@ new_foo() } -SYMVER(original_foo, foo@); -SYMVER(old_foo, foo@VERS_1.1); -SYMVER(old_foo1, foo@VERS_1.2); -SYMVER(new_foo, foo@@VERS_1.2); +FUNC_SYMVER(original_foo, foo@); +FUNC_SYMVER(old_foo, foo@VERS_1.1); +FUNC_SYMVER(old_foo1, foo@VERS_1.2); +FUNC_SYMVER(new_foo, foo@@VERS_1.2); int main () diff --git a/ld/testsuite/ld-elfvers/vers6.c b/ld/testsuite/ld-elfvers/vers6.c index cb1c93f635..5b72626946 100644 --- a/ld/testsuite/ld-elfvers/vers6.c +++ b/ld/testsuite/ld-elfvers/vers6.c @@ -20,7 +20,7 @@ main() return 0; } -SYMVER(foo_1, show_foo@); -SYMVER(foo_2, show_foo@VERS_1.1); -SYMVER(foo_3, show_foo@VERS_1.2); -SYMVER(foo_4, show_foo@VERS_2.0); +FUNC_SYMVER(foo_1, show_foo@); +FUNC_SYMVER(foo_2, show_foo@VERS_1.1); +FUNC_SYMVER(foo_3, show_foo@VERS_1.2); +FUNC_SYMVER(foo_4, show_foo@VERS_2.0); diff --git a/ld/testsuite/ld-elfvers/vers6.sym b/ld/testsuite/ld-elfvers/vers6.sym index ae68d724e2..10a3966e4f 100644 --- a/ld/testsuite/ld-elfvers/vers6.sym +++ b/ld/testsuite/ld-elfvers/vers6.sym @@ -1,4 +1,4 @@ -0+ *F? *\*UND\* 0+ _?show_foo@ -0+ *F? *\*UND\* 0+ _?show_foo@VERS_1\.1 -0+ *F? *\*UND\* 0+ _?show_foo@VERS_1\.2 -0+ *F? *\*UND\* 0+ _?show_foo@VERS_2\.0 +0+ *F? *\*UND\* 0+ \.?_?show_foo@ +0+ *F? *\*UND\* 0+ \.?_?show_foo@VERS_1\.1 +0+ *F? *\*UND\* 0+ \.?_?show_foo@VERS_1\.2 +0+ *F? *\*UND\* 0+ \.?_?show_foo@VERS_2\.0 diff --git a/ld/testsuite/ld-elfvers/vers7a.c b/ld/testsuite/ld-elfvers/vers7a.c index f3d2a2d989..8fcad79f67 100644 --- a/ld/testsuite/ld-elfvers/vers7a.c +++ b/ld/testsuite/ld-elfvers/vers7a.c @@ -16,5 +16,5 @@ __b_internal (int e) return e + 42; } -SYMVER(__a_internal, hide_a@@VERS_1); -SYMVER(__b_internal, show_b@@VERS_1); +FUNC_SYMVER(__a_internal, hide_a@@VERS_1); +FUNC_SYMVER(__b_internal, show_b@@VERS_1); diff --git a/ld/testsuite/ld-elfvers/vers7a.sym b/ld/testsuite/ld-elfvers/vers7a.sym index ef8d04be0b..8b37561471 100644 --- a/ld/testsuite/ld-elfvers/vers7a.sym +++ b/ld/testsuite/ld-elfvers/vers7a.sym @@ -1,2 +1,2 @@ -[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?hide_a@@VERS_1 -[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_b@@VERS_1 +[0-9a-f]+ g(F +\.text|F? +\.opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?hide_a@@VERS_1 +[0-9a-f]+ g(F +\.text|F? +\.opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_b@@VERS_1 diff --git a/ld/testsuite/ld-elfvers/vers9.c b/ld/testsuite/ld-elfvers/vers9.c index 5079364091..f70b0af9ff 100644 --- a/ld/testsuite/ld-elfvers/vers9.c +++ b/ld/testsuite/ld-elfvers/vers9.c @@ -43,7 +43,7 @@ main() return 0; } -SYMVER(original_foo, foo@); -SYMVER(old_foo, foo@VERS_1.1); -SYMVER(old_foo1, foo@VERS_1.2); -SYMVER(new_foo, foo@@VERS_1.2); +FUNC_SYMVER(original_foo, foo@); +FUNC_SYMVER(old_foo, foo@VERS_1.1); +FUNC_SYMVER(old_foo1, foo@VERS_1.2); +FUNC_SYMVER(new_foo, foo@@VERS_1.2); diff --git a/ld/testsuite/ld-elfvers/vers9.sym b/ld/testsuite/ld-elfvers/vers9.sym index 2d46c47c61..28afa0d8b9 100644 --- a/ld/testsuite/ld-elfvers/vers9.sym +++ b/ld/testsuite/ld-elfvers/vers9.sym @@ -1,4 +1,4 @@ -0+ *F? *\*UND\* 0+ _?foo@VERS_1\.2 -[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?foo@ -[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?foo@@VERS_1\.2 -[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?foo@VERS_1\.1 +0+ *F? *\*UND\* 0+ \.?_?foo@VERS_1\.2 +[0-9a-f]+ g(F +\.text|F? +\.opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?foo@ +[0-9a-f]+ g(F +\.text|F? +\.opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?foo@@VERS_1\.2 +[0-9a-f]+ g(F +\.text|F? +\.opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?foo@VERS_1\.1 diff --git a/ld/testsuite/ld-elfweak/elfweak.exp b/ld/testsuite/ld-elfweak/elfweak.exp index 31801eb60a..d3037e1329 100644 --- a/ld/testsuite/ld-elfweak/elfweak.exp +++ b/ld/testsuite/ld-elfweak/elfweak.exp @@ -82,9 +82,9 @@ proc objdump_symstuff { objdump object expectfile } { if ![info exists SOBJDUMP_FLAGS] { set SOBJDUMP_FLAGS "" } - verbose -log "$objdump $SOBJDUMP_FLAGS $object | grep foo$ > $tmpdir/objdump.out" - - catch "exec $objdump $SOBJDUMP_FLAGS $object | grep foo$ > $tmpdir/objdump.out" exec_output + set cmd "$objdump $SOBJDUMP_FLAGS $object | sed -n {s/^\\(\[0-9a-f\]* *\\)\\(\[gw\]\\)\\( *\\)\\(\[FO\]\\)/\\1\\2\\4\\3/;/foo$/p} > $tmpdir/objdump.out" + verbose -log $cmd + catch "exec $cmd" exec_output set exec_output [prune_warnings $exec_output] if [string match "" $exec_output] then { @@ -123,7 +123,8 @@ proc objdump_symstuff { objdump object expectfile } { close $file_a while { [gets $file_b line] != $eof } { - if [regexp "^#.*$" $line] then { + if [regexp {\.text.* \.[^ ]*$} $line] then { + # Discard defined powerpc64 dot-symbols continue } else { lappend list_b $line @@ -177,9 +178,9 @@ proc objdump_dynsymstuff { objdump object expectfile } { if ![info exists DOBJDUMP_FLAGS] { set DOBJDUMP_FLAGS "" } - verbose -log "$objdump $DOBJDUMP_FLAGS $object | grep foo$ > $tmpdir/objdump.out" - - catch "exec $objdump $DOBJDUMP_FLAGS $object | grep foo$ > $tmpdir/objdump.out" exec_output + set cmd "$objdump $DOBJDUMP_FLAGS $object | grep foo$ > $tmpdir/objdump.out" + verbose -log $cmd + catch "exec $cmd" exec_output set exec_output [prune_warnings $exec_output] if [string match "" $exec_output] then { @@ -218,7 +219,8 @@ proc objdump_dynsymstuff { objdump object expectfile } { close $file_a while { [gets $file_b line] != $eof } { - if [regexp "^#.*$" $line] then { + if [regexp {\.text.* \.[^ ]*$} $line] then { + # Discard defined powerpc64 dot-symbols continue } else { lappend list_b $line diff --git a/ld/testsuite/ld-elfweak/strong.sym b/ld/testsuite/ld-elfweak/strong.sym index 531d35876f..27d0daa308 100644 --- a/ld/testsuite/ld-elfweak/strong.sym +++ b/ld/testsuite/ld-elfweak/strong.sym @@ -1 +1 @@ -[0-9a-f]+[ ]+g[ ]+F[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+(0x[0-9a-f]+ )?foo +[0-9a-f]+ g(F +\.text|F? +\.opd) [0-9a-f]+ +(0x[0-9a-f]+ )?foo diff --git a/ld/testsuite/ld-elfweak/strongcomm.sym b/ld/testsuite/ld-elfweak/strongcomm.sym index 2a8c6cd287..c5fe85c95b 100644 --- a/ld/testsuite/ld-elfweak/strongcomm.sym +++ b/ld/testsuite/ld-elfweak/strongcomm.sym @@ -1,2 +1,2 @@ -[0-9a-f]+[ ]+g[ ]+O[ ]+\.s?bss[ ]+[0-9a-f]+[ ]+deallocate_foo -[0-9a-f]+[ ]+g[ ]+F[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+(0x[0-9a-f]+ )?foo +[0-9a-f]+ gO +\.s?bss [0-9a-f]+ +deallocate_foo +[0-9a-f]+ g(F +\.text|F? +\.opd) [0-9a-f]+ +(0x[0-9a-f]+ )?foo diff --git a/ld/testsuite/ld-elfweak/strongdata.sym b/ld/testsuite/ld-elfweak/strongdata.sym index 88aa1c9def..d09722ad57 100644 --- a/ld/testsuite/ld-elfweak/strongdata.sym +++ b/ld/testsuite/ld-elfweak/strongdata.sym @@ -1,2 +1,2 @@ -[0-9a-f]+[ ]+g[ ]+O[ ]+\.s?(data|bss)[ ]+[0-9a-f]+[ ]+deallocate_foo -[0-9a-f]+[ ]+g[ ]+F[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+(0x[0-9a-f]+ )?foo +[0-9a-f]+ gO +\.s?(data|bss) [0-9a-f]+ +deallocate_foo +[0-9a-f]+ g(F +\.text|F? +\.opd) [0-9a-f]+ +(0x[0-9a-f]+ )?foo diff --git a/ld/testsuite/ld-ifunc/pr16467b.c b/ld/testsuite/ld-ifunc/pr16467b.c index 264f6cff85..20a73e25a4 100644 --- a/ld/testsuite/ld-ifunc/pr16467b.c +++ b/ld/testsuite/ld-ifunc/pr16467b.c @@ -1,5 +1,8 @@ void new_sd_get_seats(void); __asm__(".symver new_sd_get_seats,sd_get_seats@LIBSYSTEMD_209"); +#if defined __powerpc64__ && defined _CALL_AIXDESC && !defined _CALL_LINUX +__asm__(".symver .new_sd_get_seats,.sd_get_seats@LIBSYSTEMD_209"); +#endif void (*resolve_sd_get_seats(void)) (void) __asm__ ("sd_get_seats"); void (*resolve_sd_get_seats(void)) (void) { return new_sd_get_seats; diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp index 29f211712e..4c853fdedd 100644 --- a/ld/testsuite/ld-plugin/lto.exp +++ b/ld/testsuite/ld-plugin/lto.exp @@ -149,7 +149,7 @@ set lto_link_tests [list \ {pr12760b.c} {} "libpr12760.a"] \ [list "PR ld/12760" \ "-O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin tmpdir/pr12760a.o -Wl,--start-group tmpdir/libpr12760.a -Wl,--end-group" "" \ - {dummy.c} {} "pr12760.exe" "c" "pr12760a.c:6: warning: Bad bar"] \ + {dummy.c} {} "pr12760.exe" "c" "pr12760a.c:6: warning: Bad \\.?bar"] \ [list "Build libpr13183.a" \ "-T" "-flto -O2 $lto_fat" \ {pr13183a.c} {} "libpr13183.a"] \ @@ -392,21 +392,21 @@ if { [is_elf_format] && [check_lto_shared_available] } { run_cc_link_tests $lto_link_elf_tests set testname "PR ld/15146 (2)" set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin -Wl,-rpath-link,. -Wl,--no-copy-dt-needed-entries -Wl,--no-as-needed tmpdir/pr15146d.o tmpdir/pr15146c.so"] - if { [ regexp "undefined reference to symbol 'xxx'" $exec_output ] } { + if { [ regexp "undefined reference to symbol '\\.?xxx'" $exec_output ] } { pass $testname } { fail $testname } set testname "PR ld/16746 (3)" set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin tmpdir/pr16746b.o tmpdir/pr16746d.o"] - if { [ regexp "warning: foobar" $exec_output ] && ![ regexp "symbol from plugin" $exec_output ] } { + if { [ regexp "warning: \\.?foobar" $exec_output ] && ![ regexp "symbol from plugin" $exec_output ] } { pass $testname } { fail $testname } set testname "PR ld/16746 (4)" set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin tmpdir/pr16746d.o tmpdir/pr16746b.o"] - if { [ regexp "warning: foobar" $exec_output ] && ![ regexp "symbol from plugin" $exec_output ] } { + if { [ regexp "warning: \\.?foobar" $exec_output ] && ![ regexp "symbol from plugin" $exec_output ] } { pass $testname } { fail $testname @@ -455,7 +455,7 @@ if { [at_least_gcc_version 4 7] } { } set testname "PR ld/12942 (3)" set exec_output [run_host_cmd "$CXX" "-O2 -flto -fuse-linker-plugin tmpdir/pr12942b.o tmpdir/pr12942a.o"] - if { [ regexp "undefined reference to `link_error\\(\\)'" $exec_output ] } { + if { [ regexp "undefined reference to `\\.?link_error\\(\\)'" $exec_output ] } { pass $testname } { fail $testname @@ -492,7 +492,7 @@ proc pr20103 {cflags libs} { set testname "PR ld/20103 ($cflags $libs)" set exec_output [run_host_cmd "$CC" "$cflags $libs"] - if { [ regexp "undefined reference to `dead'" $exec_output ] } { + if { [ regexp "undefined reference to `\\.?dead'" $exec_output ] } { pass "$testname (1)" } { fail "$testname (1)" diff --git a/ld/testsuite/ld-plugin/plugin-13.d b/ld/testsuite/ld-plugin/plugin-13.d index ebfdc116eb..55dea651ec 100644 --- a/ld/testsuite/ld-plugin/plugin-13.d +++ b/ld/testsuite/ld-plugin/plugin-13.d @@ -23,5 +23,5 @@ hook called: claim_file tmpdir/main.o \[@0/.* not claimed hook called: claim_file .*/ld/testsuite/ld-plugin/func.c \[@0/.* CLAIMED hook called: claim_file tmpdir/text.o \[@0/.* not claimed #... -.*main.c.*: undefined reference to `func' +.*main.c.*: undefined reference to `\.?func' #... diff --git a/ld/testsuite/ld-plugin/plugin-14.d b/ld/testsuite/ld-plugin/plugin-14.d index 96e1703081..c9dc5f231f 100644 --- a/ld/testsuite/ld-plugin/plugin-14.d +++ b/ld/testsuite/ld-plugin/plugin-14.d @@ -28,6 +28,6 @@ hook called: claim_file tmpdir/text.o \[@0/.* not claimed #... hook called: all symbols read. tmpdir/main.o: In function `main': -.*main.c.*: undefined reference to `func' +.*main.c.*: undefined reference to `\.?func' hook called: cleanup. #... diff --git a/ld/testsuite/ld-plugin/plugin-15.d b/ld/testsuite/ld-plugin/plugin-15.d index ec7e52c2a9..0481c5fb05 100644 --- a/ld/testsuite/ld-plugin/plugin-15.d +++ b/ld/testsuite/ld-plugin/plugin-15.d @@ -29,6 +29,6 @@ hook called: claim_file tmpdir/text.o \[@0/.* not claimed #... hook called: all symbols read. tmpdir/main.o: In function `main': -.*main.c.*: undefined reference to `func' +.*main.c.*: undefined reference to `\.?func' hook called: cleanup. #... diff --git a/ld/testsuite/ld-plugin/plugin-16.d b/ld/testsuite/ld-plugin/plugin-16.d index 479785e96d..ae54f0c24a 100644 --- a/ld/testsuite/ld-plugin/plugin-16.d +++ b/ld/testsuite/ld-plugin/plugin-16.d @@ -33,6 +33,6 @@ hook called: all symbols read. Sym: '_?func' Resolution: LDPR_PREVAILING_DEF Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY tmpdir/main.o: In function `main': -.*main.c.*: undefined reference to `func' +.*main.c.*: undefined reference to `\.?func' hook called: cleanup. #... diff --git a/ld/testsuite/ld-plugin/plugin-20.d b/ld/testsuite/ld-plugin/plugin-20.d index dbee504f91..373a3ff2a3 100644 --- a/ld/testsuite/ld-plugin/plugin-20.d +++ b/ld/testsuite/ld-plugin/plugin-20.d @@ -3,5 +3,5 @@ Input: func.c \(tmpdir/libfunc.a\) Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* tmpdir/main.o: In function `main': -.*main.c.*: undefined reference to `func' +.*main.c.*: undefined reference to `\.?func' hook called: cleanup. diff --git a/ld/testsuite/ld-plugin/plugin-21.d b/ld/testsuite/ld-plugin/plugin-21.d index ebfa6c5175..7b922c11e1 100644 --- a/ld/testsuite/ld-plugin/plugin-21.d +++ b/ld/testsuite/ld-plugin/plugin-21.d @@ -3,5 +3,5 @@ Input: .*/ld/testsuite/ld-plugin/func.c \(.*/ld/testsuite/ld-plugin/func.c\) Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* tmpdir/main.o: In function `main': -.*main.c.*: undefined reference to `func' +.*main.c.*: undefined reference to `\.?func' hook called: cleanup. diff --git a/ld/testsuite/ld-plugin/plugin-22.d b/ld/testsuite/ld-plugin/plugin-22.d index 07a47acbe2..151267624f 100644 --- a/ld/testsuite/ld-plugin/plugin-22.d +++ b/ld/testsuite/ld-plugin/plugin-22.d @@ -3,5 +3,5 @@ hook called: all symbols read. Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* tmpdir/main.o: In function `main': -.*main.c.*: undefined reference to `func' +.*main.c.*: undefined reference to `\.?func' hook called: cleanup. diff --git a/ld/testsuite/ld-plugin/plugin-23.d b/ld/testsuite/ld-plugin/plugin-23.d index 45e405247f..e05f7bdfcf 100644 --- a/ld/testsuite/ld-plugin/plugin-23.d +++ b/ld/testsuite/ld-plugin/plugin-23.d @@ -3,5 +3,5 @@ hook called: all symbols read. Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.* tmpdir/main.o: In function `main': -.*main.c.*: undefined reference to `func' +.*main.c.*: undefined reference to `\.?func' hook called: cleanup. diff --git a/ld/testsuite/ld-plugin/plugin-6.d b/ld/testsuite/ld-plugin/plugin-6.d index 07e54c6c21..b4a1e9cee8 100644 --- a/ld/testsuite/ld-plugin/plugin-6.d +++ b/ld/testsuite/ld-plugin/plugin-6.d @@ -28,6 +28,6 @@ hook called: claim_file tmpdir/text.o \[@0/.* not claimed #... hook called: all symbols read. tmpdir/main.o: In function `main': -.*main.c.*: undefined reference to `func' +.*main.c.*: undefined reference to `\.?func' hook called: cleanup. #... diff --git a/ld/testsuite/ld-plugin/plugin-7.d b/ld/testsuite/ld-plugin/plugin-7.d index d1c159c4f3..54259db7dc 100644 --- a/ld/testsuite/ld-plugin/plugin-7.d +++ b/ld/testsuite/ld-plugin/plugin-7.d @@ -29,6 +29,6 @@ hook called: claim_file tmpdir/text.o \[@0/.* not claimed #... hook called: all symbols read. tmpdir/main.o: In function `main': -.*main.c.*: undefined reference to `func' +.*main.c.*: undefined reference to `\.?func' hook called: cleanup. #... diff --git a/ld/testsuite/ld-plugin/plugin-8.d b/ld/testsuite/ld-plugin/plugin-8.d index 2c7a15b241..c1dd25ad66 100644 --- a/ld/testsuite/ld-plugin/plugin-8.d +++ b/ld/testsuite/ld-plugin/plugin-8.d @@ -33,6 +33,6 @@ hook called: all symbols read. Sym: '_?func' Resolution: LDPR_PREVAILING_DEF Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY tmpdir/main.o: In function `main': -.*main.c.*: undefined reference to `func' +.*main.c.*: undefined reference to `\.?func' hook called: cleanup. #... diff --git a/ld/testsuite/ld-plugin/plugin.exp b/ld/testsuite/ld-plugin/plugin.exp index a6946c47c2..9990e82d3e 100644 --- a/ld/testsuite/ld-plugin/plugin.exp +++ b/ld/testsuite/ld-plugin/plugin.exp @@ -106,12 +106,16 @@ if { $can_compile && \ set failed_compile 1 } +set dotsym 0 if { $can_compile && !$failed_compile } { # Find out if symbols have prefix on this platform before setting tests. catch "exec $NM tmpdir/func.o" plugin_nm_output if { [regexp "_func" "$plugin_nm_output"] } { set _ "_" } + if { [regexp "\\.func" "$plugin_nm_output"] } { + set dotsym 1 + } } set testobjfiles "tmpdir/main.o tmpdir/func.o tmpdir/text.o" @@ -121,6 +125,9 @@ set testsrcfiles_notext "tmpdir/main.o $srcdir/$subdir/func.c" # Rather than having libs we just define dummy values for anything # we may need to link a target exe; we aren't going to run it anyway. set libs "[ld_simple_link_defsyms] --defsym ${_}printf=${_}main --defsym ${_}puts=${_}main" +if { $dotsym } { + append libs " --defsym .printf=.main --defsym .puts=.main" +} set plugin_tests [list \ [list "load plugin" "-plugin $plugin_path \ diff --git a/ld/testsuite/ld-plugin/pr12760b.c b/ld/testsuite/ld-plugin/pr12760b.c index 29a9fd89ef..56bc3cf892 100644 --- a/ld/testsuite/ld-plugin/pr12760b.c +++ b/ld/testsuite/ld-plugin/pr12760b.c @@ -1,7 +1,8 @@ -#define linker_warning(x, msg) \ - static const char __warn_##x[] \ - __attribute__((used, section(".gnu.warning." #x))) \ - = msg - -void bar (void) {} -linker_warning(bar, "Bad bar"); +void bar (void) {} +#if defined __powerpc64__ && defined _CALL_AIXDESC && !defined _CALL_LINUX +static const char __warn_bar[] +__attribute__ ((used, section (".gnu.warning..bar"))) = "Bad bar"; +#else +static const char __warn_bar[] +__attribute__ ((used, section (".gnu.warning.bar"))) = "Bad bar"; +#endif diff --git a/ld/testsuite/ld-plugin/pr16746a.c b/ld/testsuite/ld-plugin/pr16746a.c index 1705ef1a98..425cffa34f 100644 --- a/ld/testsuite/ld-plugin/pr16746a.c +++ b/ld/testsuite/ld-plugin/pr16746a.c @@ -1,3 +1,7 @@ +#if defined __powerpc64__ && defined _CALL_AIXDESC && !defined _CALL_LINUX static const char __evoke_link_warning_foobar[] - __attribute__ ((used, section (".gnu.warning.foobar\n\t#"))) - = "foobar"; +__attribute__ ((used, section (".gnu.warning..foobar\n\t#"))) = "foobar"; +#else +static const char __evoke_link_warning_foobar[] +__attribute__ ((used, section (".gnu.warning.foobar\n\t#"))) = "foobar"; +#endif diff --git a/ld/testsuite/ld-plugin/pr16746b.c b/ld/testsuite/ld-plugin/pr16746b.c index c3b7a78d33..5db5d1d4eb 100644 --- a/ld/testsuite/ld-plugin/pr16746b.c +++ b/ld/testsuite/ld-plugin/pr16746b.c @@ -1,5 +1,11 @@ +#if defined __powerpc64__ && defined _CALL_AIXDESC && !defined _CALL_LINUX +static const char __evoke_link_warning_foobar[] + __attribute__ ((used, section (".gnu.warning..foobar\n\t#"))) + = "foobar"; +#else static const char __evoke_link_warning_foobar[] __attribute__ ((used, section (".gnu.warning.foobar\n\t#"))) = "foobar"; +#endif void foobar (void) {} -- 2.34.1