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]

PATCH: other/17466: Testsuites in gcc override LD_LIBRARY_PATH


Using global ld_library_path means to override LD_LIBRART_PATH. Don't
do it. When LD_LIBRART_PATH is needed, override it will cause failure.


H.J.
-----
2004-09-13  H.J. Lu  <hongjiu.lu@intel.com>

	PR other/17466:
	* lib/gcc-defs.exp (${tool}_set_ld_library_path): New procedure.
	* lib/g++.exp (g++_link_flags): Don't use global
	ld_library_path. Call ${tool}_set_ld_library_path to set up
	LD_LIBRARY_PATH, SHLIB_PATH, LD_LIBRARYN32_PATH,
	LD_LIBRARY64_PATH and DYLD_LIBRARY_PATH.
	* lib/g77.exp (g77_link_flags): Likewise.
	* lib/objc.exp (objc_target_compile): Likewise.
	* lib/gcc-dg.exp: Call ${tool}_set_ld_library_path to set up
	LD_LIBRARY_PATH, SHLIB_PATH, LD_LIBRARYN32_PATH,
	LD_LIBRARY64_PATH and DYLD_LIBRARY_PATH.

--- gcc/testsuite/lib/g++.exp.shlib	2004-02-23 13:25:33.000000000 -0800
+++ gcc/testsuite/lib/g++.exp	2004-09-13 09:48:18.866989855 -0700
@@ -98,7 +98,7 @@ proc g++_include_flags { paths } {
 proc g++_link_flags { paths } {
     global rootme
     global srcdir
-    global ld_library_path
+    global tool
     global GXX_UNDER_TEST
 
     set gccpath ${paths}
@@ -166,20 +166,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.  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]} {
-	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  DYLD_LIBRARY_PATH   $ld_library_path
-    }
+    ${tool}_set_ld_library_path $ld_library_path
 
     return "$flags"
 }
--- gcc/testsuite/lib/g77.exp.shlib	2004-02-23 13:25:33.000000000 -0800
+++ gcc/testsuite/lib/g77.exp	2004-09-13 09:44:17.235282440 -0700
@@ -74,7 +74,7 @@ proc g77_version { } {
 proc g77_link_flags { paths } {
     global rootme
     global srcdir
-    global ld_library_path
+    global tool
     global G77_UNDER_TEST
 
     set gccpath ${paths}
@@ -110,17 +110,7 @@ proc g77_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.  We really only need to do 
-    # this on IRIX, but it shouldn't hurt to do it anywhere else.
-    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  DYLD_LIBRARY_PATH   $ld_library_path
+    ${tool}_set_ld_library_path $ld_library_path
 
     return "$flags"
 }
--- gcc/testsuite/lib/gcc-defs.exp.shlib	2003-06-05 15:32:55.000000000 -0700
+++ gcc/testsuite/lib/gcc-defs.exp	2004-09-13 09:42:07.804044471 -0700
@@ -217,3 +217,40 @@ 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.
+    # Doing this does cause trouble when testing cross-compilers.
+    if {![is_remote target]} {
+	if [info exists env(LD_LIBRARY_PATH)] {
+	    setenv LD_LIBRARY_PATH "$ld_library_path:$env(LD_LIBRARY_PATH)"
+	} else {
+	    setenv LD_LIBRARY_PATH $ld_library_path
+	}
+	if [info exists env(SHLIB_PATH)] {
+	    setenv SHLIB_PATH "$ld_library_path:$env(SHLIB_PATH)"
+	} else {
+	    setenv SHLIB_PATH $ld_library_path
+	}
+	if [info exists env(LD_LIBRARYN32_PATH)] {
+	    setenv LD_LIBRARYN32_PATH "$ld_library_path:$env(LD_LIBRARYN32_PATH)"
+	} else {
+	    setenv LD_LIBRARYN32_PATH $ld_library_path
+	}
+	if [info exists env(LD_LIBRARY64_PATH)] {
+	    setenv LD_LIBRARY64_PATH "$ld_library_path:$env(LD_LIBRARY64_PATH)"
+	} else {
+	    setenv LD_LIBRARY64_PATH $ld_library_path
+	}
+	if [info exists env(DYLD_LIBRARY_PATH)] {
+	    setenv DYLD_LIBRARY_PATH "$ld_library_path:$env(DYLD_LIBRARY_PATH)"
+	} else {
+	    setenv DYLD_LIBRARY_PATH $ld_library_path
+	}
+    }
+}
--- gcc/testsuite/lib/gcc-dg.exp.shlib	2004-04-12 14:56:16.000000000 -0700
+++ gcc/testsuite/lib/gcc-dg.exp	2004-09-13 09:45:36.204055566 -0700
@@ -19,6 +19,7 @@ load_lib file-format.exp
 load_lib target-supports.exp
 load_lib scanasm.exp
 load_lib prune.exp
+load_lib libgloss.exp
 
 if ![info exists TORTURE_OPTIONS] {
     # It is theoretically beneficial to group all of the O2/O3 options together,
@@ -39,6 +40,30 @@ 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}"
+	}
+    }
+}
+
+global tool
+${tool}_set_ld_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/objc.exp.shlib	2004-02-23 13:25:34.000000000 -0800
+++ gcc/testsuite/lib/objc.exp	2004-09-13 09:49:07.618676253 -0700
@@ -142,7 +142,7 @@ proc objc_target_compile { source dest t
     global srcdir
     global OBJC_UNDER_TEST
     global TOOL_OPTIONS
-    global ld_library_path
+    global tool
     global objc_libgcc_s_path
 
     set ld_library_path ".:${objc_libgcc_s_path}"
@@ -184,17 +184,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.  We really only need to do 
-    # this on IRIX, but it shouldn't hurt to do it anywhere else.
-    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  DYLD_LIBRARY_PATH   $ld_library_path 
+    ${tool}_set_ld_library_path $ld_library_path 
 
     return [target_compile $source $dest $type $options]
 }


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