Back to index

cell-binutils  2.17cvs20070401
vers1.c
Go to the documentation of this file.
00001 /*
00002  * Basic test of versioning.  The idea with this is that we define
00003  * a bunch of definitions of the same symbol, and we can theoretically
00004  * then link applications against varying sets of these.
00005  */
00006 const char * show_bar1 = "asdf";
00007 const char * show_bar2 = "asdf";
00008 
00009 extern int new2_foo();
00010 extern int bar33();
00011 
00012 int
00013 bar()
00014 {
00015        return 3;
00016 }
00017 
00018 /*
00019  * The 'hide' prefix is something so that we can automatically search the
00020  * symbol table and verify that none of these symbols were actually exported.
00021  */
00022 int
00023 hide_original_foo()
00024 {
00025        return 1+bar();
00026 
00027 }
00028 
00029 int
00030 hide_old_foo()
00031 {
00032        return 10+bar();
00033 
00034 }
00035 
00036 int
00037 hide_old_foo1()
00038 {
00039        return 100+bar();
00040 
00041 }
00042 
00043 int
00044 hide_new_foo()
00045 {
00046        return 1000+bar();
00047 
00048 }
00049 
00050 __asm__(".symver hide_original_foo,show_foo@");
00051 __asm__(".symver hide_old_foo,show_foo@VERS_1.1");
00052 __asm__(".symver hide_old_foo1,show_foo@VERS_1.2");
00053 __asm__(".symver hide_new_foo,show_foo@@VERS_2.0");
00054 
00055 
00056 
00057 #ifdef DO_TEST10
00058 /* In test 10, we try and define a non-existant version node.  The linker
00059  * should catch this and complain. */
00060 int
00061 hide_new_bogus_foo()
00062 {
00063        return 1000+bar();
00064 
00065 }
00066 __asm__(".symver hide_new_bogus_foo,show_foo@VERS_2.2");
00067 #endif
00068 
00069 
00070 
00071 
00072 #ifdef DO_TEST11
00073 /*
00074  * This test is designed to catch a couple of syntactic errors.  The assembler
00075  * should complain about both of the directives below.
00076  */
00077 void
00078 xyzzz()
00079 {
00080   new2_foo();
00081   bar33();
00082 }
00083 
00084 __asm__(".symver new2_foo,fooVERS_2.0");
00085 __asm__(".symver bar33,bar@@VERS_2.0");
00086 #endif
00087 
00088 #ifdef DO_TEST12
00089 /*
00090  * This test is designed to catch a couple of syntactic errors.  The assembler
00091  * should complain about both of the directives below.
00092  */
00093 void
00094 xyzzz()
00095 {
00096   new2_foo();
00097   bar33();
00098 }
00099 
00100 __asm__(".symver bar33,bar@@VERS_2.0");
00101 #endif