]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - ld/testsuite/ld-shared/sh1.c
This commit was manufactured by cvs2svn to create branch 'binutils-
[thirdparty/binutils-gdb.git] / ld / testsuite / ld-shared / sh1.c
index 6d5b669b556f26b5ec0e10fb0f65a203e5479259..20f183c2642c507119a1834df219a9129d0543ad 100644 (file)
@@ -2,11 +2,15 @@
    of a shared library.  */
 
 /* This variable is supplied by the main program.  */
+#ifndef XCOFF_TEST
 extern int mainvar;
+#endif
 
 /* This variable is defined in the shared library, and overridden by
    the main program.  */
+#ifndef XCOFF_TEST
 int overriddenvar = -1;
+#endif
 
 /* This variable is defined in the shared library.  */
 int shlibvar1 = 3;
@@ -17,17 +21,21 @@ extern int shlibvar2;
 /* These functions return the values of the above variables as seen in
    the shared library.  */
 
+#ifndef XCOFF_TEST
 int
 shlib_mainvar ()
 {
   return mainvar;
 }
+#endif
 
+#ifndef XCOFF_TEST
 int
 shlib_overriddenvar ()
 {
   return overriddenvar;
 }
+#endif
 
 int
 shlib_shlibvar1 ()
@@ -52,8 +60,28 @@ shlib_shlibcall ()
   return shlib_shlibcalled ();
 }
 
+#ifndef XCOFF_TEST
+/* This function calls a function defined in this object in the shared
+   library.  The main program will override the called function.  */
+
+extern int shlib_overriddencall2 ();
+
+int
+shlib_shlibcall2 ()
+{
+  return shlib_overriddencall2 ();
+}
+
+int
+shlib_overriddencall2 ()
+{
+  return 7;
+}
+#endif
+
 /* This function calls a function defined by the main program.  */
 
+#ifndef XCOFF_TEST
 extern int main_called ();
 
 int
@@ -61,6 +89,7 @@ shlib_maincall ()
 {
   return main_called ();
 }
+#endif
 
 /* This function is passed a function pointer to shlib_mainvar.  It
    confirms that the pointer compares equally.  */
@@ -69,34 +98,38 @@ int
 shlib_checkfunptr1 (p)
      int (*p) ();
 {
-  return p == shlib_mainvar;
+  return p == shlib_shlibvar1;
 }
 
 /* This function is passed a function pointer to main_called.  It
    confirms that the pointer compares equally.  */
 
+#ifndef XCOFF_TEST
 int
 shlib_checkfunptr2 (p)
      int (*p) ();
 {
   return p == main_called;
 }
+#endif
 
 /* This function returns a pointer to shlib_mainvar.  */
 
 int
 (*shlib_getfunptr1 ()) ()
 {
-  return shlib_mainvar;
+  return shlib_shlibvar1;
 }
 
 /* This function returns a pointer to main_called.  */
 
+#ifndef XCOFF_TEST
 int
 (*shlib_getfunptr2 ()) ()
 {
   return main_called;
 }
+#endif
 
 /* This function makes sure that constant data and local functions
    work.  */