1999-07-21 Philippe De Muyter <phdm@macqel.be>
[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
9int
10bar()
11{
12 return 3;
13}
14
15/*
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.
18 */
19int
20hide_original_foo()
21{
22 return 1+bar();
23
24}
25
26int
27hide_old_foo()
28{
29 return 10+bar();
30
31}
32
33int
34hide_old_foo1()
35{
36 return 100+bar();
37
38}
39
40int
41hide_new_foo()
42{
43 return 1000+bar();
44
45}
46
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");
51
52
53
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. */
57int
58hide_new_bogus_foo()
59{
60 return 1000+bar();
61
62}
63__asm__(".symver hide_new_bogus_foo,show_foo@VERS_2.2");
64#endif
65
66
67
68
69#ifdef DO_TEST11
70/*
71 * This test is designed to catch a couple of syntactic errors. The assembler
72 * should complain about both of the directives below.
73 */
74int
75xyzzz()
76{
77 new2_foo();
78 bar33();
79}
80
81__asm__(".symver new2_foo,fooVERS_2.0");
82__asm__(".symver bar33,bar@@VERS_2.0");
83#endif
84
85#ifdef DO_TEST12
86/*
87 * This test is designed to catch a couple of syntactic errors. The assembler
88 * should complain about both of the directives below.
89 */
90int
91xyzzz()
92{
93 new2_foo();
94 bar33();
95}
96
97__asm__(".symver bar33,bar@@VERS_2.0");
98#endif
This page took 0.030634 seconds and 4 git commands to generate.