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: other/17466: Testsuites in gcc override LD_LIBRARY_PATH


On Thu, Nov 18, 2004 at 09:59:58AM +0000, Richard Sandiford wrote:
> "H. J. Lu" <hjl@lucon.org> writes:
> > +	global gcc_ld_library_path
> > +	set gcc_ld_library_path ""
> > +	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"
> 
> Long line.  Can be split without backslashes if you use { ... } quoting.
> 
> > +	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 "$ld_library_path:$env($path)"
> > +		    if {[string length "$ld_library_path:$env($path)"] > [string length $gcc_ld_library_path]} {
> 
> Another long line.
> 
> > +			set gcc_ld_library_path "$ld_library_path:$env($path)"
> 
> Why are you adding $ld_library_path here when you've already added it to
> $env(path)?  Also, since you initialise gcc_ld_library_path to "" before
> the loop, this logic will mean that $env(path) won't be added to
> $gcc_ld_library_path after the first call to the procedure.  More below.
> 

Fixed now.

> > +		    }
> > +		}
> > +	    } else {
> > +		setenv $path "$ld_library_path"
> > +	    }
> > +	}
> > +	if {$gcc_ld_library_path == ""} {
> > +	    set gcc_ld_library_path "$ld_library_path"
> > +	}
> > +    }
> > +}
> 
> What exactly do you want the final value of $gcc_ld_library_path
> to include?  Could you explain it in a comment?  Why is the longest
> of the $ld_path environment variables the right one to use?
> 

I updated comments also.

Thanks.


H.J.
----
2004-11-18  H.J. Lu  <hongjiu.lu@intel.com>

	PR other/17466:
	* g++.dg/compat/compat.exp (ld_library_path): Renamed to
	gcc_ld_library_path.
	(compat-fix-library-path): Removed.
	(compat-use-alt-compiler): Call ${tool}_set_ld_library_path to
	switch library path.
	(compat-use-tst-compiler): Call ${tool}_reset_ld_library_path
	to reset library path.

	* lib/g++.exp (g++_link_flags): Don't use global
	ld_library_path. Use ${libgcc_s_path} for gcc shared library
	directory. Call ${tool}_set_ld_library_path.
	* lib/gfortran.exp (gfortran_link_flags): Likewise.
	* lib/objc.exp (objc_target_compile): Likewise.
	* lib/treelang.exp (treelang_target_compile): Likewise.

	* lib/gcc-defs.exp (${tool}_set_ld_library_path): New procedure
	to set up LD_LIBRARY_PATH, SHLIB_PATH, LD_LIBRARYN32_PATH,
	LD_LIBRARY64_PATH, LD_LIBRARY_PATH_32, LD_LIBRARY_PATH_64 and
	DYLD_LIBRARY_PATH.
	(${tool}_reset_ld_library_path): New procedure to reset
	LD_LIBRARY_PATH, SHLIB_PATH, LD_LIBRARYN32_PATH,
	LD_LIBRARY64_PATH, LD_LIBRARY_PATH_32, LD_LIBRARY_PATH_64 and
	DYLD_LIBRARY_PATH.
	Set libgcc_s_path.

	* lib/gcc.exp (gcc_init): Call gcc_set_ld_library_path with
	$libgcc_s_path.

	* lib/gcc-dg.exp: Don't set LD_LIBRARY_PATH, SHLIB_PATH,
	LD_LIBRARYN32_PATH, LD_LIBRARY64_PATH, LD_LIBRARY_PATH_32,
	LD_LIBRARY_PATH_64 and DYLD_LIBRARY_PATH.

--- gcc/testsuite/g++.dg/compat/compat.exp.shlib	2004-02-03 10:16:15.000000000 -0800
+++ gcc/testsuite/g++.dg/compat/compat.exp	2004-11-18 10:09:51.561658836 -0800
@@ -30,40 +30,22 @@ if $tracelevel then {
 }
 
 global GXX_UNDER_TEST
-global ld_library_path
+global gcc_ld_library_path
 
 # Load procedures from common libraries. 
 load_lib standard.exp
 load_lib g++.exp
 
 #
-# compat-fix-library-path -- switch LD_LIBRARY_PATH
-#
-proc compat-fix-library-path { } {
-    global ld_library_path
-
-    # See comments in lib/g++.exp for why this is needed.
-    if {![is_remote target]} {
-	# See comments in lib/g++.exp for why this is needed.
-	setenv  LD_LIBRARY_PATH     $ld_library_path
-	setenv  SHLIB_PATH          $ld_library_path
-	setenv  LD_LIBRARYN32_PATH  $ld_library_path
-	setenv  LD_LIBRARY64_PATH   $ld_library_path
-	setenv  LD_LIBRARY_PATH_32  $ld_library_path
-	setenv  LD_LIBRARY_PATH_64  $ld_library_path
-	setenv  DYLD_LIBRARY_PATH   $ld_library_path
-    }
-}
-
-#
 # compat-use-alt-compiler -- make the alternate compiler the default
 # 
 proc compat-use-alt-compiler { } {
     global GXX_UNDER_TEST ALT_CXX_UNDER_TEST
     global CXXFLAGS
     global ALWAYS_CXXFLAGS
-    global ld_library_path alt_ld_library_path
+    global alt_ld_library_path
     global same_alt
+    global tool
 
     # We don't need to do this if the alternate compiler is actually
     # the same as the compiler under test.
@@ -71,8 +53,7 @@ proc compat-use-alt-compiler { } {
 	set GXX_UNDER_TEST $ALT_CXX_UNDER_TEST
 	set CXXFLAGS ""
 	set ALWAYS_CXXFLAGS ""
-	set ld_library_path $alt_ld_library_path
-	compat-fix-library-path
+	${tool}_set_ld_library_path $alt_ld_library_path
     }
 }
 
@@ -83,8 +64,9 @@ proc compat-use-tst-compiler { } {
     global GXX_UNDER_TEST save_gxx_under_test
     global CXXFLAGS save_cxxflags
     global ALWAYS_CXXFLAGS save_always_cxxflags
-    global ld_library_path save_ld_library_path
+    global save_ld_library_path
     global same_alt
+    global tool
 
     # We don't need to do this if the alternate compiler is actually
     # the same as the compiler under test.
@@ -93,8 +75,7 @@ proc compat-use-tst-compiler { } {
 	set GXX_UNDER_TEST $save_gxx_under_test
 	set CXXFLAGS $save_cxxflags
 	set ALWAYS_CXXFLAGS $save_always_cxxflags
-	set ld_library_path $save_ld_library_path
-	compat-fix-library-path
+	${tool}_reset_ld_library_path $save_ld_library_path
     }
 }
 
@@ -109,7 +90,7 @@ g++_init
 set save_gxx_under_test $GXX_UNDER_TEST
 set save_cxxflags $CXXFLAGS
 set save_always_cxxflags $ALWAYS_CXXFLAGS
-set save_ld_library_path $ld_library_path
+set save_ld_library_path $gcc_ld_library_path
 
 # Define an identifier for use with this suite to avoid name conflicts
 # with other compat tests running at the same time.
--- gcc/testsuite/lib/g++.exp.shlib	2004-11-16 10:13:59.000000000 -0800
+++ gcc/testsuite/lib/g++.exp	2004-11-17 22:31:12.000000000 -0800
@@ -96,9 +96,9 @@ proc g++_include_flags { paths } {
 #
 
 proc g++_link_flags { paths } {
-    global rootme
+    global libgcc_s_path
     global srcdir
-    global ld_library_path
+    global tool
     global GXX_UNDER_TEST
 
     set gccpath ${paths}
@@ -128,21 +128,7 @@ proc g++_link_flags { paths } {
       if [file exists "${gccpath}/librx/librx.a"] {
           append flags "-L${gccpath}/librx "
       }
-      append ld_library_path ":${rootme}"
-      set compiler [lindex $GXX_UNDER_TEST 0]
-      if { [is_remote host] == 0 && [which $compiler] != 0 } {
-	foreach i "[exec $compiler --print-multi-lib]" {
-	  set mldir ""
-	  regexp -- "\[a-z0-9=/\.-\]*;" $i mldir
-	  set mldir [string trimright $mldir "\;@"]
-	  if { "$mldir" == "." } {
-	    continue
-	  }
-	  if { [llength [glob -nocomplain ${rootme}/${mldir}/libgcc_s*.so.*]] >= 1 } {
-	    append ld_library_path ":${rootme}/${mldir}"
-	  }
-	}
-      }
+      append ld_library_path ":${libgcc_s_path}"
     } else {
       global tool_root_dir;
 
@@ -166,36 +152,7 @@ proc g++_link_flags { paths } {
       }
     }
 
-    # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but
-    # called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH
-    # (for the 64-bit ABI).  The right way to do this would be to modify
-    # unix.exp -- but that's not an option since it's part of DejaGNU
-    # proper, so we do it here.
-    # 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).
-    # Doing this does cause trouble when testing cross-compilers.
-    if {![is_remote target]} {
-	global env;
-	if [info exists env(LD_LIBRARY_PATH)] {
-	    # If we've already added these directories once, keep the
-	    # existing path.
-	    if {$ld_library_path == $env(LD_LIBRARY_PATH)
-		|| [string first $ld_library_path: \
-				 $env(LD_LIBRARY_PATH)] == 0} {
-		set ld_library_path $env(LD_LIBRARY_PATH)
-	    } elseif { $env(LD_LIBRARY_PATH) != "" } {
-		append ld_library_path ":$env(LD_LIBRARY_PATH)"
-	    }
-	}
-	setenv  LD_LIBRARY_PATH     $ld_library_path
-	setenv  SHLIB_PATH          $ld_library_path
-	setenv  LD_LIBRARYN32_PATH  $ld_library_path
-	setenv  LD_LIBRARY64_PATH   $ld_library_path
-	setenv  LD_LIBRARY_PATH_32  $ld_library_path
-	setenv  LD_LIBRARY_PATH_64  $ld_library_path
-	setenv  DYLD_LIBRARY_PATH   $ld_library_path
-    }
+    ${tool}_set_ld_library_path $ld_library_path
 
     return "$flags"
 }
--- gcc/testsuite/lib/gcc-defs.exp.shlib	2004-09-13 15:36:13.000000000 -0700
+++ gcc/testsuite/lib/gcc-defs.exp	2004-11-18 10:32:06.701803937 -0800
@@ -15,6 +15,7 @@
 # Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 load_lib wrapper.exp
+load_lib libgloss.exp
 
 #
 # ${tool}_check_compile -- Reports and returns pass/fail for a compilation
@@ -219,3 +220,97 @@ proc dg-additional-files-options { optio
 
     return $options
 }
+
+proc ${tool}_set_ld_library_path { ld_library_path } {
+    # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but
+    # called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH
+    # (for the 64-bit ABI).  The right way to do this would be to modify
+    # unix.exp -- but that's not an option since it's part of DejaGNU
+    # proper, so we do it here.  We really only need to do 
+    # this on IRIX, but it shouldn't hurt to do it anywhere else.
+    # 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).  Doing this does cause trouble when testing
+    # cross-compilers.
+    if {![is_remote target]} {
+	# If some environment variables were set before, we assume that
+	# the longest one will always work.  We use gcc_ld_library_path
+	# to store the longest path of shared library directories for
+	# g++.dg/compat/compat.exp which will save, change and restore
+	# shared library directories temporarily. If this function is
+	# called more than once, the caller has to make sure that the
+	# proper gcc_ld_library_path is saved.
+	global gcc_ld_library_path
+	set gcc_ld_library_path ""
+	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 "$ld_library_path:$env($path)"
+		    if {[string length $env($path)]
+			> [string length $gcc_ld_library_path]} {
+			set gcc_ld_library_path "$env($path)"
+		    }
+		}
+	    } else {
+		setenv $path "$ld_library_path"
+	    }
+	}
+	if {$gcc_ld_library_path == ""} {
+	    set gcc_ld_library_path "$ld_library_path"
+	}
+    }
+}
+
+# The difference between ${tool}_set_ld_library_path and
+# ${tool}_reset_ld_library_path is ${tool}_reset_ld_library_path
+# will set the dynamic linker path to $ld_library_path. It should
+# be called with the saved dynamic linker path only.
+#
+proc ${tool}_reset_ld_library_path { ld_library_path } {
+    set gcc_ld_library_path "$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 {
+	    setenv $path "$ld_library_path"
+	}
+    }
+}
+
+# libgcc_s_path -- the gcc shared library directory.
+global rootme
+global libgcc_s_path
+set libgcc_s_path "${rootme}"
+set compiler [lindex [find_gcc] 0]
+if { [is_remote host] == 0 && [which $compiler] != 0 } {
+    foreach i "[exec $compiler --print-multi-lib]" {
+	set mldir ""
+	regexp -- "\[a-z0-9=/\.-\]*;" $i mldir
+	set mldir [string trimright $mldir "\;@"]
+	if { "$mldir" == "." } {
+	    continue
+	}
+	if { [llength [glob -nocomplain ${rootme}/${mldir}/libgcc_s*.so.*]] >= 1 } {
+	    append libgcc_s_path ":${rootme}/${mldir}"
+	}
+    }
+}
--- gcc/testsuite/lib/gcc-dg.exp.shlib	2004-11-17 09:39:31.000000000 -0800
+++ gcc/testsuite/lib/gcc-dg.exp	2004-11-17 22:28:13.000000000 -0800
@@ -20,7 +20,6 @@ load_lib target-supports.exp
 load_lib scanasm.exp
 load_lib scantree.exp
 load_lib prune.exp
-load_lib libgloss.exp
 
 # We set LC_ALL and LANG to C so that we get the same error messages as expected.
 setenv LC_ALL C
@@ -45,63 +44,6 @@ if ![info exists TORTURE_OPTIONS] {
 	{ -Os } ]
 }
 
-global GCC_UNDER_TEST
-if ![info exists GCC_UNDER_TEST] {
-    set GCC_UNDER_TEST "[find_gcc]"
-}
-
-global rootme
-set libgcc_s_path "${rootme}"
-set compiler [lindex $GCC_UNDER_TEST 0]
-if { [is_remote host] == 0 && [which $compiler] != 0 } {
-    foreach i "[exec $compiler --print-multi-lib]" {
-	set mldir ""
-	regexp -- "\[a-z0-9=/\.-\]*;" $i mldir
-	set mldir [string trimright $mldir "\;@"]
-	if { "$mldir" == "." } {
-	    continue
-	}
-	if { [llength [glob -nocomplain ${rootme}/${mldir}/libgcc_s*.so.*]] >= 1 } {
-	    append libgcc_s_path ":${rootme}/${mldir}"
-	}
-    }
-}
-
-# On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but
-# called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH
-# (for the 64-bit ABI).  The right way to do this would be to modify
-# unix.exp -- but that's not an option since it's part of DejaGNU
-# proper, so we do it here.  We really only need to do 
-# this on IRIX, but it shouldn't hurt to do it anywhere else.
-# Doing this does cause trouble when testing cross-compilers.
-if {![is_remote target]} {
-    if [info exists env(LD_LIBRARY_PATH)] {
-	setenv  LD_LIBRARY_PATH    "$libgcc_s_path:$env(LD_LIBRARY_PATH)"
-    } else {
-	setenv  LD_LIBRARY_PATH     $libgcc_s_path
-    }
-    if [info exists env(SHLIB_PATH)] {
-	setenv  SHLIB_PATH          "$libgcc_s_path:$env(SHLIB_PATH)"
-    } else {
-	setenv  SHLIB_PATH          $libgcc_s_path
-    }
-    if [info exists env(LD_LIBRARYN32_PATH)] {
-	setenv  LD_LIBRARYN32_PATH  "$libgcc_s_path:$env(LD_LIBRARYN32_PATH)"
-    } else {
-	setenv  LD_LIBRARYN32_PATH  $libgcc_s_path
-    }
-    if [info exists env(LD_LIBRARY64_PATH)] {
-	setenv  LD_LIBRARY64_PATH  "$libgcc_s_path:$env(LD_LIBRARY64_PATH)"
-    } else {
-	setenv  LD_LIBRARY64_PATH   $libgcc_s_path
-    }
-    if [info exists env(DYLD_LIBRARY_PATH)] {
-	setenv  DYLD_LIBRARY_PATH  "$libgcc_s_path:$env(DYLD_LIBRARY_PATH)"
-    } else {
-	setenv  DYLD_LIBRARY_PATH   $libgcc_s_path
-    }
-}
-
 # Split TORTURE_OPTIONS into two choices: one for testcases with loops and
 # one for testcases without loops.
 
--- gcc/testsuite/lib/gcc.exp.shlib	2004-09-13 15:36:13.000000000 -0700
+++ gcc/testsuite/lib/gcc.exp	2004-11-17 22:23:21.000000000 -0800
@@ -92,6 +92,7 @@ proc gcc_init { args } {
     global gcc_initialized
     global GCC_UNDER_TEST
     global TOOL_EXECUTABLE
+    global libgcc_s_path
 
     if { $gcc_initialized == 1 } { return; }
 
@@ -108,6 +109,8 @@ proc gcc_init { args } {
     }
 
     gcc_maybe_build_wrapper "${tmpdir}/gcc-testglue.o"
+
+    gcc_set_ld_library_path $libgcc_s_path
 }
 
 #
--- gcc/testsuite/lib/gfortran.exp.shlib	2004-11-16 10:13:59.000000000 -0800
+++ gcc/testsuite/lib/gfortran.exp	2004-11-17 22:31:30.000000000 -0800
@@ -72,9 +72,9 @@ proc gfortran_version { } {
 #
 
 proc gfortran_link_flags { paths } {
-    global rootme
+    global libgcc_s_path
     global srcdir
-    global ld_library_path
+    global tool
     global GFORTRAN_UNDER_TEST
 
     set gccpath ${paths}
@@ -93,53 +93,10 @@ proc gfortran_link_flags { paths } {
       if [file exists "${gccpath}/libiberty/libiberty.a"] {
           append flags "-L${gccpath}/libiberty "
       }
-      append ld_library_path ":${rootme}"
-      set compiler [lindex $GFORTRAN_UNDER_TEST 0]
-      if { [is_remote host] == 0 && [which $compiler] != 0 } {
-	foreach i "[exec $compiler --print-multi-lib]" {
-	  set mldir ""
-	  regexp -- "\[a-z0-9=/\.-\]*;" $i mldir
-	  set mldir [string trimright $mldir "\;@"]
-	  if { "$mldir" == "." } {
-	    continue
-	  }
-	  if { [llength [glob -nocomplain ${rootme}/${mldir}/libgcc_s*.so.*]] >= 1 } {
-	    append ld_library_path ":${rootme}/${mldir}"
-	  }
-	}
-      }
+      append ld_library_path ":${libgcc_s_path}"
     }
 
-    # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but
-    # called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH
-    # (for the 64-bit ABI).  The right way to do this would be to modify
-    # unix.exp -- but that's not an option since it's part of DejaGNU
-    # proper, so we do it here.
-    # 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).
-    # Doing this does cause trouble when testing cross-compilers.
-    if {![is_remote target]} {
-        global env;
-	if [info exists env(LD_LIBRARY_PATH)] {
-	    # If we've already added these directories once, keep the
-	    # existing path.
-	    if {$ld_library_path == $env(LD_LIBRARY_PATH)
-		|| [string first $ld_library_path: \
-				 $env(LD_LIBRARY_PATH)] == 0} {
-		set ld_library_path $env(LD_LIBRARY_PATH)
-	    } elseif { $env(LD_LIBRARY_PATH) != "" } {
-		append ld_library_path ":$env(LD_LIBRARY_PATH)"
-	    }
-	}
-        setenv  LD_LIBRARY_PATH     $ld_library_path
-        setenv  SHLIB_PATH          $ld_library_path
-        setenv  LD_LIBRARYN32_PATH  $ld_library_path
-        setenv  LD_LIBRARY64_PATH   $ld_library_path
-        setenv  LD_LIBRARY_PATH_32  $ld_library_path
-        setenv  LD_LIBRARY_PATH_64  $ld_library_path
-        setenv  DYLD_LIBRARY_PATH   $ld_library_path
-    }
+    ${tool}_set_ld_library_path $ld_library_path
 
     return "$flags"
 }
--- gcc/testsuite/lib/objc.exp.shlib	2004-11-16 10:13:59.000000000 -0800
+++ gcc/testsuite/lib/objc.exp	2004-11-17 22:33:11.000000000 -0800
@@ -85,14 +85,12 @@ proc objc_version { } {
 set objc_initialized 0
 
 proc objc_init { args } {
-    global rootme
     global tmpdir
     global libdir
     global gluefile wrap_flags
     global objc_initialized
     global OBJC_UNDER_TEST
     global TOOL_EXECUTABLE
-    global objc_libgcc_s_path
 
     # We set LC_ALL and LANG to C so that we get the same error messages as expected.
     setenv LC_ALL C
@@ -113,22 +111,6 @@ proc objc_init { args } {
     }
 
     objc_maybe_build_wrapper "${tmpdir}/objc-testglue.o"
-
-    set objc_libgcc_s_path "${rootme}"
-    set compiler [lindex $OBJC_UNDER_TEST 0]
-    if { [is_remote host] == 0 && [which $compiler] != 0 } {
-	foreach i "[exec $compiler --print-multi-lib]" {
-	    set mldir ""
-	    regexp -- "\[a-z0-9=/\.-\]*;" $i mldir
-	    set mldir [string trimright $mldir "\;@"]
-	    if { "$mldir" == "." } {
-		continue
-	    }
-	    if { [llength [glob -nocomplain ${rootme}/${mldir}/libgcc_s*.so.*]] >= 1 } {
-		append objc_libgcc_s_path ":${rootme}/${mldir}"
-	    }
-	}
-    }
 }
 
 proc objc_target_compile { source dest type options } {
@@ -138,10 +120,10 @@ proc objc_target_compile { source dest t
     global srcdir
     global OBJC_UNDER_TEST
     global TOOL_OPTIONS
-    global ld_library_path
-    global objc_libgcc_s_path
+    global tool
+    global libgcc_s_path
 
-    set ld_library_path ".:${objc_libgcc_s_path}"
+    set ld_library_path ".:${libgcc_s_path}"
     lappend options "libs=-lobjc"
 
     if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } {
@@ -187,21 +169,7 @@ proc objc_target_compile { source dest t
     }
     lappend options "compiler=$OBJC_UNDER_TEST"
 
-    # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but
-    # called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH
-    # (for the 64-bit ABI).  The right way to do this would be to modify
-    # unix.exp -- but that's not an option since it's part of DejaGNU
-    # proper, so we do it here.
-    # 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).
-    setenv  LD_LIBRARY_PATH     $ld_library_path
-    setenv  SHLIB_PATH          $ld_library_path
-    setenv  LD_LIBRARYN32_PATH  $ld_library_path
-    setenv  LD_LIBRARY64_PATH   $ld_library_path
-    setenv  LD_LIBRARY_PATH_32  $ld_library_path
-    setenv  LD_LIBRARY_PATH_64  $ld_library_path
-    setenv  DYLD_LIBRARY_PATH   $ld_library_path
+    ${tool}_set_ld_library_path $ld_library_path
 
     return [target_compile $source $dest $type $options]
 }
--- gcc/testsuite/lib/treelang.exp.shlib	2004-11-16 10:13:59.000000000 -0800
+++ gcc/testsuite/lib/treelang.exp	2004-11-17 22:46:41.000000000 -0800
@@ -89,7 +89,6 @@ proc treelang_init { args } {
     global treelang_initialized
     global TREELANG_UNDER_TEST
     global TOOL_EXECUTABLE
-    global treelang_libgcc_s_path
 
 
     # We set LC_ALL and LANG to C so that we get the same error messages as expected.
@@ -112,22 +111,6 @@ proc treelang_init { args } {
     }
 
     treelang_maybe_build_wrapper "${tmpdir}/treelang-testglue.o"
-
-    set treelang_libgcc_s_path "${rootme}"
-    set compiler [lindex $TREELANG_UNDER_TEST 0]
-    if { [is_remote host] == 0 && [which $compiler] != 0 } {
-	foreach i "[exec $compiler --print-multi-lib]" {
-	    set mldir ""
-	    regexp -- "\[a-z0-9=/\.-\]*;" $i mldir
-	    set mldir [string trimright $mldir "\;@"]
-	    if { "$mldir" == "." } {
-		continue
-	    }
-	    if { [llength [glob -nocomplain ${rootme}/${mldir}/libgcc_s*.so.*]] >= 1 } {
-		append treelang_libgcc_s_path ":${rootme}/${mldir}"
-	    }
-	}
-    }
 }
 
 proc treelang_target_compile { source dest type options } {
@@ -137,10 +120,10 @@ proc treelang_target_compile { source de
     global srcdir
     global TREELANG_UNDER_TEST
     global TOOL_OPTIONS
-    global ld_library_path
-    global treelang_libgcc_s_path
+    global libgcc_s_path
+
+    ${tool}_set_ld_library_path ".:${libgcc_s_path}"
 
-    set ld_library_path ".:${treelang_libgcc_s_path}"
     lappend options "libs=-ltreelang"
 
     if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } {


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