This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


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

A libgcc patch for gcc 3.0


I am not sure if gcc 3.0 will do the right thing for glibc. Here is
a patch. Basiscally, we treat libgcc_s.so as a system library. gcc
will use libgcc_s.so only if it is available from system or gcc is
configured with

--enable-shared=libgcc/--enable-shared=gcc

Any comments?


H.J.
----
2001-03-21  H.J. Lu  (hjl@gnu.org)

	* gcc/configure.in: Handle the system shared libgcc.
	* gcc/configure: Rebuild.

	* gcc/Makefile.in (DRIVER_DEFINES): Define ENABLE_SHARED_LIBGCC
	for --enable-shared=libgcc/--enable-shared=gcc.

--- gcc/configure.in.libgcc	Mon Mar 19 10:57:31 2001
+++ gcc/configure.in	Wed Mar 21 14:15:09 2001
@@ -315,6 +315,7 @@ dwarf2=no)
 AC_ARG_ENABLE(shared,
 [  --disable-shared       don't provide a shared libgcc.],
 [
+  enable_shared_libgcc=no
   case $enable_shared in
   yes | no) ;;
   *)
@@ -323,13 +324,63 @@ AC_ARG_ENABLE(shared,
     for pkg in $enableval; do
       if test "X$pkg" = "Xgcc" || test "X$pkg" = "Xlibgcc"; then
         enable_shared=yes
+	enable_shared_libgcc=yes
       fi
     done
     IFS="$ac_save_ifs"
     ;;
   esac
-], [enable_shared=yes])
+], [enable_shared=yes; enable_shared_libgcc=no])
+# For systems where the shared libgcc is a system library come from the
+# system vendor, we build our shared libgcc only when
+#
+#	--enable-shared=gcc
+# or
+#	--enable-shared=libgcc
+#
+# is used to configure gcc. We enable the shared libgcc if it is
+# available either from system or we build it ourselves.
+case $target in
+*-linux*libc1*|*-linux*aout*|*-linux*oldld*|*-linux*ecoff*)
+  ;;
+*-linux*)
+  # We only deal with Linux running glibc 2.
+  if test "X$enable_shared_libgcc" = "Xyes"; then
+    enable_shared=yes
+  else
+    if test "X$enable_shared" = "Xyes"; then
+      enable_shared=no
+      # We only check the system shared libgcc for the native compiler.
+      # You have to use
+      #
+      # --enable-shared=libgcc
+      #
+      # to enable the shared libgcc for the cross compiler.
+      if test "X$host" = "X$target"; then
+	# FIXME: Need to check if the system shared libgcc library is
+	#	really ok.
+	AC_MSG_CHECKING([there is a system shared libgcc])
+	AC_CACHE_VAL(gcc_cv_has_shared_libgcc,
+		     [gcc_cv_has_shared_libgcc_save_LIBS="$LIBS"
+		      LIBS="-lgcc_s $gcc_cv_has_shared_libgcc_save_LIBS"
+		      AC_TRY_LINK([], [],
+				  [gcc_cv_has_shared_libgcc=yes],
+				  [gcc_cv_has_shared_libgcc=no])
+		      LIBS="$gcc_cv_has_shared_libgcc_save_LIBS"])
+	if test "X$gcc_cv_has_shared_libgcc" = "Xyes"; then
+	  AC_MSG_RESULT(yes)
+	  enable_shared_libgcc=yes
+	else
+	  AC_MSG_RESULT(no)
+	  enable_shared_libgcc=no
+	fi
+      fi
+    fi
+  fi
+  ;;
+esac
 AC_SUBST(enable_shared)
+AC_SUBST(enable_shared_libgcc)
 
 # Determine the host, build, and target systems
 AC_CANONICAL_SYSTEM
--- gcc/Makefile.in.libgcc	Wed Mar 21 09:44:49 2001
+++ gcc/Makefile.in	Wed Mar 21 12:45:10 2001
@@ -1265,7 +1265,7 @@ DRIVER_DEFINES = \
   -DDEFAULT_TARGET_MACHINE=\"$(target_alias)\" \
   -DSTANDARD_BINDIR_PREFIX=\"$(bindir)/\" \
   -DTOOLDIR_BASE_PREFIX=\"$(unlibsubdir)/../\" \
-  `test "$${SHLIB_LINK}" -a "@enable_shared@" = "yes" && echo "-DENABLE_SHARED_LIBGCC"` \
+  `test "$${SHLIB_LINK}" && test "@enable_shared@" = "yes" -o "@enable_shared_libgcc@" = "yes" && echo "-DENABLE_SHARED_LIBGCC"` \
   `test "$${SHLIB_MULTILIB}" && echo "-DNO_SHARED_LIBGCC_MULTILIB"`
 
 gcc.o: gcc.c $(CONFIG_H) system.h intl.h multilib.h \


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