+2006-12-05 Jakub Jelinek <jakub@redhat.com>
+ Alan Modra <amodra@bigpond.net.au>
+
+ * ld-elfvsb/sh1.c (overriddenvar, shlib_overriddencall2,
+ shared_data): If !SHARED, move to...
+ * ld-elfvsb/sh2.c: ... here.
+ * ld-elfvsb/elfvsb.exp: Add -DSHARED to compiler options when
+ building with $picflag.
+
2006-12-04 Jan Beulich <jbeulich@novell.com>
* ld-elf/eh-frame-hdr.d: New.
# Now compile the code using -fpic.
- if { ![ld_compile "$CC -g $CFLAGS $SHCFLAG $VSBCFLAG $picflag" $srcdir/$subdir/sh1.c $tmpdir/sh1p.o]
- || ![ld_compile "$CC -g $CFLAGS $SHCFLAG $VSBCFLAG $picflag" $srcdir/$subdir/sh2.c $tmpdir/sh2p.o] } {
+ if { ![ld_compile "$CC -g $CFLAGS $SHCFLAG $VSBCFLAG -DSHARED $picflag" $srcdir/$subdir/sh1.c $tmpdir/sh1p.o]
+ || ![ld_compile "$CC -g $CFLAGS $SHCFLAG $VSBCFLAG -DSHARED $picflag" $srcdir/$subdir/sh2.c $tmpdir/sh2p.o] } {
unresolved "visibility ($visibility)"
} else {
if { [ string match $visibility "protected" ]
}
# Now do the same tests again, but this time compile main.c PIC.
- if ![ld_compile "$CC -g $CFLAGS $SHCFLAG $VSBCFLAG $picflag" $srcdir/$subdir/main.c $tmpdir/mainp.o] {
+ if ![ld_compile "$CC -g $CFLAGS $SHCFLAG $VSBCFLAG -DSHARED $picflag" $srcdir/$subdir/main.c $tmpdir/mainp.o] {
unresolved "visibility ($visibility) (PIC main, non PIC so)"
unresolved "visibility ($visibility) (PIC main)"
} else {
if { ![ld_compile "$CC -g $CFLAGS" $srcdir/$subdir/test.c tmpdir/test.o] } {
unresolved "weak hidden symbol"
} else {
- if { ![ld_compile "$CC -g $CFLAGS $picflag" $srcdir/$subdir/sh3.c tmpdir/sh3.o] } {
+ if { ![ld_compile "$CC -g $CFLAGS -DSHARED $picflag" $srcdir/$subdir/sh3.c tmpdir/sh3.o] } {
unresolved "weak hidden symbol"
} else {
if ![ld_simple_link $ld tmpdir/sh3.so "-shared tmpdir/sh3.o"] {
/* 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. */
return shlib_overriddencall2 ();
}
+#ifdef SHARED
int
shlib_overriddencall2 ()
{
return 7;
}
#endif
+#endif
/* This function calls a function defined by the main program. */
#endif
#ifdef PROTECTED_TEST
+#ifdef SHARED
int shared_data = 100;
+#else
+extern int shared_data;
+#endif
int *
shared_data_p ()