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