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