aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-elfvsb/sh1.c
diff options
context:
space:
mode:
Diffstat (limited to 'ld/testsuite/ld-elfvsb/sh1.c')
-rw-r--r--ld/testsuite/ld-elfvsb/sh1.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/ld/testsuite/ld-elfvsb/sh1.c b/ld/testsuite/ld-elfvsb/sh1.c
index 8d9fcdbdcb33..b2754249af70 100644
--- a/ld/testsuite/ld-elfvsb/sh1.c
+++ b/ld/testsuite/ld-elfvsb/sh1.c
@@ -13,7 +13,15 @@ extern int mainvar;
/* This variable is defined in the shared library, and overridden by
the main program. */
#ifndef XCOFF_TEST
+#ifdef SHARED
+/* SHARED is defined if we are compiling with -fpic/-fPIC. */
int overriddenvar = -1;
+#else
+/* Without -fpic, newer versions of gcc assume that we are not
+ compiling for a shared library, and thus that overriddenvar is
+ local. */
+extern int overriddenvar;
+#endif
#endif
/* This variable is defined in the shared library. */
@@ -76,12 +84,14 @@ shlib_shlibcall2 ()
return shlib_overriddencall2 ();
}
+#ifdef SHARED
int
shlib_overriddencall2 ()
{
return 7;
}
#endif
+#endif
/* This function calls a function defined by the main program. */
@@ -385,7 +395,11 @@ shlib_visibility_checkweak ()
#endif
#ifdef PROTECTED_TEST
+#ifdef SHARED
int shared_data = 100;
+#else
+extern int shared_data;
+#endif
int *
shared_data_p ()