This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: PR/17311: Wrong libgcc_s.so.1 is used by lt-gij
On Tue, Sep 14, 2004 at 11:37:15AM -0700, H. J. Lu wrote:
> On Thu, Sep 09, 2004 at 09:22:08AM -0700, H. J. Lu wrote:
> > On Tue, Sep 07, 2004 at 01:11:50PM -0700, H. J. Lu wrote:
> > > On Fri, Sep 03, 2004 at 03:12:59PM -0700, H. J. Lu wrote:
> > > > On Fri, Sep 03, 2004 at 01:51:34PM -0700, H. J. Lu wrote:
> > > > > The newly built libgcc_s.so.1 may not be used for "make check". It
> > > > > leads to 2 problems:
> > > > >
> > > > > 1. The newly built libgcc_s.so.1 may be fully tested by "make check".
> > > > > 2. Those tests which won't work with old libgcc_s.so.1 may fail.
> > > > >
> > > > > This patch
> > > > >
> > > > > http://gcc.gnu.org/ml/gcc-patches/2004-07/msg01881.html
> > > > >
> > > > > tries to fix PR 16633. There is another bug
> > > > >
> > > > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17311
> > > > >
> > > > > Could someone please review my patch?
> > > >
> > > > PR 17311 has something do to with libtool which can't handle mixed
> > > > shared libraries built with and without libtool. In this case, the
> > > > shared libgcj is built with libtool and libgcc_s.so.1 isn't. gij is
> > > > linked with both libgcj and libgcc_s.so.1. When gij is run during
> > > > "make check", the build directory of libgcj is put into DT_RPATH
> > > > of lt-gij before the install directory while the build directory of
> > > > libgcc_s.so.1 isn't. As the result, if there is an installed
> > > > libgcc_s.so.1, it will be used by lt-gij. Setting LD_LIBRARY_PATH won't
> > > > change it.
> > > >
> > > > There is a libtool bug. I don't see why libtool should leave the
> > > > install directory in DT_RPATH for lt-xxx at all. It works if all
> > > > shared libraries are built with libtool. But it isn't the case
> > > > for gcc.
> > > >
> > > >
> > >
> > > This is the first step to fix PR/17311. I don't understand why libtool
> > > has to put the install directory in RPATH for compile. Removing it
> > > shouldn't cause any problem since the install directory may not exist
> > > during compile before "make install"
> > >
> > >
> > >
> > > H.J.
> > > ------
> > > 2004-09-07 H.J. Lu <hongjiu.lu@intel.com>
> > >
> > > PR libgcj/17311
> > > * ltmain.sh: Don't use "$finalize_rpath" for compile.
> > >
> > > --- ltmain.sh.rpath 2002-03-22 00:16:20.000000000 -0800
> > > +++ ltmain.sh 2004-09-07 12:11:22.973823928 -0700
> > > @@ -3557,7 +3557,7 @@ EOF
> > > # Now hardcode the library paths
> > > rpath=
> > > hardcode_libdirs=
> > > - for libdir in $compile_rpath $finalize_rpath; do
> > > + for libdir in $compile_rpath; do
> > > if test -n "$hardcode_libdir_flag_spec"; then
> > > if test -n "$hardcode_libdir_separator"; then
> > > if test -z "$hardcode_libdirs"; then
> >
> >
> > Here is the second part of the patch to fix PR libgcj/17311. We need
> > to make sure the newly built libgcc_s.so.1 is used. That is a major
> > flaw in the current gcc. We may have to duplicate it for each testsuite.
> > Ideally, dejagnu should do it for us. libgloss.exp already does it for
> > libstdc++ and libg++. It shouldn't be hard to add libgcc_s.so.1. But
> > we still have to deal with the old dejagnu. Also we need to handle
> > the bootstrap process where the only available libgcc_s.so.1 is
> > the newly built one:
> >
> > http://gcc.gnu.org/ml/gcc/2004-09/msg00209.html
> >
> >
> > H.J.
> > -----
> > 2004-09-07 H.J. Lu <hongjiu.lu@intel.com>
> >
> > PR libgcj/17311
> > * lib/libjava.exp (${tool}_set_ld_library_path): Use
> > libjava_libgcc_s_path to set linker library path.
> > * libjava.cni/cni.exp: Call ${tool}_set_ld_library_path.
> > * libjava.compile/compile.exp: Likewise.
> > * libjava.jar/jar.exp: Likewise.
> > * libjava.jni/jni.exp: Likewise.
> > * libjava.loader/loader.exp: Likewise.
> >
>
> Here is the updated version of the second patch to support Solaris.
>
>
This updated patch fixed the logical of setting the enviroment variable
just once.
H.J.
----
2004-09-14 H.J. Lu <hongjiu.lu@intel.com>
PR libgcj/17311
* lib/libjava.exp (${tool}_set_ld_library_path): Use
libjava_libgcc_s_path to set linker library path. Don't trace
env(LD_LIBRARY_PATH).
* libjava.cni/cni.exp: Call ${tool}_set_ld_library_path.
* libjava.compile/compile.exp: Likewise.
* libjava.jar/jar.exp: Likewise.
* libjava.jni/jni.exp: Likewise.
* libjava.loader/loader.exp: Likewise.
--- libjava/testsuite/lib/libjava.exp.shlib 2004-01-13 09:11:31.000000000 -0800
+++ libjava/testsuite/lib/libjava.exp 2004-09-14 10:23:49.000000000 -0700
@@ -911,16 +911,25 @@ proc default_libjava_start { } {
# The same applies to darwin (DYLD_LIBRARY_PATH), solaris 32 bit
# (LD_LIBRARY_PATH_32), solaris 64 bit (LD_LIBRARY_PATH_64), and HP-UX
# (SHLIB_PATH).
-proc ${tool}_set_ld_library_path { name element op } {
- setenv LD_LIBRARYN32_PATH [getenv LD_LIBRARY_PATH]
- setenv LD_LIBRARY64_PATH [getenv LD_LIBRARY_PATH]
- setenv SHLIB_PATH [getenv LD_LIBRARY_PATH]
- setenv DYLD_LIBRARY_PATH [getenv LD_LIBRARY_PATH]
- setenv LD_LIBRARY_PATH_32 [getenv LD_LIBRARY_PATH]
- setenv LD_LIBRARY_PATH_64 [getenv LD_LIBRARY_PATH]
-}
+proc ${tool}_set_ld_library_path { } {
+ global libjava_libgcc_s_path
-trace variable env(LD_LIBRARY_PATH) w ${tool}_set_ld_library_path
+ if {![is_remote target]} {
+ set ld_path "LD_LIBRARY_PATH SHLIB_PATH LD_LIBRARYN32_PATH LD_LIBRARY64_PATH LD_LIBRARY_PATH_32 LD_LIBRARY_PATH_64 DYLD_LIBRARY_PATH"
+ foreach path $ld_path {
+ if [info exists env($path)] {
+ # If we've already added these directories once, keep
+ # the existing path.
+ if {$ld_library_path != $env($path)
+ && [string first $ld_library_path: $env($path)] != 0} {
+ setenv $path "$libjava_libgcc_s_path:$env($path)"
+ }
+ } else {
+ setenv $path "$libjava_libgcc_s_path"
+ }
+ }
+ }
+}
# Local Variables:
# tcl-indent-level:4
--- libjava/testsuite/libjava.cni/cni.exp.shlib 2003-03-21 23:14:53.000000000 -0800
+++ libjava/testsuite/libjava.cni/cni.exp 2004-09-14 10:15:24.000000000 -0700
@@ -116,4 +116,5 @@ proc gcj_cni_run {} {
}
}
+${tool}_set_ld_library_path
gcj_cni_run
--- libjava/testsuite/libjava.compile/compile.exp.shlib 2003-09-06 07:08:14.000000000 -0700
+++ libjava/testsuite/libjava.compile/compile.exp 2004-09-14 10:15:24.000000000 -0700
@@ -3,6 +3,8 @@ global srcdir subdir
catch { lsort [glob -nocomplain ${srcdir}/${subdir}/*.java] } srcfiles
verbose "srcfiles are $srcfiles"
+${tool}_set_ld_library_path
+
set prefix ""
foreach x $srcfiles {
set args [libjava_read_xfail [file rootname $x].xfail]
--- libjava/testsuite/libjava.jar/jar.exp.shlib 2003-11-18 11:21:44.000000000 -0800
+++ libjava/testsuite/libjava.jar/jar.exp 2004-09-14 10:15:24.000000000 -0700
@@ -64,4 +64,5 @@ proc gcj_jar_run {} {
return 1
}
+${tool}_set_ld_library_path
gcj_jar_run
--- libjava/testsuite/libjava.jni/jni.exp.shlib 2003-03-28 17:15:54.000000000 -0800
+++ libjava/testsuite/libjava.jni/jni.exp 2004-09-14 10:15:24.000000000 -0700
@@ -160,4 +160,5 @@ proc gcj_jni_run {} {
}
}
+${tool}_set_ld_library_path
gcj_jni_run
--- libjava/testsuite/libjava.lang/lang.exp.shlib 2003-09-06 07:08:14.000000000 -0700
+++ libjava/testsuite/libjava.lang/lang.exp 2004-09-14 10:15:24.000000000 -0700
@@ -3,6 +3,8 @@ global srcdir subdir
catch { lsort [glob -nocomplain ${srcdir}/${subdir}/*.out] } srcfiles
verbose "srcfiles are $srcfiles"
+${tool}_set_ld_library_path
+
set prefix ""
foreach x $srcfiles {
regsub "\\.out$" $x "" prefix
--- libjava/testsuite/libjava.loader/loader.exp.shlib 2002-12-12 21:00:14.000000000 -0800
+++ libjava/testsuite/libjava.loader/loader.exp 2004-09-14 10:15:24.000000000 -0700
@@ -64,4 +64,5 @@ proc gcj_loader_run {} {
}
}
+${tool}_set_ld_library_path
gcj_loader_run