]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/gcc-tumbl.git/commitdiff
gcc/testsuite/
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 30 Jun 2009 18:37:57 +0000 (18:37 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 30 Jun 2009 18:37:57 +0000 (18:37 +0000)
* lib/gcc-defs.exp (gcc-set-multilib-library-path): Delete.
* lib/target-libpath.exp (ld_library_path_vars): New variable.
(init_ld_library_path_env_vars): New function, replacing the
orig_*_saved assignments.  Call it after defining it.
(set_ld_library_path_env_vars): Rewrite to use ld_library_path_vars.
(restore_ld_library_path_env_vars): Likewise.
(add_path, find_libgcc_s): New functions.
* lib/objc.exp (objc_init): Use find_libgcc_s instead of
gcc-set-multilib-library-path.
(objc_target_compile): Don't add "." to ld_library_path.
Use add_path.
* lib/gfortran.exp (gfortran_link_flags): Don't add "." to
ld_library_path.  Use add_path.  Use find_libgcc_s instead of
gcc-set-multilib-library-path.
* lib/g++.exp (g++_link_flags): Likewise.
* lib/obj-c++.exp (obj-c++_link_flags): Likewise.
* lib/c-torture.exp: Do not manipulate ld_library_path at the
top level; do it...
(c-torture-execute): ...here instead.  Use $ld_library_path_multilib
to tell when this needs to happen.  Use find_libgcc_s instead of
gcc-set-multilib-library-path.
* lib/gcc-dg.exp: Likewise.
* lib/gnat.exp (gnat_target_compile): Don't add "." to ld_library_path.
* g++.dg/compat/compat.exp (alt_ld_library_path): Don't add "."
unless it is in $ALT_LD_LIBRARY_PATH.
* g++.dg/compat/struct-layout-1.exp (alt_ld_library_path): Likewise.

libffi/
* testsuite/lib/libffi-dg.exp (libffi-init): Don't add "."
to ld_library_path.  Use add_path.  Add just find_libgcc_s
to ld_library_path, not every libgcc multilib directory.

libgomp/
* testsuite/lib/libgomp.exp (libgomp_init): Don't add "." to
ld_library_path.  Use add_path.  Add just find_libgcc_s to
ld_library_path, not every libgcc multilib directory.
* testsuite/libgomp.c/c.exp (ld_library_path): Don't call
gcc-set-multilib-library-path; rely on $always_ld_library_path instead.
* testsuite/libgomp.c++/c++.exp (ld_library_path): Likewise.
Use add_path.
* testsuite/libgomp.fortran/fortran.exp (ld_library_path): Likewise.

libjava/
* testsuite/lib/libjava.exp (libjava_init): Just add
find_libgcc_s to libjava_libgcc_s_path, rather than every
libgcc multilib directory.
(libjava_arguments): Explain why we add "." to ld_library_path.
(gcj_invoke, exec_gij, libjava_invoke): Use add_path.

libmudflap/
* testsuite/lib/libmudflap.exp (libmudflap-init): Don't add "."
to ld_library_path.  Use add_path.  Add just find_libgcc_s to
ld_library_path, not every libgcc multilib directory.

libstdc++-v3/
* testsuite/lib/libstdc++.exp (libstdc++_init): Don't add "."
to ld_library_path.  Use add_path.  Add just find_libgcc_s to
ld_library_path, not every libgcc multilib directory.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149113 138bc75d-0d04-0410-961f-82ee72b054a4

25 files changed:
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/compat/compat.exp
gcc/testsuite/g++.dg/compat/struct-layout-1.exp
gcc/testsuite/lib/c-torture.exp
gcc/testsuite/lib/g++.exp
gcc/testsuite/lib/gcc-defs.exp
gcc/testsuite/lib/gcc-dg.exp
gcc/testsuite/lib/gfortran.exp
gcc/testsuite/lib/gnat.exp
gcc/testsuite/lib/obj-c++.exp
gcc/testsuite/lib/objc.exp
gcc/testsuite/lib/target-libpath.exp
libffi/ChangeLog
libffi/testsuite/lib/libffi-dg.exp
libgomp/ChangeLog
libgomp/testsuite/lib/libgomp.exp
libgomp/testsuite/libgomp.c++/c++.exp
libgomp/testsuite/libgomp.c/c.exp
libgomp/testsuite/libgomp.fortran/fortran.exp
libjava/ChangeLog
libjava/testsuite/lib/libjava.exp
libmudflap/ChangeLog
libmudflap/testsuite/lib/libmudflap.exp
libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/lib/libstdc++.exp

index 578be4d59b04d34a985624ddbd0f197ff052a5c5..8287bbb918dc320cdd75955a9f46be1697769744 100644 (file)
@@ -1,3 +1,32 @@
+2009-06-30  Richard Sandiford  <r.sandiford@uk.ibm.com>
+
+       * lib/gcc-defs.exp (gcc-set-multilib-library-path): Delete.
+       * lib/target-libpath.exp (ld_library_path_vars): New variable.
+       (init_ld_library_path_env_vars): New function, replacing the
+       orig_*_saved assignments.  Call it after defining it.
+       (set_ld_library_path_env_vars): Rewrite to use ld_library_path_vars.
+       (restore_ld_library_path_env_vars): Likewise.
+       (add_path, find_libgcc_s): New functions.
+       * lib/objc.exp (objc_init): Use find_libgcc_s instead of
+       gcc-set-multilib-library-path.
+       (objc_target_compile): Don't add "." to ld_library_path.
+       Use add_path.
+       * lib/gfortran.exp (gfortran_link_flags): Don't add "." to
+       ld_library_path.  Use add_path.  Use find_libgcc_s instead of
+       gcc-set-multilib-library-path.
+       * lib/g++.exp (g++_link_flags): Likewise.
+       * lib/obj-c++.exp (obj-c++_link_flags): Likewise.
+       * lib/c-torture.exp: Do not manipulate ld_library_path at the
+       top level; do it...
+       (c-torture-execute): ...here instead.  Use $ld_library_path_multilib
+       to tell when this needs to happen.  Use find_libgcc_s instead of
+       gcc-set-multilib-library-path.
+       * lib/gcc-dg.exp: Likewise.
+       * lib/gnat.exp (gnat_target_compile): Don't add "." to ld_library_path.
+       * g++.dg/compat/compat.exp (alt_ld_library_path): Don't add "."
+       unless it is in $ALT_LD_LIBRARY_PATH.
+       * g++.dg/compat/struct-layout-1.exp (alt_ld_library_path): Likewise.
+
 2009-06-30  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat.dg/discr12.adb: New test.
index 7fb16fed95930f1ff6aefc38f02d8eda64d5d43e..0ca91bfb05939dbf5d4565b2a4798bb35b8f6224 100644 (file)
@@ -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 {
-           append alt_ld_library_path ":${ALT_LD_LIBRARY_PATH}"
+           set alt_ld_library_path $ALT_LD_LIBRARY_PATH
        }
     }
 }
index 7fa89470e16e1a67246ff762cfbe1d8b90fda5e4..f8c26512710bc437cfacac77993c1b03fc21604f 100644 (file)
@@ -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 {
-           append alt_ld_library_path ":${ALT_LD_LIBRARY_PATH}"
+           set alt_ld_library_path $ALT_LD_LIBRARY_PATH
        }
     }
 }
index 769ec97d3eccfd8cdd82f6cd19036901f1c41bea..bc14845b2fe2a73b38a7b1799642c2891e9fe0a7 100644 (file)
@@ -54,15 +54,6 @@ 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
 #
@@ -108,6 +99,13 @@ 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]
index a5f26800c1c27d8cc85e54714ae77607eab2e49f..f31bbec588ae3ab960d16fbbb3a0ca59d2e0c3a6 100644 (file)
@@ -106,52 +106,51 @@ 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"] {
-          append ld_library_path ":${gccpath}/lib"
+         add_path ld_library_path "${gccpath}/lib"
       }
       if [file exists "${gccpath}/libg++/libg++.a"] {
           append flags "-L${gccpath}/libg++ "
-          append ld_library_path ":${gccpath}/libg++"
+         add_path ld_library_path "${gccpath}/libg++"
       }
       if [file exists "${gccpath}/libstdc++/libstdc++.a"] {
           append flags "-L${gccpath}/libstdc++ "
-          append ld_library_path ":${gccpath}/libstdc++"
+         add_path ld_library_path "${gccpath}/libstdc++"
       }
       if [file exists "${gccpath}/libstdc++-v3/src/.libs/libstdc++.a"] {
           append flags " -L${gccpath}/libstdc++-v3/src/.libs "
-          append ld_library_path ":${gccpath}/libstdc++-v3/src/.libs"
+         add_path 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 "
-         append ld_library_path ":${gccpath}/libstdc++-v3/src/.libs"
+         add_path 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 "
       }
-      append ld_library_path [gcc-set-multilib-library-path $GXX_UNDER_TEST]
+      add_path ld_library_path [find_libgcc_s $GXX_UNDER_TEST]
     } else {
       global tool_root_dir
 
       set libgpp [lookfor_file ${tool_root_dir} libg++]
       if { $libgpp != "" } {
           append flags "-L${libgpp} "
-          append ld_library_path ":${libgpp}"
+         add_path ld_library_path ${libgpp}
       }
       set libstdcpp [lookfor_file ${tool_root_dir} libstdc++]
       if { $libstdcpp != "" } {
           append flags "-L${libstdcpp} "
-          append ld_library_path ":${libstdcpp}"
+         add_path ld_library_path ${libstdcpp}
       }
       set libiberty [lookfor_file ${tool_root_dir} libiberty]
       if { $libiberty != "" } {
index 53926a69a232a0a063d174057c4a6ed7052fa2b3..0a5d6a38d0d95d9ba03d7ea18f996dfad948223f 100644 (file)
@@ -233,35 +233,3 @@ 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
-}
index 7e684171be9266c4880c58f655bacef944cd139d..09b0cf4b49a72001eef3b6356a16d60c61fdf380 100644 (file)
@@ -65,15 +65,6 @@ 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 } {
@@ -117,6 +108,14 @@ 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?
index a4d6e2b5d38aa52daa801ac22da07128e79a69ee..5c35e031d2b492d0c2140b88293eab6965a697d4 100644 (file)
@@ -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 "
-          append ld_library_path ":${gccpath}/libgfortran/.libs"
+         add_path ld_library_path "${gccpath}/libgfortran/.libs"
       }
       if [file exists "${gccpath}/libgfortran/.libs/libgfortran.${shlib_ext}"] {
          append flags "-L${gccpath}/libgfortran/.libs "
-         append ld_library_path ":${gccpath}/libgfortran/.libs"
+         add_path ld_library_path "${gccpath}/libgfortran/.libs"
       }
       if [file exists "${gccpath}/libgfortran/libgforbegin.a"] {
           append flags "-L${gccpath}/libgfortran "
@@ -106,8 +106,7 @@ proc gfortran_link_flags { paths } {
       if [file exists "${gccpath}/libiberty/libiberty.a"] {
           append flags "-L${gccpath}/libiberty "
       }
-      append ld_library_path \
-       [gcc-set-multilib-library-path $GFORTRAN_UNDER_TEST]
+      add_path ld_library_path [find_libgcc_s $GFORTRAN_UNDER_TEST]
     }
 
     set_ld_library_path_env_vars
index 35e18da93d2caf916e3e9a0ade68bec99f4e49aa..bb95487e8bd656e229dddf543c74ad8579214e3a 100644 (file)
@@ -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]"
 
index b61dc556437a3f17c0922ddb399cea342ef211fc..4feb8c178c8f36710c31c32b4d0ed2543cc03469 100644 (file)
@@ -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"] {
-          append ld_library_path ":${gccpath}/lib"
+         add_path ld_library_path "${gccpath}/lib"
       }
       if [file exists "${gccpath}/libg++/libg++.a"] {
           append flags "-L${gccpath}/libg++ "
-          append ld_library_path ":${gccpath}/libg++"
+         add_path ld_library_path "${gccpath}/libg++"
       }
       if [file exists "${gccpath}/libstdc++/libstdc++.a"] {
           append flags "-L${gccpath}/libstdc++ "
-          append ld_library_path ":${gccpath}/libstdc++"
+         add_path ld_library_path "${gccpath}/libstdc++"
       }
       if [file exists "${gccpath}/libstdc++-v3/src/.libs/libstdc++.a"] {
           append flags " -L${gccpath}/libstdc++-v3/src/.libs "
-          append ld_library_path ":${gccpath}/libstdc++-v3/src/.libs"
+         add_path 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 "
-         append ld_library_path ":${gccpath}/libstdc++-v3/src/.libs"
+         add_path ld_library_path "${gccpath}/libstdc++-v3/src/.libs"
       }
       if [file exists "${gccpath}/libiberty/libiberty.a"] {
           append flags "-L${gccpath}/libiberty "
@@ -158,23 +158,21 @@ proc obj-c++_link_flags { paths } {
       if { $libobjc_dir != "" } {
          set libobjc_dir [file dirname ${libobjc_dir}]
          append flags "-L${libobjc_dir}"
-         append ld_library_path ":${libobjc_dir}"
+         add_path ld_library_path ${libobjc_dir}
       }
-      append ld_library_path \
-         [gcc-set-multilib-library-path $OBJCXX_UNDER_TEST]
-
+      add_path ld_library_path [find_libgcc_s $OBJCXX_UNDER_TEST]
     } else {
       global tool_root_dir;
 
       set libgpp [lookfor_file ${tool_root_dir} libg++];
       if { $libgpp != "" } {
           append flags "-L${libgpp} ";
-          append ld_library_path ":${libgpp}"
+         add_path ld_library_path ${libgpp}
       }
       set libstdcpp [lookfor_file ${tool_root_dir} libstdc++];
       if { $libstdcpp != "" } {
           append flags "-L${libstdcpp} ";
-          append ld_library_path ":${libstdcpp}"
+         add_path ld_library_path ${libstdcpp}
       }
       set libiberty [lookfor_file ${tool_root_dir} libiberty];
       if { $libiberty != "" } {
index 934f31dabdcd1519229b15040c9fccdd30b3ee99..c0eeb02bd93bf25a166ac5288779dc157773697d 100644 (file)
@@ -121,7 +121,7 @@ proc objc_init { args } {
 
     objc_maybe_build_wrapper "${tmpdir}/objc-testglue.o"
 
-    set objc_libgcc_s_path [gcc-set-multilib-library-path $OBJC_UNDER_TEST]
+    set objc_libgcc_s_path [find_libgcc_s $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}"
-       append ld_library_path ":${libobjc_dir}"
+       add_path ld_library_path ${libobjc_dir}
     }
     if { $type == "precompiled_header" } {
        # If we generating a precompiled header, we have say this is an
index 6a01d9498e71253eb7211b32820f03b58b7a9680..49accd09687f59af270ad9bc9304fafdadeabf96 100644 (file)
 
 # 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 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
-
-  # 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
+    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
     }
-    set orig_gcc_exec_prefix_checked 1
-  }
-
-  # 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"
-  }
 
-  # 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
-
-    # 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
+    # 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"
     }
-    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"
-  }
+    # Setting the ld library path causes trouble when testing cross-compilers.
+    if { [is_remote target] } {
+       return
+    }
 
-  verbose -log "set_ld_library_path_env_vars: ld_library_path=$ld_library_path"
+    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
+    }
+    set orig_environment_saved 1
+    verbose -log "set_ld_library_path_env_vars: ld_library_path=$ld_library_path"
 }
 
 #######################################
@@ -192,77 +123,35 @@ proc set_ld_library_path_env_vars { } {
 #######################################
 
 proc restore_ld_library_path_env_vars { } {
-  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
+    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
+    }
 
-  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
-  }
+    if { $orig_environment_saved == 0 } {
+       return
+    }
+
+    foreach spec $ld_library_path_vars {
+       set var [lindex $spec 0]
+       set lvar [string tolower $var]
 
-  if { $orig_environment_saved == 0 } {
-    return
-  }
+       global orig_$lvar
+       global orig_${lvar}_saved
 
-  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
-  }
+       if [set orig_${lvar}_saved] {
+           setenv $var [set orig_$lvar]
+       } elseif [info exists env($var)] {
+           unsetenv $var
+       }
+    }
 }
 
 #######################################
@@ -284,3 +173,46 @@ 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
+}
index b08b72720cce1ecf4fa3a6fded37269292a9b49b..a44375dd5cd1b18dcaf5889b285acda55e48f77e 100644 (file)
@@ -1,3 +1,9 @@
+2009-06-30  Richard Sandiford  <r.sandiford@uk.ibm.com>
+
+       * testsuite/lib/libffi-dg.exp (libffi-init): Don't add "."
+       to ld_library_path.  Use add_path.  Add just find_libgcc_s
+       to ld_library_path, not every libgcc multilib directory.
+
 2009-06-16  Wim Lewis  <wiml@hhhh.org>
 
        * src/powerpc/ffi.c: Avoid clobbering cr3 and cr4, which are
index 8db38c286a833a24e6ebe62888e2aa9b258131aa..1481360a54080a956b41bcd334d0098454075619 100644 (file)
@@ -108,32 +108,11 @@ proc libffi-init { args } {
     verbose "libstdc++ $blddircxx"
 
     set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
-    if {$gccdir != ""} {
-       set gccdir [file dirname $gccdir]
-    }
-    verbose "gccdir $gccdir"
-
-    set ld_library_path "."
-    append ld_library_path ":${gccdir}"
-
-    set compiler "${gccdir}/xgcc"
-    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 ${gccdir}/${mldir}/libgcc_s*.so.*]] >= 1 } {
-               append ld_library_path ":${gccdir}/${mldir}"
-           }
-       }
-    }
+    add_path ld_library_path [find_libgcc_s "$gccdir/xgcc"]
     # add the library path for libffi.
-    append ld_library_path ":${blddirffi}/.libs"
+    add_path ld_library_path "${blddirffi}/.libs"
     # add the library path for libstdc++ as well.
-    append ld_library_path ":${blddircxx}/src/.libs"
+    add_path ld_library_path "${blddircxx}/src/.libs"
 
     verbose "ld_library_path: $ld_library_path"
 
index 63295bf4b095abbe3386daa83822a809b2d78fa2..98a379458decdd2e009e68fc98ff6315db56240a 100644 (file)
@@ -1,3 +1,14 @@
+2009-06-30  Richard Sandiford  <r.sandiford@uk.ibm.com>
+
+       * testsuite/lib/libgomp.exp (libgomp_init): Don't add "." to
+       ld_library_path.  Use add_path.  Add just find_libgcc_s to
+       ld_library_path, not every libgcc multilib directory.
+       * testsuite/libgomp.c/c.exp (ld_library_path): Don't call
+       gcc-set-multilib-library-path; rely on $always_ld_library_path instead.
+       * testsuite/libgomp.c++/c++.exp (ld_library_path): Likewise.
+       Use add_path.
+       * testsuite/libgomp.fortran/fortran.exp (ld_library_path): Likewise.
+
 2009-06-09  Nathan Froyd  <froydnj@codesourcery.com>
 
        * Makefile.am (LTLDFLAGS): Define.
index 972d4a1fdd3f6124edc9a7d3d8065cc60ab92030..5a7ec5f9ca5bd1ec26f2359002eeb45d2992c9fe 100644 (file)
@@ -86,39 +86,8 @@ proc libgomp_init { args } {
        set CFLAGS ""
     }
 
-    # Locate libgcc.a so we don't need to account for different values of
-    # SHLIB_EXT on different platforms
-    set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
-    if {$gccdir != ""} {
-        set gccdir [file dirname $gccdir]
-    }
-
-    # Compute what needs to be put into LD_LIBRARY_PATH
-    set always_ld_library_path ".:${blddir}/.libs"
-
-    # Compute what needs to be added to the existing LD_LIBRARY_PATH.
-    if {$gccdir != ""} {
-       # Add AIX pthread directory first.
-       if { [llength [glob -nocomplain ${gccdir}/pthread/libgcc_s*.a]] >= 1 } {
-           append always_ld_library_path ":${gccdir}/pthread"
-       }
-       append always_ld_library_path ":${gccdir}"
-       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 ${gccdir}/${mldir}/libgcc_s*.so.*]] >= 1 } {
-             append always_ld_library_path ":${gccdir}/${mldir}"
-           }
-         }
-       }
-    }
+    set always_ld_library_path "${blddir}/.libs"
+    add_path always_ld_library_path [find_libgcc_s $GCC_UNDER_TEST]
 
     set ALWAYS_CFLAGS ""
     if { $blddir != "" } {
index decda3d1a122ebab2d2bc1dfa27dbb431418c056..92b8146e505ef12d312e589fe34eaec3e243d9f7 100644 (file)
@@ -37,12 +37,10 @@ if { $lang_test_file_found } {
     # Gather a list of all tests.
     set tests [lsort [glob -nocomplain $srcdir/$subdir/*.C]]
 
+    set ld_library_path $always_ld_library_path
     if { $blddir != "" } {
-        set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
-    } else {
-        set ld_library_path "$always_ld_library_path"
+       add_path ld_library_path "${blddir}/${lang_library_path}"
     }
-    append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
     set_ld_library_path_env_vars
 
     set flags_file "${blddir}/../libstdc++-v3/scripts/testsuite_flags"
index 980bb526f3f75bcb0a20e8c1109c96bbb60df6f6..e304f560a5ae4eef53509745fc19d298f6821026 100644 (file)
@@ -20,7 +20,6 @@ dg-init
 set tests [lsort [find $srcdir/$subdir *.c]]
 
 set ld_library_path $always_ld_library_path
-append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
 set_ld_library_path_env_vars
 
 # Main loop.
index 3d6615ffee7a924aab68e7cc13d82dc65b903722..a1042d1f35108ae3947a20e3d6a1d22de7df134b 100644 (file)
@@ -26,12 +26,10 @@ if { $lang_test_file_found } {
     # Gather a list of all tests.
     set tests [lsort [find $srcdir/$subdir *.\[fF\]{,90,95,03,08}]]
 
+    set ld_library_path $always_ld_library_path
     if { $blddir != "" } {
-        set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
-    } else {
-        set ld_library_path "$always_ld_library_path"
+       add_path ld_library_path "${blddir}/${lang_library_path}"
     }
-    append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
     set_ld_library_path_env_vars
 
     # Main loop.
index 67e193452a4eccfc911037d47ddba7f27803aee0..3934d4e6983a0ffcfb933f0e3175b6b508b2c7e0 100644 (file)
@@ -1,3 +1,11 @@
+2009-06-30  Richard Sandiford  <r.sandiford@uk.ibm.com>
+
+       * testsuite/lib/libjava.exp (libjava_init): Just add
+       find_libgcc_s to libjava_libgcc_s_path, rather than every
+       libgcc multilib directory.
+       (libjava_arguments): Explain why we add "." to ld_library_path.
+       (gcj_invoke, exec_gij, libjava_invoke): Use add_path.
+
 2009-06-22  Matthias Klose  <doko@ubuntu.com>
 
        * libtool-version: Bump soversion.
index 510e4ac80d8b8d671ea83344977ddf9cb653bf80..95a3138ce3dade5761a86e08057b2fac1e9ae8b9 100644 (file)
@@ -197,36 +197,8 @@ proc libjava_init { args } {
     }
 
     # Finally, add the gcc build directory so that we can find the
-    # shared libgcc.  This, like much of dejagnu, is hideous.
-    set libjava_libgcc_s_path {}
-
-    if { [istarget "*-*-darwin*"] } {
-       set so_extension "dylib"
-    } elseif { [istarget "*-*-cygwin*"] || [istarget "*-*-mingw*"] } {
-       set so_extension "dll"
-    } else {
-       set so_extension "so"
-    }
-    set gccdir [lookfor_file $tool_root_dir gcc/libgcc_s.${so_extension}]
-    if {$gccdir != ""} {
-       set gccdir [file dirname $gccdir]
-       lappend libjava_libgcc_s_path $gccdir
-       verbose "libjava_libgcc_s_path = $libjava_libgcc_s_path"
-       set compiler ${gccdir}/xgcc
-       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 ${gccdir}/${mldir}/libgcc_s*.${so_extension}.*]] >= 1 } {
-                   lappend libjava_libgcc_s_path "${gccdir}/${mldir}"
-               }
-           }
-       }
-    }
+    # shared libgcc.
+    set libjava_libgcc_s_path [find_libgcc_s $GCJ_UNDER_TEST]
 
     set libjava_initialized 1
 }
@@ -337,6 +309,8 @@ proc libjava_arguments {{mode compile}} {
     # Basically we want to build up a colon separated path list from
     # the value of $libjava.
 
+    # Add "." to the list so that we pick up shared libraries created
+    # by the testsuite itself.
     set lpath "."
     foreach dir [list $libjava] {
        foreach item [split $dir " "] {
@@ -470,8 +444,8 @@ proc gcj_invoke {program expectFile ld_library_additions} {
   global ld_library_path
 
   set ld_library_path "$libjava_ld_library_path"
-  if {[llength $ld_library_additions] > 0} {
-    append ld_library_path :[join $ld_library_additions :]
+  foreach path $ld_library_additions {
+    add_path ld_library_path $path
   }
 
   set_ld_library_path_env_vars
@@ -512,8 +486,8 @@ proc exec_gij {jarfile expectFile {ld_library_additions {}} {addl_flags {}}} {
   global ld_library_path
 
   set ld_library_path "$libjava_ld_library_path"
-  if {[llength $ld_library_additions] > 0} {
-  append ld_library_path :[join $ld_library_additions :]
+  foreach path $ld_library_additions {
+    add_path ld_library_path $path
   }
        
   set_ld_library_path_env_vars
@@ -562,8 +536,8 @@ proc libjava_invoke {errname testName optName executable inpfile resultfile
     global ld_library_path
 
     set ld_library_path "$libjava_ld_library_path"
-    if {[llength $ld_library_additions] > 0} {
-       append ld_library_path :[join $ld_library_additions :]
+    foreach path $ld_library_additions {
+       add_path ld_library_path $path
     }
 
     set_ld_library_path_env_vars
index 2a23b8d6539225e7232739cf30b60bc8426865c9..11d6f525f4043251363e63621a99e0d2f73644ec 100644 (file)
@@ -1,3 +1,9 @@
+2009-06-30  Richard Sandiford  <r.sandiford@uk.ibm.com>
+
+       * testsuite/lib/libmudflap.exp (libmudflap-init): Don't add "."
+       to ld_library_path.  Use add_path.  Add just find_libgcc_s to
+       ld_library_path, not every libgcc multilib directory.
+
 2009-04-09  Nick Clifton  <nickc@redhat.com>
 
        * mf-hooks1.c: Change copyright header to refer to version 3
index c69e84ade29d054a96562f0749a47294c8aefd5d..da91643a7b2881aa18f9d062a065d46131bf8ce5 100644 (file)
@@ -60,28 +60,9 @@ proc libmudflap-init { language } {
     # set LD_LIBRARY_PATH so that libgcc_s, libstdc++ binaries can be found.
     # locate libgcc.a so we don't need to account for different values of
     # SHLIB_EXT on different platforms
-    set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
-    if {$gccdir != ""} {
-       set gccdir [file dirname $gccdir]
-    }
-
-    set ld_library_path "."
-    append ld_library_path ":${gccdir}"
-    append ld_library_path ":${cxxblddir}/src/.libs"
-    if {[is_remote host] == 0} {
-       foreach i "[exec ${gccdir}/xgcc --print-multi-lib]" {
-           set mldir ""
-           regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir
-           set mldir [string trimright $mldir "\;@"]
-           if { "$mldir" == "." } {
-               continue
-           }
-           if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] >= 1 } {
-               append ld_library_path ":${gccdir}/${mldir}"
-           }
-       }
-    }
-    append ld_library_path ":${blddir}/.libs"
+    set ld_library_path [find_libgcc_s $cxx]
+    add_path ld_library_path "${cxxblddir}/src/.libs"
+    add_path ld_library_path "${blddir}/.libs"
 
     set libs "-L${blddir}/.libs"
     set cxxflags "-ggdb3 -DDEBUG_ASSERT"
index 963bc23f3999fd2648b50b44bb9394c0d894e4b0..b1269dda78272c119dccd4ad57144d7492813d14 100644 (file)
@@ -1,3 +1,9 @@
+2009-06-30  Richard Sandiford  <r.sandiford@uk.ibm.com>
+
+       * testsuite/lib/libstdc++.exp (libstdc++_init): Don't add "."
+       to ld_library_path.  Use add_path.  Add just find_libgcc_s to
+       ld_library_path, not every libgcc multilib directory.
+
 2009-06-30  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR libstdc++/40600
index 45e92d756ecf80c0045d1acfd2258bb75caed053..99adce94fa32fda84f1538fcc8ab9848b215c2d1 100644 (file)
@@ -132,7 +132,6 @@ proc libstdc++_init { testfile } {
     set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
     if {$gccdir != ""} {
         set gccdir [file dirname $gccdir]
-       append ld_library_path_tmp ":${gccdir}"
     }
     v3track gccdir 3
 
@@ -142,7 +141,7 @@ proc libstdc++_init { testfile } {
     if {$libgompdir != ""} {
        set v3-libgomp 1
         set libgompdir [file dirname $libgompdir]
-       append ld_library_path_tmp ":${libgompdir}"
+       add_path ld_library_path_tmp ${libgompdir}
        verbose -log "libgomp support detected"
     }
     v3track libgompdir 3
@@ -162,22 +161,8 @@ proc libstdc++_init { testfile } {
     if {$gccdir != ""} {
        set compiler ${gccdir}/g++
        set ld_library_path ${ld_library_path_tmp}
-       append ld_library_path ":${blddir}/src/.libs"
-
-       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 ${gccdir}/${mldir}/libgcc_s*.so.*]] >= 1 } {
-             append ld_library_path ":${gccdir}/${mldir}"
-           }
-         }
-       }
-
+       add_path ld_library_path "${blddir}/src/.libs"
+       add_path ld_library_path [find_libgcc_s $compiler]
        set_ld_library_path_env_vars
        if [info exists env(LD_LIBRARY_PATH)] {
          verbose -log "LD_LIBRARY_PATH = $env(LD_LIBRARY_PATH)"