This commit was generated by cvs2svn to track changes on a CVS vendor
[external/binutils.git] / ld / testsuite / ld-elfvers / vers1.c
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";
8
9 int bar()
10 {
11         return 3;
12 }
13
14 /*
15  * The 'hide' prefix is something so that we can automatically search the
16  * symbol table and verify that none of these symbols were actually exported.
17  */
18 hide_original_foo()
19 {
20         return 1+bar();
21
22 }
23
24 hide_old_foo()
25 {
26         return 10+bar();
27
28 }
29
30 hide_old_foo1()
31 {
32         return 100+bar();
33
34 }
35
36 hide_new_foo()
37 {
38         return 1000+bar();
39
40 }
41
42 __asm__(".symver hide_original_foo,show_foo@");
43 __asm__(".symver hide_old_foo,show_foo@VERS_1.1");
44 __asm__(".symver hide_old_foo1,show_foo@VERS_1.2");
45 __asm__(".symver hide_new_foo,show_foo@@VERS_2.0");
46
47
48
49 #ifdef DO_TEST10
50 /* In test 10, we try and define a non-existant version node.  The linker
51  * should catch this and complain. */
52 hide_new_bogus_foo()
53 {
54         return 1000+bar();
55
56 }
57 __asm__(".symver hide_new_bogus_foo,show_foo@VERS_2.2");
58 #endif
59
60
61
62
63 #ifdef DO_TEST11
64 /*
65  * This test is designed to catch a couple of syntactic errors.  The assembler
66  * should complain about both of the directives below.
67  */
68 xyzzz()
69 {
70   new2_foo();
71   bar33();
72 }
73
74 __asm__(".symver new2_foo,fooVERS_2.0");
75 __asm__(".symver bar33,bar@@VERS_2.0");
76 #endif
77
78 #ifdef DO_TEST12
79 /*
80  * This test is designed to catch a couple of syntactic errors.  The assembler
81  * should complain about both of the directives below.
82  */
83 xyzzz()
84 {
85   new2_foo();
86   bar33();
87 }
88
89 __asm__(".symver bar33,bar@@VERS_2.0");
90 #endif