1 /* This is the main program for the shared library test. */
9 extern int shlib_mainvar ();
10 extern int shlib_overriddenvar ();
11 extern int shlib_shlibvar1 ();
12 extern int shlib_shlibvar2 ();
13 extern int shlib_shlibcall ();
14 extern int shlib_maincall ();
15 extern int shlib_checkfunptr1 ();
16 extern int shlib_checkfunptr2 ();
17 extern int (*shlib_getfunptr1 ()) ();
18 extern int (*shlib_getfunptr2 ()) ();
19 extern int shlib_check ();
20 extern int shlib_shlibcall2 ();
21 extern int visibility_check ();
22 extern int visibility_checkfunptr ();
23 extern void *visibility_funptr ();
24 extern int visibility_checkvar ();
25 extern int visibility_checkvarptr ();
26 extern int visibility_varval ();
27 extern void *visibility_varptr ();
29 #ifdef HIDDEN_WEAK_TEST
30 #define HIDDEN_UNDEF_TEST
34 #ifdef PROTECTED_WEAK_TEST
35 #define PROTECTED_UNDEF_TEST
40 extern int visibility ();
41 extern int visibility_var;
44 #if !defined (HIDDEN_TEST) && defined (PROTECTED_TEST)
52 main_visibility_check ()
54 return visibility_funptr () != visibility;
57 int visibility_var = 1;
60 main_visibility_checkvar ()
62 return visibility_varval () != visibility_var
63 && visibility_varptr () != &visibility_var;
67 main_visibility_check ()
70 return visibility_funptr () == NULL;
72 return visibility_funptr () == visibility;
77 main_visibility_checkvar ()
80 return visibility_varval () == 0
81 && visibility_varptr () == NULL;
83 return visibility_varval () == visibility_var
84 && visibility_varptr () == &visibility_var;
89 /* This function is called by the shared library. */
97 /* This function overrides a function in the shared library. */
100 shlib_overriddencall2 ()
110 printf ("mainvar == %d\n", mainvar);
111 printf ("overriddenvar == %d\n", overriddenvar);
112 printf ("shlibvar1 == %d\n", shlibvar1);
114 printf ("shlib_mainvar () == %d\n", shlib_mainvar ());
115 printf ("shlib_overriddenvar () == %d\n", shlib_overriddenvar ());
117 printf ("shlib_shlibvar1 () == %d\n", shlib_shlibvar1 ());
118 printf ("shlib_shlibvar2 () == %d\n", shlib_shlibvar2 ());
119 printf ("shlib_shlibcall () == %d\n", shlib_shlibcall ());
121 printf ("shlib_shlibcall2 () == %d\n", shlib_shlibcall2 ());
122 printf ("shlib_maincall () == %d\n", shlib_maincall ());
124 printf ("main_called () == %d\n", main_called ());
125 printf ("shlib_checkfunptr1 (shlib_shlibvar1) == %d\n",
126 shlib_checkfunptr1 (shlib_shlibvar1));
128 printf ("shlib_checkfunptr2 (main_called) == %d\n",
129 shlib_checkfunptr2 (main_called));
131 p = shlib_getfunptr1 ();
132 printf ("shlib_getfunptr1 () ");
133 if (p == shlib_shlibvar1)
137 printf (" shlib_shlibvar1\n");
139 p = shlib_getfunptr2 ();
140 printf ("shlib_getfunptr2 () ");
141 if (p == main_called)
145 printf (" main_called\n");
147 printf ("shlib_check () == %d\n", shlib_check ());
148 printf ("visibility_check () == %d\n", visibility_check ());
149 printf ("visibility_checkfunptr () == %d\n",
150 visibility_checkfunptr ());
151 printf ("main_visibility_check () == %d\n", main_visibility_check ());
152 printf ("visibility_checkvar () == %d\n", visibility_checkvar ());
153 printf ("visibility_checkvarptr () == %d\n",
154 visibility_checkvarptr ());
155 printf ("main_visibility_checkvar () == %d\n",
156 main_visibility_checkvar ());