From: andreast Date: Fri, 11 Nov 2005 22:31:35 +0000 (+0000) Subject: 2005-11-11 Andreas Tobler X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=903355fcf4d044100232c4d4e92882fb9af23978 2005-11-11 Andreas Tobler * lib/target-libpath.exp (get_shlib_extension): New proc. * lib/g++.exp (g++_link_flags): Add flags in case of shared only build. * lib/gfortran.exp (gfortran_link_flags): Likewise. * lib/objc.exp (objc_target_compile): Likewise. * lib/obj-c++.exp (obj-c++_link_flags): Likewise. Fix multilib libgcc detection. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@106802 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 03be1ca6625..59e5d45929c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,14 @@ 2005-11-11 Andreas Tobler + * lib/target-libpath.exp (get_shlib_extension): New proc. + * lib/g++.exp (g++_link_flags): Add flags in case of shared only build. + * lib/gfortran.exp (gfortran_link_flags): Likewise. + * lib/objc.exp (objc_target_compile): Likewise. + * lib/obj-c++.exp (obj-c++_link_flags): Likewise. Fix multilib libgcc + detection. + +2005-11-11 Andreas Tobler + * gfortran.dg/static_linking_1.f: Fix static_libgfortran processing. * lib/target-supports.exp (check_effective_target_static_libgfortran): diff --git a/gcc/testsuite/lib/g++.exp b/gcc/testsuite/lib/g++.exp index cd47dee3579..c907e5422d4 100644 --- a/gcc/testsuite/lib/g++.exp +++ b/gcc/testsuite/lib/g++.exp @@ -1,16 +1,16 @@ -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003, 2004 -# Free Software Foundation, Inc. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003, +# 2004, 2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -100,12 +100,16 @@ proc g++_link_flags { paths } { global srcdir global ld_library_path global GXX_UNDER_TEST + global shlib_ext set gccpath ${paths} set libio_dir "" set flags "" 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" @@ -122,6 +126,12 @@ proc g++_link_flags { paths } { append flags " -L${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 " + append ld_library_path ":${gccpath}/libstdc++-v3/src/.libs" + } + if [file exists "${gccpath}/libiberty/libiberty.a"] { append flags "-L${gccpath}/libiberty " } diff --git a/gcc/testsuite/lib/gfortran.exp b/gcc/testsuite/lib/gfortran.exp index ee64d9bdae6..435d715ceef 100644 --- a/gcc/testsuite/lib/gfortran.exp +++ b/gcc/testsuite/lib/gfortran.exp @@ -1,15 +1,15 @@ -# Copyright (C) 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -76,17 +76,24 @@ proc gfortran_link_flags { paths } { global srcdir global ld_library_path global GFORTRAN_UNDER_TEST + global shlib_ext set gccpath ${paths} set libio_dir "" set flags "" set ld_library_path "." + set shlib_ext [get_shlib_extension] + verbose "shared lib extension: $shlib_ext" if { $gccpath != "" } { if [file exists "${gccpath}/libgfortran/.libs/libgfortran.a"] { append flags "-L${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 " + append ld_library_path ":${gccpath}/libgfortran/.libs" + } if [file exists "${gccpath}/libgfortran/libgforbegin.a"] { append flags "-L${gccpath}/libgfortran " } diff --git a/gcc/testsuite/lib/obj-c++.exp b/gcc/testsuite/lib/obj-c++.exp index c58051821dc..ccb82d0ffc7 100644 --- a/gcc/testsuite/lib/obj-c++.exp +++ b/gcc/testsuite/lib/obj-c++.exp @@ -1,15 +1,15 @@ -# Copyright (C) 2004 Free Software Foundation, Inc. +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -100,11 +100,14 @@ proc obj-c++_link_flags { paths } { global srcdir global ld_library_path global OBJCXX_UNDER_TEST + global shlib_ext set gccpath ${paths} set libio_dir "" set flags "" 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"] { @@ -122,6 +125,11 @@ proc obj-c++_link_flags { paths } { append flags " -L${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 " + append ld_library_path ":${gccpath}/libstdc++-v3/src/.libs" + } if [file exists "${gccpath}/libiberty/libiberty.a"] { append flags "-L${gccpath}/libiberty " } @@ -134,27 +142,26 @@ proc obj-c++_link_flags { paths } { if { $libobjc_dir == ""} { set libobjc_dir [lookfor_file ${objcpath} libobjc/.libs/libobjc-gnu.a] } + # Now check if we have a shared only build. + if { $libobjc_dir == ""} { + set libobjc_dir \ + [lookfor_file ${objcpath} libobjc/.libs/libobjc.${shlib_ext}] + } + if { $libobjc_dir == ""} { + set libobjc_dir \ + [lookfor_file ${objcpath} libobjc/.libs/libobjc-gnu.${shlib_ext}] + } + + verbose "libobjc_dir: $libobjc_dir" + if { $libobjc_dir != "" } { set libobjc_dir [file dirname ${libobjc_dir}] append flags "-L${libobjc_dir}" append ld_library_path ":${libobjc_dir}" } - - append ld_library_path ":${rootme}" - set compiler [lindex $OBJCXX_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 $OBJCXX_UNDER_TEST] + } else { global tool_root_dir; @@ -274,8 +281,11 @@ proc obj-c++_target_compile { source dest type options } { global gluefile wrap_flags global ALWAYS_OBJCXXFLAGS global OBJCXX_UNDER_TEST + global shlib_ext lappend options "libs=-lobjc" + set shlib_ext [get_shlib_extension] + verbose "shared lib extension: $shlib_ext" if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } { lappend options "libs=${gluefile}" @@ -292,9 +302,21 @@ proc obj-c++_target_compile { source dest type options } { if { $libobjc_dir == ""} { verbose "see if we have -fgnu-runtime in options" if [regexp ".*-fgnu-runtime.*" "${options}" ] { - set libobjc_dir [lookfor_file ${objcpath} libobjc/.libs/libobjc-gnu.a] + set libobjc_dir [lookfor_file ${objcpath} libobjc/.libs/libobjc-gnu.a] } } + if { $libobjc_dir == ""} { + set libobjc_dir \ + [lookfor_file ${objcpath} libobjc/.libs/libobjc.${shlib_ext}] + } + if { $libobjc_dir == ""} { + verbose "see if we have -fgnu-runtime in options" + if [regexp ".*-fgnu-runtime.*" "${options}"] { + set libobjc_dir \ + [lookfor_file ${objcpath} libobjc/.libs/libobjc-gnu.${shlib_ext}] + } + } + if { $libobjc_dir != "" } { set objc_include_dir "${srcdir}/../../libobjc" lappend options "additional_flags=-I${objc_include_dir}" diff --git a/gcc/testsuite/lib/objc.exp b/gcc/testsuite/lib/objc.exp index 87ccdac6050..18cdfeaa880 100644 --- a/gcc/testsuite/lib/objc.exp +++ b/gcc/testsuite/lib/objc.exp @@ -1,16 +1,16 @@ -# Copyright (C) 1992, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2004 +# Copyright (C) 1992, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2004, 2005 # Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -127,9 +127,12 @@ proc objc_target_compile { source dest type options } { global TOOL_OPTIONS global ld_library_path global objc_libgcc_s_path + global shlib_ext set ld_library_path ".:${objc_libgcc_s_path}" lappend options "libs=-lobjc" + set shlib_ext [get_shlib_extension] + verbose "shared lib extension: $shlib_ext" if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } { lappend options "libs=${gluefile}" @@ -161,9 +164,21 @@ proc objc_target_compile { source dest type options } { if { $libobjc_dir == ""} { verbose "see if we have -fgnu-runtime in options" if [regexp ".*-fgnu-runtime.*" "${options}"] { - set libobjc_dir [lookfor_file ${objcpath} libobjc/.libs/libobjc-gnu.a] + set libobjc_dir [lookfor_file ${objcpath} libobjc/.libs/libobjc-gnu.a] } } + # Now check if we have a shared only build. + if { $libobjc_dir == ""} { + set libobjc_dir \ + [lookfor_file ${objcpath} libobjc/.libs/libobjc.${shlib_ext}] + } + if { $libobjc_dir == ""} { + verbose "see if we have -fgnu-runtime in options" + if [regexp ".*-fgnu-runtime.*" "${options}"] { + set libobjc_dir \ + [lookfor_file ${objcpath} libobjc/.libs/libobjc-gnu.${shlib_ext}] + } + } if { $libobjc_dir != "" } { set objc_include_dir "${srcdir}/../../libobjc" lappend options "additional_flags=-I${objc_include_dir}" diff --git a/gcc/testsuite/lib/target-libpath.exp b/gcc/testsuite/lib/target-libpath.exp index 85f201b6ea3..8aca0edf43e 100644 --- a/gcc/testsuite/lib/target-libpath.exp +++ b/gcc/testsuite/lib/target-libpath.exp @@ -1,15 +1,15 @@ -# Copyright (C) 2004 Free Software Foundation, Inc. +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -235,3 +235,23 @@ proc restore_ld_library_path_env_vars { } { unsetenv DYLD_LIBRARY_PATH } } + +####################################### +# proc get_shlib_extension { } +####################################### + +proc get_shlib_extension { } { + global shlib_ext + + if { [ istarget *-*-darwin* ] } { + set shlib_ext "dylib" + } elseif { [ istarget *-*-cygwin* ] || [ istarget *-*-mingw* ] } { + set shlib_ext "dll" + } elseif { [ istarget hppa*-*-hpux* ] } { + set shlib_ext "sl" + } else { + set shlib_ext "so" + } + return $shlib_ext +} +