This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: PR/17311: Wrong libgcc_s.so.1 is used by lt-gij


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.

--- libjava/testsuite/lib/libjava.exp.shlib	2004-08-04 17:50:58.000000000 -0700
+++ libjava/testsuite/lib/libjava.exp	2004-09-07 16:15:26.059066345 -0700
@@ -929,13 +929,34 @@ 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 { args } {
+    global libjava_libgcc_s_path
+
+    if [info exists env(LD_LIBRARY_PATH)] {
+	setenv  LD_LIBRARY_PATH    "$libjava_libgcc_s_path:$env(LD_LIBRARY_PATH)"
+    } else {
+	setenv  LD_LIBRARY_PATH     $libjava_libgcc_s_path
+    }
+    if [info exists env(SHLIB_PATH)] {
+	setenv  SHLIB_PATH          "$libjava_libgcc_s_path:$env(SHLIB_PATH)"
+    } else {
+	setenv  SHLIB_PATH          $libjava_libgcc_s_path
+    }
+    if [info exists env(LD_LIBRARYN32_PATH)] {
+	setenv  LD_LIBRARYN32_PATH  "$libjava_libgcc_s_path:$env(LD_LIBRARYN32_PATH)"
+    } else {
+	setenv  LD_LIBRARYN32_PATH  $libjava_libgcc_s_path
+    }
+    if [info exists env(LD_LIBRARY64_PATH)] {
+	setenv  LD_LIBRARY64_PATH  "$libjava_libgcc_s_path:$env(LD_LIBRARY64_PATH)"
+    } else {
+	setenv  LD_LIBRARY64_PATH   $libjava_libgcc_s_path
+    }
+    if [info exists env(DYLD_LIBRARY_PATH)] {
+	setenv  DYLD_LIBRARY_PATH  "$libjava_libgcc_s_path:$env(DYLD_LIBRARY_PATH)"
+    } else {
+	setenv  DYLD_LIBRARY_PATH   $libjava_libgcc_s_path
+    }
 }
 
 trace variable env(LD_LIBRARY_PATH) w ${tool}_set_ld_library_path
--- libjava/testsuite/libjava.cni/cni.exp.shlib	2003-03-21 23:14:53.000000000 -0800
+++ libjava/testsuite/libjava.cni/cni.exp	2004-09-07 13:59:40.078617312 -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-07 14:00:28.355384491 -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	2004-05-10 14:06:45.000000000 -0700
+++ libjava/testsuite/libjava.jar/jar.exp	2004-09-07 14:01:05.047647299 -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	2004-06-21 11:08:55.000000000 -0700
+++ libjava/testsuite/libjava.jni/jni.exp	2004-09-07 14:01:34.416634643 -0700
@@ -197,4 +197,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-07 14:02:06.364515409 -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-07 14:02:43.935671133 -0700
@@ -64,4 +64,5 @@ proc gcj_loader_run {} {
   }
 }
 
+${tool}_set_ld_library_path
 gcj_loader_run


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