1 /* This is part of the shared library ld test. This file becomes part
2 of a shared library. */
4 /* This variable is supplied by the main program. */
9 /* This variable is defined in the shared library, and overridden by
12 int overriddenvar
= -1;
15 /* This variable is defined in the shared library. */
18 /* This variable is defined by another object in the shared library. */
21 /* These functions return the values of the above variables as seen in
22 the shared library. */
34 shlib_overriddenvar ()
52 /* This function calls a function defined by another object in the
55 extern int shlib_shlibcalled ();
60 return shlib_shlibcalled ();
64 /* This function calls a function defined in this object in the shared
65 library. The main program will override the called function. */
67 extern int shlib_overriddencall2 ();
72 return shlib_overriddencall2 ();
76 shlib_overriddencall2 ()
82 /* This function calls a function defined by the main program. */
85 extern int main_called ();
90 return main_called ();
94 /* This function is passed a function pointer to shlib_mainvar. It
95 confirms that the pointer compares equally. */
98 shlib_checkfunptr1 (p
)
101 return p
== shlib_shlibvar1
;
104 /* This function is passed a function pointer to main_called. It
105 confirms that the pointer compares equally. */
109 shlib_checkfunptr2 (p
)
112 return p
== main_called
;
116 /* This function returns a pointer to shlib_mainvar. */
119 (*shlib_getfunptr1 ()) ()
121 return shlib_shlibvar1
;
124 /* This function returns a pointer to main_called. */
128 (*shlib_getfunptr2 ()) ()
134 /* This function makes sure that constant data and local functions
142 static const char *str
= "Hello, world\n";
152 /* To isolate the test, don't rely on any external functions, such
154 s1
= "Hello, world\n";
162 if (shlib_shlibvar1 () != 3)