Initial revision
[binutils.git] / ld / testsuite / ld-elfvers / vers1.c
blob1d41fd9d04be16dc0f62fd18c260772da002fb2c
1 /*
2 * Basic test of versioning. The idea with this is that we define
3 * a bunch of definitions of the same symbol, and we can theoretically
4 * then link applications against varying sets of these.
5 */
6 const char * show_bar1 = "asdf";
7 const char * show_bar2 = "asdf";
9 int
10 bar()
12 return 3;
16 * The 'hide' prefix is something so that we can automatically search the
17 * symbol table and verify that none of these symbols were actually exported.
19 int
20 hide_original_foo()
22 return 1+bar();
26 int
27 hide_old_foo()
29 return 10+bar();
33 int
34 hide_old_foo1()
36 return 100+bar();
40 int
41 hide_new_foo()
43 return 1000+bar();
47 __asm__(".symver hide_original_foo,show_foo@");
48 __asm__(".symver hide_old_foo,show_foo@VERS_1.1");
49 __asm__(".symver hide_old_foo1,show_foo@VERS_1.2");
50 __asm__(".symver hide_new_foo,show_foo@@VERS_2.0");
54 #ifdef DO_TEST10
55 /* In test 10, we try and define a non-existant version node. The linker
56 * should catch this and complain. */
57 int
58 hide_new_bogus_foo()
60 return 1000+bar();
63 __asm__(".symver hide_new_bogus_foo,show_foo@VERS_2.2");
64 #endif
69 #ifdef DO_TEST11
71 * This test is designed to catch a couple of syntactic errors. The assembler
72 * should complain about both of the directives below.
74 int
75 xyzzz()
77 new2_foo();
78 bar33();
81 __asm__(".symver new2_foo,fooVERS_2.0");
82 __asm__(".symver bar33,bar@@VERS_2.0");
83 #endif
85 #ifdef DO_TEST12
87 * This test is designed to catch a couple of syntactic errors. The assembler
88 * should complain about both of the directives below.
90 int
91 xyzzz()
93 new2_foo();
94 bar33();
97 __asm__(".symver bar33,bar@@VERS_2.0");
98 #endif