From: Mark Mitchell Date: Mon, 2 May 2005 23:32:41 +0000 (+0000) Subject: backport: g++.exp (g++_link_flags): Use gcc-set-multilib-library-path. X-Git-Tag: releases/gcc-3.4.4~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4806352da2795a81591e1d6a48723b93bf1a9a2a;p=thirdparty%2Fgcc.git backport: g++.exp (g++_link_flags): Use gcc-set-multilib-library-path. Backport: 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/objc.exp (objc_init): Likewise. 2004-11-27 John David Anglin * lib/target-libpath.exp (restore_ld_library_path_env_vars): Check existence of ld library path variables before unsetting. 2004-11-24 John David Anglin * lib/target-libpath.exp (orig_ld_library_path_saved): Add missing set. 2004-11-23 John David Anglin * lib/target-libpath.exp: New file defining set_ld_library_path_env_vars and restore_ld_library_path_env_vars. * g++.dg/compat/compat.exp, lib/g++.exp, lib/objc.exp: Use new procs. From-SVN: r99128 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 67b991b9a4b4..f0e819fb7b52 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,21 @@ +2005-05-02 Mark Mitchell + + Backport: + 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/objc.exp (objc_init): Likewise. + 2004-11-27 John David Anglin + * lib/target-libpath.exp (restore_ld_library_path_env_vars): + Check existence of ld library path variables before unsetting. + 2004-11-24 John David Anglin + * lib/target-libpath.exp (orig_ld_library_path_saved): Add missing set. + 2004-11-23 John David Anglin + * lib/target-libpath.exp: New file defining + set_ld_library_path_env_vars and restore_ld_library_path_env_vars. + * g++.dg/compat/compat.exp, lib/g++.exp, lib/objc.exp: Use new procs. + 2005-05-02 Mark Mitchell PR c++/15875 diff --git a/gcc/testsuite/g++.dg/compat/compat.exp b/gcc/testsuite/g++.dg/compat/compat.exp index 94da38c77de7..accd1452d7dc 100644 --- a/gcc/testsuite/g++.dg/compat/compat.exp +++ b/gcc/testsuite/g++.dg/compat/compat.exp @@ -35,22 +35,7 @@ global 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 - } -} +load_lib target-libpath.exp # # compat-use-alt-compiler -- make the alternate compiler the default @@ -69,7 +54,7 @@ proc compat-use-alt-compiler { } { set CXXFLAGS "" set ALWAYS_CXXFLAGS "" set ld_library_path $alt_ld_library_path - compat-fix-library-path + set_ld_library_path_env_vars } } @@ -91,7 +76,7 @@ proc compat-use-tst-compiler { } { set CXXFLAGS $save_cxxflags set ALWAYS_CXXFLAGS $save_always_cxxflags set ld_library_path $save_ld_library_path - compat-fix-library-path + set_ld_library_path_env_vars } } diff --git a/gcc/testsuite/lib/g++.exp b/gcc/testsuite/lib/g++.exp index 0b5681b134b4..8a6e3a0b55b9 100644 --- a/gcc/testsuite/lib/g++.exp +++ b/gcc/testsuite/lib/g++.exp @@ -24,6 +24,7 @@ # load_lib prune.exp load_lib gcc-defs.exp +load_lib target-libpath.exp # # GXX_UNDER_TEST is the compiler under test. @@ -96,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 @@ -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 [gcc-set-multilib-library-path $GXX_UNDER_TEST] } else { global tool_root_dir; @@ -166,20 +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. 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 - } + set_ld_library_path_env_vars return "$flags" } @@ -197,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 @@ -244,6 +218,10 @@ proc g++_init { args } { } } + 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 bb2369c21100..b19e2788fd35 100644 --- a/gcc/testsuite/lib/gcc-defs.exp +++ b/gcc/testsuite/lib/gcc-defs.exp @@ -217,3 +217,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/objc.exp b/gcc/testsuite/lib/objc.exp index 2819660df380..b0f910430ddc 100644 --- a/gcc/testsuite/lib/objc.exp +++ b/gcc/testsuite/lib/objc.exp @@ -28,6 +28,7 @@ load_lib libgloss.exp load_lib prune.exp load_lib gcc-defs.exp +load_lib target-libpath.exp # # OBJC_UNDER_TEST is the compiler under test. @@ -85,7 +86,6 @@ proc objc_version { } { set objc_initialized 0 proc objc_init { args } { - global rootme global tmpdir global libdir global gluefile wrap_flags @@ -118,25 +118,10 @@ proc objc_init { args } { } } - 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 } { - global rootme; global tmpdir; global gluefile wrap_flags; global srcdir @@ -184,17 +169,7 @@ proc objc_target_compile { source dest type options } { } 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 + set_ld_library_path_env_vars return [target_compile $source $dest $type $options] } diff --git a/gcc/testsuite/lib/target-libpath.exp b/gcc/testsuite/lib/target-libpath.exp index e8cf4630e16c..8635e7e3453a 100644 --- a/gcc/testsuite/lib/target-libpath.exp +++ b/gcc/testsuite/lib/target-libpath.exp @@ -57,7 +57,7 @@ proc set_ld_library_path_env_vars { } { } if { $orig_environment_saved == 0 } { - global env + global env; set orig_environment_saved 1