This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC|T] 'shared library only build' testsuite fixes


Mark Mitchell wrote:
Eric Botcazou wrote:

Hm, this is a fault in the static_linking_1.f test case on one side and
a bug in target-support.exp.


I confirm: http://gcc.gnu.org/ml/gcc-patches/2005-11/msg00350.html

Thanks for looking into this.


I would like to see this patch (once it works!) included in 4.1, as it
will facilitate testing.  I think the patch is the overall right
approach; once there's a final version to review, I'd be happy to review
it, given Janis' reluctance.


I'm going to commit the following.

We have not seen any regressions so far.

If there are any, speak up immediately.

Thank you all.
Andreas

2005-11-11 Andreas Tobler <a.tobler@schweiz.ch>

	* 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.
Index: lib/g++.exp
===================================================================
--- lib/g++.exp	(revision 106800)
+++ lib/g++.exp	(working copy)
@@ -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 @@
     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 @@
           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 "
       }
Index: lib/gfortran.exp
===================================================================
--- lib/gfortran.exp	(revision 106800)
+++ lib/gfortran.exp	(working copy)
@@ -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 @@
     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 "
       }
Index: lib/obj-c++.exp
===================================================================
--- lib/obj-c++.exp	(revision 106800)
+++ lib/obj-c++.exp	(working copy)
@@ -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 @@
     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 @@
           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 @@
       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 @@
     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 @@
     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}"
Index: lib/objc.exp
===================================================================
--- lib/objc.exp	(revision 106800)
+++ lib/objc.exp	(working copy)
@@ -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 @@
     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 @@
     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}"
Index: lib/target-libpath.exp
===================================================================
--- lib/target-libpath.exp	(revision 106800)
+++ lib/target-libpath.exp	(working copy)
@@ -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 @@
     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
+}
+

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]