This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] ld-elfvsb FAILs on powerpc64


On Mon, Dec 04, 2006 at 11:46:13PM +0100, Jakub Jelinek wrote:
> On Tue, Dec 05, 2006 at 08:28:58AM +1030, Alan Modra wrote:
> > On Mon, Dec 04, 2006 at 06:29:27PM +0100, Andreas Schwab wrote:
> > > The following tests always fail on powerpc64:
> > 
> > Huh?  They don't fail for me.  To test ppc64, I configure using
> 
> See
> http://sources.redhat.com/ml/binutils/2004-08/msg00016.html
> http://sources.redhat.com/ml/binutils/2004-08/msg00030.html
> I'm using that patch ever since and haven't seen those failures anymore.

Hmm.  I was using a 3.4.5 based compiler.  I tried with mainline gcc
and got the failures, plus some other problems.  I'm applying Jakub's
patch along with a comment, and moving shared_data to sh2.c for the
same reason Jakub moved overriddenvar.

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.

Index: ld/testsuite/ld-elfvsb/elfvsb.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-elfvsb/elfvsb.exp,v
retrieving revision 1.29
diff -u -p -r1.29 elfvsb.exp
--- ld/testsuite/ld-elfvsb/elfvsb.exp	12 May 2005 07:32:06 -0000	1.29
+++ ld/testsuite/ld-elfvsb/elfvsb.exp	5 Dec 2006 01:20:22 -0000
@@ -315,8 +315,8 @@ proc visibility_run {visibility} {
 
 	# 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" ]
@@ -337,7 +337,7 @@ proc visibility_run {visibility} {
     }
 
     # 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 {
@@ -446,7 +446,7 @@ if { ![ld_compile "$CC -g $CFLAGS" $srcd
 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"] {
Index: ld/testsuite/ld-elfvsb/sh1.c
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-elfvsb/sh1.c,v
retrieving revision 1.7
diff -u -p -r1.7 sh1.c
--- ld/testsuite/ld-elfvsb/sh1.c	5 May 2003 05:46:53 -0000	1.7
+++ ld/testsuite/ld-elfvsb/sh1.c	5 Dec 2006 01:20:22 -0000
@@ -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 ()
Index: ld/testsuite/ld-elfvsb/sh2.c
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-elfvsb/sh2.c,v
retrieving revision 1.3
diff -u -p -r1.3 sh2.c
--- ld/testsuite/ld-elfvsb/sh2.c	28 Apr 2003 03:31:36 -0000	1.3
+++ ld/testsuite/ld-elfvsb/sh2.c	5 Dec 2006 01:20:22 -0000
@@ -44,3 +44,18 @@ visibility_func_weak ()
   return 2;
 }
 #endif
+
+#ifndef SHARED
+# ifndef XCOFF_TEST
+int overriddenvar = -1;
+
+int
+shlib_overriddencall2 ()
+{
+  return 7;
+}
+# endif
+# ifdef PROTECTED_TEST
+int shared_data = 100;
+# endif
+#endif

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]