The recent introduction of this patch

2010-05-29  Mike Stump  <mikest...@comcast.net>

        * configure.ac: Add multilib support for gmp.  Proper -I and -L
        flags for gmp are added.

broke bootstrap on i386-pc-solaris2.11 and almost certainly at least all
Solaris 2
platforms with a static libgmp:

/bin/ksh ../../../libtool --tag=CC   --mode=link
/vol/gcc/obj/gcc-4.6.0-20100602/11-gcc/./gcc/xgcc
-B/vol/gcc/obj/gcc-4.6.0-20100602/11-gcc/./gcc/
-B/vol/gcc/i386-pc-solaris2.11/bin/ -B/vol/gcc/i386-pc-solaris2.11/lib/
-isystem /vol/gcc/i386-pc-solaris2.11/include -isystem
/vol/gcc/i386-pc-solaris2.11/sys-include    -W -Wall -Wmissing-declarations
-Wwrite-strings -Wmissing-prototypes -Wno-long-long  -I/vol/gcc/include  -g -O2
-module -version-info 0:0:0 -no-undefined -L/vol/gcc/lib -lgmp -avoid-version 
-o libjavamath.la -rpath /vol/gcc/lib/gcj-4.6.0-11 gnu_java_math_GMP.lo
../../../native/jni/classpath/jcl.lo -lsocket -lnsl 
libtool: link: /vol/gcc/obj/gcc-4.6.0-20100602/11-gcc/./gcc/xgcc
-B/vol/gcc/obj/gcc-4.6.0-20100602/11-gcc/./gcc/
-B/vol/gcc/i386-pc-solaris2.11/bin/ -B/vol/gcc/i386-pc-solaris2.11/lib/
-isystem /vol/gcc/i386-pc-solaris2.11/include -isystem
/vol/gcc/i386-pc-solaris2.11/sys-include    -shared -Wl,-z -Wl,text -Wl,-h
-Wl,libjavamath.so -o .libs/libjavamath.so  .libs/gnu_java_math_GMP.o
../../../native/jni/classpath/.libs/jcl.o   -L/vol/gcc/lib
/vol/gcc/lib/libgmp.a -lsocket -lnsl -lc   
Text relocation remains                         referenced
    against symbol                  offset      in file
.rodata.str1.4 (section)            0x2e       
/vol/gcc/lib/libgmp.a(lt19-get_str.o)
[...]

The static libgmp is usually non-PIC, while we need PIC code to link
libjavamath.so.

It turned out to be remarkably difficult to work around this:

* While gcc on Solaris supports -mimpure-text to allow linking of non-PIC code
  into a shared library, all this does is disable the implicit -z text enabled
  by gcc -shared.  Since libtool passes -z text by itself, this doesn't help.

* Sun ld doesn't allow -z text -z textoff, so I had to resort to edititing
  -z text out of libtool and adding -mimpure-text after the -shared there.

To fix this for real, one needs to build a PIC libgmp.a, which at the very
least
needs to be documented.

Apart from that, the patch has a couple of other problems:

* The ChangeLog entry belongs into classpath/ChangeLog, not libjava/ChangeLog.

* For multilibbed targets, it used to be enough to have libgmp for the default
  multilib.  Now you need libgmp for every multilib, otherwise the facitilies
  between e.g. 32-bit and 64-bit libjavamath.so differ.

* There seems to be no provision to pass in -L and -R flags for the non-default
  multilibs, and neither libtool nor the libjava/classpath make machinery seem
  to support automatically looking in e.g. $libdir/amd64 for 64-bit multilibs.

It seems this needs considerably more work to be complete and useful.


-- 
           Summary: [4.6 regression] gmp multilib support broke bootstrap
                    with static libgmp
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: build
          Severity: normal
          Priority: P3
         Component: libgcj
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ro at gcc dot gnu dot org
 GCC build triplet: *-*-solaris2.*
  GCC host triplet: *-*-solaris2.*
GCC target triplet: *-*-solaris2.*


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44415

Reply via email to