diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 24ac11d1c1d..9e5cdf9fedc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2005-03-25 Mark Mitchell + + * lib/g++.exp (g++_link_flags): Use gcc-set-multilib-library-path. + (g++_init): Make sure that CXXFLAGS is set. + * lib/gcc-defs.exp (gcc-set-multilib-library-path): New function. + * lib/gcc-dg.exp: Use gcc-set-multilib-library-path. + * lib/gfortran.exp (gfortran_link_flags): Likewise. + * lib/objc.exp (objc_init): Likewise. + * lib/treelang.exp (treelang_init): Likewise. + 2005-03-25 Pat Haugen PR tree-optimization/20470 diff --git a/gcc/testsuite/lib/g++.exp b/gcc/testsuite/lib/g++.exp index bc2bf60fb7d..e1fa69f836b 100644 --- a/gcc/testsuite/lib/g++.exp +++ b/gcc/testsuite/lib/g++.exp @@ -97,7 +97,6 @@ proc g++_include_flags { paths } { # proc g++_link_flags { paths } { - global rootme global srcdir global ld_library_path global GXX_UNDER_TEST @@ -129,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 [gcc-set-multilib-library-path $GXX_UNDER_TEST] } else { global tool_root_dir @@ -185,6 +170,7 @@ proc g++_init { args } { global gluefile wrap_flags global objdir srcdir global ALWAYS_CXXFLAGS + global CXXFLAGS global TOOL_EXECUTABLE TOOL_OPTIONS global GXX_UNDER_TEST global TESTING_IN_BUILD_TREE @@ -227,6 +213,10 @@ proc g++_init { args } { g++_maybe_build_wrapper "${tmpdir}/g++-testglue.o" + if {![info exists CXXFLAGS]} { + set CXXFLAGS "" + } + set ALWAYS_CXXFLAGS "" if ![is_remote host] { diff --git a/gcc/testsuite/lib/gcc-defs.exp b/gcc/testsuite/lib/gcc-defs.exp index 87e8564e97a..c48b5399ac0 100644 --- a/gcc/testsuite/lib/gcc-defs.exp +++ b/gcc/testsuite/lib/gcc-defs.exp @@ -219,3 +219,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 ee16d2efc67..aecce0f5eb5 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -52,28 +52,12 @@ if ![info exists GCC_UNDER_TEST] { set GCC_UNDER_TEST "[find_gcc]" } -global rootme -global ld_library_path 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 } { - set ld_library_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 ld_library_path ":${rootme}/${mldir}" - } - } - } + append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST] set_ld_library_path_env_vars } diff --git a/gcc/testsuite/lib/gfortran.exp b/gcc/testsuite/lib/gfortran.exp index 8762c906838..43a104e1f51 100644 --- a/gcc/testsuite/lib/gfortran.exp +++ b/gcc/testsuite/lib/gfortran.exp @@ -73,7 +73,6 @@ proc gfortran_version { } { # proc gfortran_link_flags { paths } { - global rootme global srcdir global ld_library_path global GFORTRAN_UNDER_TEST @@ -94,21 +93,8 @@ 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 \ + [gcc-set-multilib-library-path $GFORTRAN_UNDER_TEST] } set_ld_library_path_env_vars diff --git a/gcc/testsuite/lib/objc.exp b/gcc/testsuite/lib/objc.exp index d016a379bb7..fe86b0e2bff 100644 --- a/gcc/testsuite/lib/objc.exp +++ b/gcc/testsuite/lib/objc.exp @@ -115,21 +115,7 @@ 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}" - } - } - } + append objc_libgcc_s_path [gcc-set-multilib-library-path $OBJC_UNDER_TEST] } proc objc_target_compile { source dest type options } { diff --git a/gcc/testsuite/lib/treelang.exp b/gcc/testsuite/lib/treelang.exp index 8ce830d4c80..aba9379793c 100644 --- a/gcc/testsuite/lib/treelang.exp +++ b/gcc/testsuite/lib/treelang.exp @@ -84,7 +84,6 @@ proc default_treelang_version { } { set treelang_initialized 0 proc treelang_init { args } { - global rootme global tmpdir global libdir global gluefile wrap_flags @@ -115,21 +114,8 @@ 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}" - } - } - } + set treelang_libgcc_s_path \ + [gcc-set-multilib-library-path $TREELANG_UNDER_TEST] } proc treelang_target_compile { source dest type options } {