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 /* This function calls a function defined by the main program. */
79 extern int main_called ();
84 return main_called ();
88 /* This function is passed a function pointer to shlib_mainvar. It
89 confirms that the pointer compares equally. */
92 shlib_checkfunptr1 (p
)
95 return p
== shlib_shlibvar1
;
98 /* This function is passed a function pointer to main_called. It
99 confirms that the pointer compares equally. */
103 shlib_checkfunptr2 (p
)
106 return p
== main_called
;
110 /* This function returns a pointer to shlib_mainvar. */
113 (*shlib_getfunptr1 ()) ()
115 return shlib_shlibvar1
;
118 /* This function returns a pointer to main_called. */
122 (*shlib_getfunptr2 ()) ()
128 /* This function makes sure that constant data and local functions
136 static const char *str
= "Hello, world\n";
146 /* To isolate the test, don't rely on any external functions, such
148 s1
= "Hello, world\n";
156 if (shlib_shlibvar1 () != 3)