mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-15 04:31:49 +08:00
4e95fbcd79
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.
104 lines
1.6 KiB
C
104 lines
1.6 KiB
C
/*
|
|
* Basic test of versioning. The idea with this is that we define
|
|
* a bunch of definitions of the same symbol, and we can theoretically
|
|
* then link applications against varying sets of these.
|
|
*/
|
|
#include "vers.h"
|
|
|
|
const char * show_bar1 = "asdf";
|
|
const char * show_bar2 = "asdf";
|
|
|
|
extern int new2_foo();
|
|
extern int bar33();
|
|
|
|
int
|
|
bar()
|
|
{
|
|
return 3;
|
|
}
|
|
|
|
/*
|
|
* The 'hide' prefix is something so that we can automatically search the
|
|
* symbol table and verify that none of these symbols were actually exported.
|
|
*/
|
|
int
|
|
hide_original_foo()
|
|
{
|
|
return 1+bar();
|
|
|
|
}
|
|
|
|
int
|
|
hide_old_foo()
|
|
{
|
|
return 10+bar();
|
|
|
|
}
|
|
|
|
int
|
|
hide_old_foo1()
|
|
{
|
|
return 100+bar();
|
|
|
|
}
|
|
|
|
int
|
|
hide_new_foo()
|
|
{
|
|
return 1000+bar();
|
|
|
|
}
|
|
|
|
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);
|
|
|
|
|
|
|
|
#ifdef DO_TEST10
|
|
/* In test 10, we try and define a non-existant version node. The linker
|
|
* should catch this and complain. */
|
|
int
|
|
hide_new_bogus_foo()
|
|
{
|
|
return 1000+bar();
|
|
|
|
}
|
|
FUNC_SYMVER(hide_new_bogus_foo, show_foo@VERS_2.2);
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef DO_TEST11
|
|
/*
|
|
* This test is designed to catch a couple of syntactic errors. The assembler
|
|
* should complain about both of the directives below.
|
|
*/
|
|
void
|
|
xyzzz()
|
|
{
|
|
new2_foo();
|
|
bar33();
|
|
}
|
|
|
|
FUNC_SYMVER(new2_foo, fooVERS_2.0);
|
|
FUNC_SYMVER(bar33, bar@@VERS_2.0);
|
|
#endif
|
|
|
|
#ifdef DO_TEST12
|
|
/*
|
|
* This test is designed to catch a couple of syntactic errors. The assembler
|
|
* should complain about both of the directives below.
|
|
*/
|
|
void
|
|
xyzzz()
|
|
{
|
|
new2_foo();
|
|
bar33();
|
|
}
|
|
|
|
FUNC_SYMVER(bar33, bar@@VERS_2.0);
|
|
#endif
|