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.
This commit is contained in:
Alan Modra 2016-12-03 20:59:43 +10:30
parent ca16c5b392
commit 4e95fbcd79
56 changed files with 241 additions and 118 deletions

View File

@ -1,3 +1,69 @@
2016-12-03 Alan Modra <amodra@gmail.com>
* 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 <amodra@gmail.com>
* testsuite/ld-elfvers/vers.exp (objdump_dynsymstuff): Don't abort

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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))

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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 ();

View File

@ -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

View File

@ -1,6 +1,6 @@
#include "vers.h"
SYMVER(_old_bar, bar@VERS.0);
FUNC_SYMVER(_old_bar, bar@VERS.0);
void
_old_bar ()

View File

@ -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

View File

@ -1,6 +1,6 @@
#include "vers.h"
SYMVER(_old_bar, bar@VERS.0);
FUNC_SYMVER(_old_bar, bar@VERS.0);
void
_old_bar (void)

View File

@ -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

View File

@ -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

View File

@ -5,4 +5,4 @@ foo ()
{
}
SYMVER(foo, foo@VERS.0);
FUNC_SYMVER(foo, foo@VERS.0);

View File

@ -22,7 +22,7 @@ new_foo()
}
SYMVER(new_foo, foo@@VERS_2.0);
FUNC_SYMVER(new_foo, foo@@VERS_2.0);
int
main()

View File

@ -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

View File

@ -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

View File

@ -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 ()

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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)"

View File

@ -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'
#...

View File

@ -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.
#...

View File

@ -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.
#...

View File

@ -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.
#...

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.
#...

View File

@ -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.
#...

View File

@ -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.
#...

View File

@ -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 \

View File

@ -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

View File

@ -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

View File

@ -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) {}