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. */
7 /* This variable is defined in the shared library, and overridden by
10 int overriddenvar
= -1;
13 /* This variable is defined in the shared library. */
16 /* This variable is defined by another object in the shared library. */
19 /* These functions return the values of the above variables as seen in
20 the shared library. */
30 shlib_overriddenvar ()
48 /* This function calls a function defined by another object in the
51 extern int shlib_shlibcalled ();
56 return shlib_shlibcalled ();
60 /* This function calls a function defined in this object in the shared
61 library. The main program will override the called function. */
63 extern int shlib_overriddencall2 ();
68 return shlib_overriddencall2 ();
72 /* This function calls a function defined by the main program. */
74 extern int main_called ();
79 return main_called ();
82 /* This function is passed a function pointer to shlib_mainvar. It
83 confirms that the pointer compares equally. */
86 shlib_checkfunptr1 (p
)
89 return p
== shlib_shlibvar1
;
92 /* This function is passed a function pointer to main_called. It
93 confirms that the pointer compares equally. */
96 shlib_checkfunptr2 (p
)
99 return p
== main_called
;
102 /* This function returns a pointer to shlib_mainvar. */
105 (*shlib_getfunptr1 ()) ()
107 return shlib_shlibvar1
;
110 /* This function returns a pointer to main_called. */
113 (*shlib_getfunptr2 ()) ()
118 /* This function makes sure that constant data and local functions
126 static const char *str
= "Hello, world\n";
136 /* To isolate the test, don't rely on any external functions, such
138 s1
= "Hello, world\n";
146 if (shlib_shlibvar1 () != 3)