summaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-11 06:10:49 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-11 06:10:49 +0000
commitf09e052246a6e4c8e40871739a8420e9cf0c3129 (patch)
tree3ae36f07c961c579d1e473b88f00c276ca8cf2e1 /gcc/testsuite
parent1756c1fe34d7ff1f35a00d3cb6a019289a014f7d (diff)
downloadgcc-f09e052246a6e4c8e40871739a8420e9cf0c3129.tar.gz
gcc/testsuite/
PR testsuite/40699 PR testsuite/40707 PR testsuite/40709 * lib/gcc-defs.exp, lib/target-libpath.exp, lib/objc.exp, lib/gfortran.exp, lib/g++.exp, lib/obj-c++.exp, lib/c-torture.exp, lib/gcc-dg.exp, lib/gnat.exp, g++.dg/compat/compat.exp, g++.dg/compat/struct-layout-1.exp: Revert 2009-06-30 commit. libstdc++-v3/ PR testsuite/40699 PR testsuite/40707 PR testsuite/40709 * testsuite/lib/libstdc++.exp: Revert 2009-06-30 commit. libjava/ PR testsuite/40699 PR testsuite/40707 PR testsuite/40709 * testsuite/lib/libjava.exp: Revert 2009-06-30 commit. libgomp/ PR testsuite/40699 PR testsuite/40707 PR testsuite/40709 * testsuite/lib/libgomp.exp: Revert 2009-07-02 and 2009-06-30 commits. * testsuite/libgomp.c/c.exp, testsuite/libgomp.c++/c++.exp, testsuite/libgomp.fortran/fortran.exp: Revert 2009-06-30 commits. libffi/ PR testsuite/40699 PR testsuite/40707 PR testsuite/40709 * testsuite/lib/libffi-dg.exp: Revert 2009-07-02, 2009-07-01 and 2009-06-30 commits. libmudflap/ PR testsuite/40699 PR testsuite/40707 PR testsuite/40709 * testsuite/lib/libmudflap.exp: Revert 2009-06-30 commit. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149508 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog10
-rw-r--r--gcc/testsuite/g++.dg/compat/compat.exp4
-rw-r--r--gcc/testsuite/g++.dg/compat/struct-layout-1.exp4
-rw-r--r--gcc/testsuite/lib/c-torture.exp16
-rw-r--r--gcc/testsuite/lib/g++.exp19
-rw-r--r--gcc/testsuite/lib/gcc-defs.exp32
-rw-r--r--gcc/testsuite/lib/gcc-dg.exp17
-rw-r--r--gcc/testsuite/lib/gfortran.exp9
-rw-r--r--gcc/testsuite/lib/gnat.exp2
-rw-r--r--gcc/testsuite/lib/obj-c++.exp22
-rw-r--r--gcc/testsuite/lib/objc.exp6
-rw-r--r--gcc/testsuite/lib/target-libpath.exp378
12 files changed, 318 insertions, 201 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5cd90abb48f..a29bd83b4dc 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,13 @@
+2009-07-11 Richard Sandiford <rdsandiford@googlemail.com>
+
+ PR testsuite/40699
+ PR testsuite/40707
+ PR testsuite/40709
+ * lib/gcc-defs.exp, lib/target-libpath.exp, lib/objc.exp,
+ lib/gfortran.exp, lib/g++.exp, lib/obj-c++.exp, lib/c-torture.exp,
+ lib/gcc-dg.exp, lib/gnat.exp, g++.dg/compat/compat.exp,
+ g++.dg/compat/struct-layout-1.exp: Revert 2009-06-30 commit.
+
2009-07-11 Tobias Burnus <burnus@net-b.de>
PR fortran/33197
diff --git a/gcc/testsuite/g++.dg/compat/compat.exp b/gcc/testsuite/g++.dg/compat/compat.exp
index 0ca91bfb059..7fb16fed959 100644
--- a/gcc/testsuite/g++.dg/compat/compat.exp
+++ b/gcc/testsuite/g++.dg/compat/compat.exp
@@ -103,14 +103,14 @@ set sid "cp_compat"
# are different.
set use_alt 0
set same_alt 0
-set alt_ld_library_path ""
+set alt_ld_library_path "."
if [info exists ALT_CXX_UNDER_TEST] then {
set use_alt 1
if [string match "same" $ALT_CXX_UNDER_TEST] then {
set same_alt 1
} else {
if [info exists ALT_LD_LIBRARY_PATH] then {
- set alt_ld_library_path $ALT_LD_LIBRARY_PATH
+ append alt_ld_library_path ":${ALT_LD_LIBRARY_PATH}"
}
}
}
diff --git a/gcc/testsuite/g++.dg/compat/struct-layout-1.exp b/gcc/testsuite/g++.dg/compat/struct-layout-1.exp
index f8c26512710..7fa89470e16 100644
--- a/gcc/testsuite/g++.dg/compat/struct-layout-1.exp
+++ b/gcc/testsuite/g++.dg/compat/struct-layout-1.exp
@@ -109,14 +109,14 @@ set sid "cp_compat"
# are different.
set use_alt 0
set same_alt 0
-set alt_ld_library_path ""
+set alt_ld_library_path "."
if [info exists ALT_CXX_UNDER_TEST] then {
set use_alt 1
if [string match "same" $ALT_CXX_UNDER_TEST] then {
set same_alt 1
} else {
if [info exists ALT_LD_LIBRARY_PATH] then {
- set alt_ld_library_path $ALT_LD_LIBRARY_PATH
+ append alt_ld_library_path ":${ALT_LD_LIBRARY_PATH}"
}
}
}
diff --git a/gcc/testsuite/lib/c-torture.exp b/gcc/testsuite/lib/c-torture.exp
index bc14845b2fe..769ec97d3ec 100644
--- a/gcc/testsuite/lib/c-torture.exp
+++ b/gcc/testsuite/lib/c-torture.exp
@@ -54,6 +54,15 @@ if ![info exists GCC_UNDER_TEST] {
set GCC_UNDER_TEST "[find_gcc]"
}
+global orig_environment_saved
+
+# This file may be sourced, so don't override environment settings
+# that have been previously setup.
+if { $orig_environment_saved == 0 } {
+ append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
+ set_ld_library_path_env_vars
+}
+
#
# c-torture-compile -- runs the Tege C-torture test
#
@@ -99,13 +108,6 @@ proc c-torture-compile { src option } {
#
proc c-torture-execute { sources args } {
global tmpdir tool srcdir output compiler_conditional_xfail_data
- global ld_library_path ld_library_path_multilib GCC_UNDER_TEST
-
- if { "$ld_library_path_multilib"
- != "[board_info target multilib_flags]" } {
- set ld_library_path [find_libgcc_s $GCC_UNDER_TEST]
- set_ld_library_path_env_vars
- }
# Use the first source filename given as the filename under test.
set src [lindex $sources 0]
diff --git a/gcc/testsuite/lib/g++.exp b/gcc/testsuite/lib/g++.exp
index f31bbec588a..a5f26800c1c 100644
--- a/gcc/testsuite/lib/g++.exp
+++ b/gcc/testsuite/lib/g++.exp
@@ -106,51 +106,52 @@ proc g++_link_flags { paths } {
set gccpath ${paths}
set libio_dir ""
set flags ""
- set ld_library_path ""
+ set ld_library_path "."
set shlib_ext [get_shlib_extension]
verbose "shared lib extension: $shlib_ext"
if { $gccpath != "" } {
if [file exists "${gccpath}/lib/libstdc++.a"] {
- add_path ld_library_path "${gccpath}/lib"
+ append ld_library_path ":${gccpath}/lib"
}
if [file exists "${gccpath}/libg++/libg++.a"] {
append flags "-L${gccpath}/libg++ "
- add_path ld_library_path "${gccpath}/libg++"
+ append ld_library_path ":${gccpath}/libg++"
}
if [file exists "${gccpath}/libstdc++/libstdc++.a"] {
append flags "-L${gccpath}/libstdc++ "
- add_path ld_library_path "${gccpath}/libstdc++"
+ append ld_library_path ":${gccpath}/libstdc++"
}
if [file exists "${gccpath}/libstdc++-v3/src/.libs/libstdc++.a"] {
append flags " -L${gccpath}/libstdc++-v3/src/.libs "
- add_path ld_library_path "${gccpath}/libstdc++-v3/src/.libs"
+ append ld_library_path ":${gccpath}/libstdc++-v3/src/.libs"
}
# Look for libstdc++.${shlib_ext}.
if [file exists "${gccpath}/libstdc++-v3/src/.libs/libstdc++.${shlib_ext}"] {
append flags " -L${gccpath}/libstdc++-v3/src/.libs "
- add_path ld_library_path "${gccpath}/libstdc++-v3/src/.libs"
+ append ld_library_path ":${gccpath}/libstdc++-v3/src/.libs"
}
+
if [file exists "${gccpath}/libiberty/libiberty.a"] {
append flags "-L${gccpath}/libiberty "
}
if [file exists "${gccpath}/librx/librx.a"] {
append flags "-L${gccpath}/librx "
}
- add_path ld_library_path [find_libgcc_s $GXX_UNDER_TEST]
+ append ld_library_path [gcc-set-multilib-library-path $GXX_UNDER_TEST]
} else {
global tool_root_dir
set libgpp [lookfor_file ${tool_root_dir} libg++]
if { $libgpp != "" } {
append flags "-L${libgpp} "
- add_path ld_library_path ${libgpp}
+ append ld_library_path ":${libgpp}"
}
set libstdcpp [lookfor_file ${tool_root_dir} libstdc++]
if { $libstdcpp != "" } {
append flags "-L${libstdcpp} "
- add_path ld_library_path ${libstdcpp}
+ append ld_library_path ":${libstdcpp}"
}
set libiberty [lookfor_file ${tool_root_dir} libiberty]
if { $libiberty != "" } {
diff --git a/gcc/testsuite/lib/gcc-defs.exp b/gcc/testsuite/lib/gcc-defs.exp
index 0a5d6a38d0d..53926a69a23 100644
--- a/gcc/testsuite/lib/gcc-defs.exp
+++ b/gcc/testsuite/lib/gcc-defs.exp
@@ -233,3 +233,35 @@ proc dg-additional-files-options { options source } {
return $options
}
+
+# Return a colon-separate list of directories to search for libraries
+# for COMPILER, including multilib directories.
+
+proc gcc-set-multilib-library-path { compiler } {
+ global rootme
+
+ # ??? rootme will not be set when testing an installed compiler.
+ # In that case, we should perhaps use some other method to find
+ # libraries.
+ if {![info exists rootme]} {
+ return ""
+ }
+
+ set libpath ":${rootme}"
+ set compiler [lindex $compiler 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 libpath ":${rootme}/${mldir}"
+ }
+ }
+ }
+
+ return $libpath
+}
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index 09b0cf4b49a..7e684171be9 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -65,6 +65,15 @@ if ![info exists GCC_UNDER_TEST] {
set GCC_UNDER_TEST "[find_gcc]"
}
+global orig_environment_saved
+
+# This file may be sourced, so don't override environment settings
+# that have been previously setup.
+if { $orig_environment_saved == 0 } {
+ append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
+ set_ld_library_path_env_vars
+}
+
# Define gcc callbacks for dg.exp.
proc gcc-dg-test-1 { target_compile prog do_what extra_tool_flags } {
@@ -108,14 +117,6 @@ proc gcc-dg-test-1 { target_compile prog do_what extra_tool_flags } {
set output_file "[file rootname [file tail $prog]].o"
}
"run" {
- global ld_library_path ld_library_path_multilib GCC_UNDER_TEST
-
- if { "$ld_library_path_multilib"
- != "[board_info target multilib_flags]" } {
- set ld_library_path [find_libgcc_s $GCC_UNDER_TEST]
- set_ld_library_path_env_vars
- }
-
set compile_type "executable"
# FIXME: "./" is to cope with "." not being in $PATH.
# Should this be handled elsewhere?
diff --git a/gcc/testsuite/lib/gfortran.exp b/gcc/testsuite/lib/gfortran.exp
index 5c35e031d2b..a4d6e2b5d38 100644
--- a/gcc/testsuite/lib/gfortran.exp
+++ b/gcc/testsuite/lib/gfortran.exp
@@ -84,7 +84,7 @@ proc gfortran_link_flags { paths } {
set gccpath ${paths}
set libio_dir ""
set flags ""
- set ld_library_path ""
+ set ld_library_path "."
set shlib_ext [get_shlib_extension]
verbose "shared lib extension: $shlib_ext"
@@ -94,11 +94,11 @@ proc gfortran_link_flags { paths } {
# for uninstalled testing.
append flags "-B${gccpath}/libgfortran/.libs "
append flags "-L${gccpath}/libgfortran/.libs "
- add_path ld_library_path "${gccpath}/libgfortran/.libs"
+ append ld_library_path ":${gccpath}/libgfortran/.libs"
}
if [file exists "${gccpath}/libgfortran/.libs/libgfortran.${shlib_ext}"] {
append flags "-L${gccpath}/libgfortran/.libs "
- add_path ld_library_path "${gccpath}/libgfortran/.libs"
+ append ld_library_path ":${gccpath}/libgfortran/.libs"
}
if [file exists "${gccpath}/libgfortran/libgforbegin.a"] {
append flags "-L${gccpath}/libgfortran "
@@ -106,7 +106,8 @@ proc gfortran_link_flags { paths } {
if [file exists "${gccpath}/libiberty/libiberty.a"] {
append flags "-L${gccpath}/libiberty "
}
- add_path ld_library_path [find_libgcc_s $GFORTRAN_UNDER_TEST]
+ append ld_library_path \
+ [gcc-set-multilib-library-path $GFORTRAN_UNDER_TEST]
}
set_ld_library_path_env_vars
diff --git a/gcc/testsuite/lib/gnat.exp b/gcc/testsuite/lib/gnat.exp
index bb95487e8bd..35e18da93d2 100644
--- a/gcc/testsuite/lib/gnat.exp
+++ b/gcc/testsuite/lib/gnat.exp
@@ -147,7 +147,7 @@ proc gnat_target_compile { source dest type options } {
set GNAT_UNDER_TEST "$GNAT_UNDER_TEST_ORIG $gnat_rts_opt"
}
- set ld_library_path ${gnat_libgcc_s_path}
+ set ld_library_path ".:${gnat_libgcc_s_path}"
lappend options "compiler=$GNAT_UNDER_TEST -q -f"
lappend options "timeout=[timeout_value]"
diff --git a/gcc/testsuite/lib/obj-c++.exp b/gcc/testsuite/lib/obj-c++.exp
index 4feb8c178c8..b61dc556437 100644
--- a/gcc/testsuite/lib/obj-c++.exp
+++ b/gcc/testsuite/lib/obj-c++.exp
@@ -106,30 +106,30 @@ proc obj-c++_link_flags { paths } {
set gccpath ${paths}
set libio_dir ""
set flags ""
- set ld_library_path ""
+ set ld_library_path "."
set shlib_ext [get_shlib_extension]
verbose "shared lib extension: $shlib_ext"
if { $gccpath != "" } {
if [file exists "${gccpath}/lib/libstdc++.a"] {
- add_path ld_library_path "${gccpath}/lib"
+ append ld_library_path ":${gccpath}/lib"
}
if [file exists "${gccpath}/libg++/libg++.a"] {
append flags "-L${gccpath}/libg++ "
- add_path ld_library_path "${gccpath}/libg++"
+ append ld_library_path ":${gccpath}/libg++"
}
if [file exists "${gccpath}/libstdc++/libstdc++.a"] {
append flags "-L${gccpath}/libstdc++ "
- add_path ld_library_path "${gccpath}/libstdc++"
+ append ld_library_path ":${gccpath}/libstdc++"
}
if [file exists "${gccpath}/libstdc++-v3/src/.libs/libstdc++.a"] {
append flags " -L${gccpath}/libstdc++-v3/src/.libs "
- add_path ld_library_path "${gccpath}/libstdc++-v3/src/.libs"
+ append ld_library_path ":${gccpath}/libstdc++-v3/src/.libs"
}
# Look for libstdc++.${shlib_ext}.
if [file exists "${gccpath}/libstdc++-v3/src/.libs/libstdc++.${shlib_ext}"] {
append flags " -L${gccpath}/libstdc++-v3/src/.libs "
- add_path ld_library_path "${gccpath}/libstdc++-v3/src/.libs"
+ append ld_library_path ":${gccpath}/libstdc++-v3/src/.libs"
}
if [file exists "${gccpath}/libiberty/libiberty.a"] {
append flags "-L${gccpath}/libiberty "
@@ -158,21 +158,23 @@ proc obj-c++_link_flags { paths } {
if { $libobjc_dir != "" } {
set libobjc_dir [file dirname ${libobjc_dir}]
append flags "-L${libobjc_dir}"
- add_path ld_library_path ${libobjc_dir}
+ append ld_library_path ":${libobjc_dir}"
}
- add_path ld_library_path [find_libgcc_s $OBJCXX_UNDER_TEST]
+ append ld_library_path \
+ [gcc-set-multilib-library-path $OBJCXX_UNDER_TEST]
+
} else {
global tool_root_dir;
set libgpp [lookfor_file ${tool_root_dir} libg++];
if { $libgpp != "" } {
append flags "-L${libgpp} ";
- add_path ld_library_path ${libgpp}
+ append ld_library_path ":${libgpp}"
}
set libstdcpp [lookfor_file ${tool_root_dir} libstdc++];
if { $libstdcpp != "" } {
append flags "-L${libstdcpp} ";
- add_path ld_library_path ${libstdcpp}
+ append ld_library_path ":${libstdcpp}"
}
set libiberty [lookfor_file ${tool_root_dir} libiberty];
if { $libiberty != "" } {
diff --git a/gcc/testsuite/lib/objc.exp b/gcc/testsuite/lib/objc.exp
index c0eeb02bd93..934f31dabdc 100644
--- a/gcc/testsuite/lib/objc.exp
+++ b/gcc/testsuite/lib/objc.exp
@@ -121,7 +121,7 @@ proc objc_init { args } {
objc_maybe_build_wrapper "${tmpdir}/objc-testglue.o"
- set objc_libgcc_s_path [find_libgcc_s $OBJC_UNDER_TEST]
+ set objc_libgcc_s_path [gcc-set-multilib-library-path $OBJC_UNDER_TEST]
}
proc objc_target_compile { source dest type options } {
@@ -135,7 +135,7 @@ proc objc_target_compile { source dest type options } {
global objc_libgcc_s_path
global shlib_ext
- set ld_library_path ${objc_libgcc_s_path}
+ set ld_library_path ".:${objc_libgcc_s_path}"
lappend options "libs=-lobjc"
set shlib_ext [get_shlib_extension]
verbose "shared lib extension: $shlib_ext"
@@ -191,7 +191,7 @@ proc objc_target_compile { source dest type options } {
set libobjc_dir [file dirname ${libobjc_dir}]
set objc_link_flags "-L${libobjc_dir}"
lappend options "additional_flags=${objc_link_flags}"
- add_path ld_library_path ${libobjc_dir}
+ append ld_library_path ":${libobjc_dir}"
}
if { $type == "precompiled_header" } {
# If we generating a precompiled header, we have say this is an
diff --git a/gcc/testsuite/lib/target-libpath.exp b/gcc/testsuite/lib/target-libpath.exp
index 49accd09687..6a01d9498e7 100644
--- a/gcc/testsuite/lib/target-libpath.exp
+++ b/gcc/testsuite/lib/target-libpath.exp
@@ -16,106 +16,175 @@
# This file was contributed by John David Anglin (dave.anglin@nrc-cnrc.gc.ca)
-# A list of ld library path environment variables that might need to be
-# defined.
-#
-# Some variables represent ABI-specific paths, and if these variables
-# aren't defined, the dynamic loader might fall back on a more general
-# variable. We must do the same when trying to read the current setting
-# of such a path. Each element of this list is therefore itself a list:
-# the first element of each sublist specifies the name of the variable,
-# and the other elements specify fallback alternatives. We use FOO as a
-# shorthand for { FOO }.
-set ld_library_path_vars {
- LD_LIBRARY_PATH
- LD_RUN_PATH
- SHLIB_PATH
- { LD_LIBRARYN32_PATH LD_LIBRARY_PATH }
- { LD_LIBRARY64_PATH LD_LIBRARY_PATH }
- { LD_LIBRARY_PATH_32 LD_LIBRARY_PATH }
- { LD_LIBRARY_PATH_64 LD_LIBRARY_PATH }
- DYLD_LIBRARY_PATH
-}
-
-# Set up the global orig_FOO_saved variables. We define this as a function
-# to avoid polluting the global namespace with local variables.
-proc init_ld_library_path_env_vars { } {
- global ld_library_path_vars
-
- foreach spec $ld_library_path_vars {
- set var orig_[string tolower [lindex $spec 0]]_saved
- global $var
- set $var 0
- }
-}
-init_ld_library_path_env_vars
set orig_environment_saved 0
+set orig_ld_library_path_saved 0
+set orig_ld_run_path_saved 0
+set orig_shlib_path_saved 0
+set orig_ld_libraryn32_path_saved 0
+set orig_ld_library64_path_saved 0
+set orig_ld_library_path_32_saved 0
+set orig_ld_library_path_64_saved 0
+set orig_dyld_library_path_saved 0
set orig_gcc_exec_prefix_saved 0
set orig_gcc_exec_prefix_checked 0
-set ld_library_path_multilib unset
+
#######################################
# proc set_ld_library_path_env_vars { }
#######################################
proc set_ld_library_path_env_vars { } {
- global ld_library_path
- global orig_environment_saved
- global ld_library_path_vars
- global orig_gcc_exec_prefix_saved
- global orig_gcc_exec_prefix_checked
- global orig_gcc_exec_prefix
- global TEST_GCC_EXEC_PREFIX
- global ld_library_path_multilib
- global env
-
- # Save the original GCC_EXEC_PREFIX.
- if { $orig_gcc_exec_prefix_checked == 0 } {
- if [info exists env(GCC_EXEC_PREFIX)] {
- set orig_gcc_exec_prefix "$env(GCC_EXEC_PREFIX)"
- set orig_gcc_exec_prefix_saved 1
- }
- set orig_gcc_exec_prefix_checked 1
- }
+ global ld_library_path
+ global orig_environment_saved
+ global orig_ld_library_path_saved
+ global orig_ld_run_path_saved
+ global orig_shlib_path_saved
+ global orig_ld_libraryn32_path_saved
+ global orig_ld_library64_path_saved
+ global orig_ld_library_path_32_saved
+ global orig_ld_library_path_64_saved
+ global orig_dyld_library_path_saved
+ global orig_gcc_exec_prefix_saved
+ global orig_gcc_exec_prefix_checked
+ global orig_ld_library_path
+ global orig_ld_run_path
+ global orig_shlib_path
+ global orig_ld_libraryn32_path
+ global orig_ld_library64_path
+ global orig_ld_library_path_32
+ global orig_ld_library_path_64
+ global orig_dyld_library_path
+ global orig_gcc_exec_prefix
+ global TEST_GCC_EXEC_PREFIX
+ global env
- # Set GCC_EXEC_PREFIX for the compiler under test to pick up files not in
- # the build tree from a specified location (normally the install tree).
- if [info exists TEST_GCC_EXEC_PREFIX] {
- setenv GCC_EXEC_PREFIX "$TEST_GCC_EXEC_PREFIX"
+ # Save the original GCC_EXEC_PREFIX.
+ if { $orig_gcc_exec_prefix_checked == 0 } {
+ if [info exists env(GCC_EXEC_PREFIX)] {
+ set orig_gcc_exec_prefix "$env(GCC_EXEC_PREFIX)"
+ set orig_gcc_exec_prefix_saved 1
}
+ set orig_gcc_exec_prefix_checked 1
+ }
- # Setting the ld library path causes trouble when testing cross-compilers.
- if { [is_remote target] } {
- return
- }
+ # Set GCC_EXEC_PREFIX for the compiler under test to pick up files not in
+ # the build tree from a specified location (normally the install tree).
+ if [info exists TEST_GCC_EXEC_PREFIX] {
+ setenv GCC_EXEC_PREFIX "$TEST_GCC_EXEC_PREFIX"
+ }
- set ld_library_path_multilib [board_info target multilib_flags]
-
- foreach spec $ld_library_path_vars {
- set var [lindex $spec 0]
- set lvar [string tolower $var]
-
- global orig_$lvar
- global orig_${lvar}_saved
-
- if { $orig_environment_saved == 0 } {
- if [info exists env($var)] {
- set orig_$lvar [set env($var)]
- set orig_${lvar}_saved 1
- }
- }
- set value $ld_library_path
- foreach extra $spec {
- set lextra [string tolower $extra]
- if [set orig_${lextra}_saved] {
- add_path value [set orig_$lextra]
- break
- }
- }
- setenv $var $value
- }
+ # Setting the ld library path causes trouble when testing cross-compilers.
+ if { [is_remote target] } {
+ return
+ }
+
+ if { $orig_environment_saved == 0 } {
set orig_environment_saved 1
- verbose -log "set_ld_library_path_env_vars: ld_library_path=$ld_library_path"
+
+ # Save the original environment.
+ if [info exists env(LD_LIBRARY_PATH)] {
+ set orig_ld_library_path "$env(LD_LIBRARY_PATH)"
+ set orig_ld_library_path_saved 1
+ }
+ if [info exists env(LD_RUN_PATH)] {
+ set orig_ld_run_path "$env(LD_RUN_PATH)"
+ set orig_ld_run_path_saved 1
+ }
+ if [info exists env(SHLIB_PATH)] {
+ set orig_shlib_path "$env(SHLIB_PATH)"
+ set orig_shlib_path_saved 1
+ }
+ if [info exists env(LD_LIBRARYN32_PATH)] {
+ set orig_ld_libraryn32_path "$env(LD_LIBRARYN32_PATH)"
+ set orig_ld_libraryn32_path_saved 1
+ }
+ if [info exists env(LD_LIBRARY64_PATH)] {
+ set orig_ld_library64_path "$env(LD_LIBRARY64_PATH)"
+ set orig_ld_library64_path_saved 1
+ }
+ if [info exists env(LD_LIBRARY_PATH_32)] {
+ set orig_ld_library_path_32 "$env(LD_LIBRARY_PATH_32)"
+ set orig_ld_library_path_32_saved 1
+ }
+ if [info exists env(LD_LIBRARY_PATH_64)] {
+ set orig_ld_library_path_64 "$env(LD_LIBRARY_PATH_64)"
+ set orig_ld_library_path_64_saved 1
+ }
+ if [info exists env(DYLD_LIBRARY_PATH)] {
+ set orig_dyld_library_path "$env(DYLD_LIBRARY_PATH)"
+ set orig_dyld_library_path_saved 1
+ }
+ }
+
+ # We need to set ld library path in the environment. Currently,
+ # unix.exp doesn't set the environment correctly for all systems.
+ # It only sets SHLIB_PATH and LD_LIBRARY_PATH when it executes a
+ # program. We also need the environment set for compilations, etc.
+ #
+ # 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 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). In some cases, the variables are independent
+ # of LD_LIBRARY_PATH, and in other cases LD_LIBRARY_PATH is used if the
+ # variable is not defined.
+ #
+ # Doing this is somewhat of a hack as ld_library_path gets repeated in
+ # SHLIB_PATH and LD_LIBRARY_PATH when unix_load sets these variables.
+ if { $orig_ld_library_path_saved } {
+ setenv LD_LIBRARY_PATH "$ld_library_path:$orig_ld_library_path"
+ } else {
+ setenv LD_LIBRARY_PATH "$ld_library_path"
+ }
+ if { $orig_ld_run_path_saved } {
+ setenv LD_RUN_PATH "$ld_library_path:$orig_ld_run_path"
+ } else {
+ setenv LD_RUN_PATH "$ld_library_path"
+ }
+ # The default shared library dynamic path search for 64-bit
+ # HP-UX executables searches LD_LIBRARY_PATH before SHLIB_PATH.
+ # LD_LIBRARY_PATH isn't used for 32-bit executables. Thus, we
+ # set LD_LIBRARY_PATH and SHLIB_PATH as if they were independent.
+ if { $orig_shlib_path_saved } {
+ setenv SHLIB_PATH "$ld_library_path:$orig_shlib_path"
+ } else {
+ setenv SHLIB_PATH "$ld_library_path"
+ }
+ if { $orig_ld_libraryn32_path_saved } {
+ setenv LD_LIBRARYN32_PATH "$ld_library_path:$orig_ld_libraryn32_path"
+ } elseif { $orig_ld_library_path_saved } {
+ setenv LD_LIBRARYN32_PATH "$ld_library_path:$orig_ld_library_path"
+ } else {
+ setenv LD_LIBRARYN32_PATH "$ld_library_path"
+ }
+ if { $orig_ld_library64_path_saved } {
+ setenv LD_LIBRARY64_PATH "$ld_library_path:$orig_ld_library64_path"
+ } elseif { $orig_ld_library_path_saved } {
+ setenv LD_LIBRARY64_PATH "$ld_library_path:$orig_ld_library_path"
+ } else {
+ setenv LD_LIBRARY64_PATH "$ld_library_path"
+ }
+ if { $orig_ld_library_path_32_saved } {
+ setenv LD_LIBRARY_PATH_32 "$ld_library_path:$orig_ld_library_path_32"
+ } elseif { $orig_ld_library_path_saved } {
+ setenv LD_LIBRARY_PATH_32 "$ld_library_path:$orig_ld_library_path"
+ } else {
+ setenv LD_LIBRARY_PATH_32 "$ld_library_path"
+ }
+ if { $orig_ld_library_path_64_saved } {
+ setenv LD_LIBRARY_PATH_64 "$ld_library_path:$orig_ld_library_path_64"
+ } elseif { $orig_ld_library_path_saved } {
+ setenv LD_LIBRARY_PATH_64 "$ld_library_path:$orig_ld_library_path"
+ } else {
+ setenv LD_LIBRARY_PATH_64 "$ld_library_path"
+ }
+ if { $orig_dyld_library_path_saved } {
+ setenv DYLD_LIBRARY_PATH "$ld_library_path:$orig_dyld_library_path"
+ } else {
+ setenv DYLD_LIBRARY_PATH "$ld_library_path"
+ }
+
+ verbose -log "set_ld_library_path_env_vars: ld_library_path=$ld_library_path"
}
#######################################
@@ -123,35 +192,77 @@ proc set_ld_library_path_env_vars { } {
#######################################
proc restore_ld_library_path_env_vars { } {
- global orig_environment_saved
- global ld_library_path_vars
- global orig_gcc_exec_prefix_saved
- global orig_gcc_exec_prefix
- global env
-
- if { $orig_gcc_exec_prefix_saved } {
- setenv GCC_EXEC_PREFIX "$orig_gcc_exec_prefix"
- } elseif [info exists env(GCC_EXEC_PREFIX)] {
- unsetenv GCC_EXEC_PREFIX
- }
+ global orig_environment_saved
+ global orig_ld_library_path_saved
+ global orig_ld_run_path_saved
+ global orig_shlib_path_saved
+ global orig_ld_libraryn32_path_saved
+ global orig_ld_library64_path_saved
+ global orig_ld_library_path_32_saved
+ global orig_ld_library_path_64_saved
+ global orig_dyld_library_path_saved
+ global orig_gcc_exec_prefix_saved
+ global orig_ld_library_path
+ global orig_ld_run_path
+ global orig_shlib_path
+ global orig_ld_libraryn32_path
+ global orig_ld_library64_path
+ global orig_ld_library_path_32
+ global orig_ld_library_path_64
+ global orig_dyld_library_path
+ global orig_gcc_exec_prefix
+ global env
- if { $orig_environment_saved == 0 } {
- return
- }
-
- foreach spec $ld_library_path_vars {
- set var [lindex $spec 0]
- set lvar [string tolower $var]
+ if { $orig_gcc_exec_prefix_saved } {
+ setenv GCC_EXEC_PREFIX "$orig_gcc_exec_prefix"
+ } elseif [info exists env(GCC_EXEC_PREFIX)] {
+ unsetenv GCC_EXEC_PREFIX
+ }
- global orig_$lvar
- global orig_${lvar}_saved
+ if { $orig_environment_saved == 0 } {
+ return
+ }
- if [set orig_${lvar}_saved] {
- setenv $var [set orig_$lvar]
- } elseif [info exists env($var)] {
- unsetenv $var
- }
- }
+ if { $orig_ld_library_path_saved } {
+ setenv LD_LIBRARY_PATH "$orig_ld_library_path"
+ } elseif [info exists env(LD_LIBRARY_PATH)] {
+ unsetenv LD_LIBRARY_PATH
+ }
+ if { $orig_ld_run_path_saved } {
+ setenv LD_RUN_PATH "$orig_ld_run_path"
+ } elseif [info exists env(LD_RUN_PATH)] {
+ unsetenv LD_RUN_PATH
+ }
+ if { $orig_shlib_path_saved } {
+ setenv SHLIB_PATH "$orig_shlib_path"
+ } elseif [info exists env(SHLIB_PATH)] {
+ unsetenv SHLIB_PATH
+ }
+ if { $orig_ld_libraryn32_path_saved } {
+ setenv LD_LIBRARYN32_PATH "$orig_ld_libraryn32_path"
+ } elseif [info exists env(LD_LIBRARYN32_PATH)] {
+ unsetenv LD_LIBRARYN32_PATH
+ }
+ if { $orig_ld_library64_path_saved } {
+ setenv LD_LIBRARY64_PATH "$orig_ld_library64_path"
+ } elseif [info exists env(LD_LIBRARY64_PATH)] {
+ unsetenv LD_LIBRARY64_PATH
+ }
+ if { $orig_ld_library_path_32_saved } {
+ setenv LD_LIBRARY_PATH_32 "$orig_ld_library_path_32"
+ } elseif [info exists env(LD_LIBRARY_PATH_32)] {
+ unsetenv LD_LIBRARY_PATH_32
+ }
+ if { $orig_ld_library_path_64_saved } {
+ setenv LD_LIBRARY_PATH_64 "$orig_ld_library_path_64"
+ } elseif [info exists env(LD_LIBRARY_PATH_64)] {
+ unsetenv LD_LIBRARY_PATH_64
+ }
+ if { $orig_dyld_library_path_saved } {
+ setenv DYLD_LIBRARY_PATH "$orig_dyld_library_path"
+ } elseif [info exists env(DYLD_LIBRARY_PATH)] {
+ unsetenv DYLD_LIBRARY_PATH
+ }
}
#######################################
@@ -173,46 +284,3 @@ proc get_shlib_extension { } {
return $shlib_ext
}
-# If DIR is not an empty string, add it to the end of variable UPPATH,
-# which represents a colon-separated path.
-proc add_path { uppath dir } {
- upvar $uppath path
-
- if { $dir != "" } {
- if { [info exists path] && $path != "" } {
- append path ":"
- }
- append path $dir
- }
-}
-
-# Return the directory that contains the shared libgcc for this multilib,
-# or "" if we don't know.
-proc find_libgcc_s { compiler } {
- # Remote host testing requires an installed compiler (get_multilibs
- # imposes the same restriction). It is up to the board file or
- # tester to make sure that the installed compiler's libraries
- # can be found in the library path.
- if { [is_remote host] } {
- return ""
- }
- # The same goes if we can't find the compiler.
- set compiler_path [which [lindex $compiler 0]]
- if { $compiler_path == "" } {
- return ""
- }
- # Run the compiler with the current multilib flags to get the
- # relative multilib directory.
- set subdir [eval exec $compiler [board_info target multilib_flags] \
- --print-multi-directory]
- # We are only interested in cases where libgcc_s is in the same
- # directory as the compiler itself.
- set dir [file dirname $compiler_path]
- if { $subdir != "." } {
- set dir [file join $dir $subdir]
- }
- if { ![file exists $dir] } {
- return ""
- }
- return $dir
-}