* elf32-spu.c (build_stub): Fix malloc under-allocation.
[binutils.git] / ld / testsuite / ld-elfvers / vers1.c
blob86e2bd2ba16157a3014fd822055c185a5eee800c
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 #include "vers.h"
8 const char * show_bar1 = "asdf";
9 const char * show_bar2 = "asdf";
11 extern int new2_foo();
12 extern int bar33();
14 int
15 bar()
17 return 3;
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.
24 int
25 hide_original_foo()
27 return 1+bar();
31 int
32 hide_old_foo()
34 return 10+bar();
38 int
39 hide_old_foo1()
41 return 100+bar();
45 int
46 hide_new_foo()
48 return 1000+bar();
52 SYMVER(hide_original_foo, show_foo@);
53 SYMVER(hide_old_foo, show_foo@VERS_1.1);
54 SYMVER(hide_old_foo1, show_foo@VERS_1.2);
55 SYMVER(hide_new_foo, show_foo@@VERS_2.0);
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. */
62 int
63 hide_new_bogus_foo()
65 return 1000+bar();
68 SYMVER(hide_new_bogus_foo, show_foo@VERS_2.2);
69 #endif
74 #ifdef DO_TEST11
76 * This test is designed to catch a couple of syntactic errors. The assembler
77 * should complain about both of the directives below.
79 void
80 xyzzz()
82 new2_foo();
83 bar33();
86 SYMVER(new2_foo, fooVERS_2.0);
87 SYMVER(bar33, bar@@VERS_2.0);
88 #endif
90 #ifdef DO_TEST12
92 * This test is designed to catch a couple of syntactic errors. The assembler
93 * should complain about both of the directives below.
95 void
96 xyzzz()
98 new2_foo();
99 bar33();
102 SYMVER(bar33, bar@@VERS_2.0);
103 #endif