This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
A revised shared libgcc patch for gcc 3.0
- To: GNU C Library <libc-alpha at sourceware dot cygnus dot com>
- Subject: A revised shared libgcc patch for gcc 3.0
- From: "H . J . Lu" <hjl at lucon dot org>
- Date: Sun, 25 Mar 2001 22:57:45 -0800
Here is my revised shared libgcc patch for gcc 3.0. It implemented
#1 and #2 in
http://sources.redhat.com/ml/libc-alpha/2001-03/msg00137.html
I can write a simple shell script to do the same as #3. I didn't test
libgcc.map with multilib. It may just work. I also have a libgcc add-on
for glibc, which works with this gcc patch.
Any comments?
Thanks.
H.J.
---
2001-03-25 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/mklibgcc.in: Generate and install libgcc.map for
--enable-share or --enable-shared=libgcc/--enable-shared=gcc.
* gcc/gcc.c (compiler_release): New string for the compiler
release.
(option_map): Add --release/-dumprelease.
(display_help): Add -dumprelease.
(process_command): Initialize compiler_release and handle
-dumprelease.
--- gcc/configure.in.libgcc Tue Mar 20 23:06:21 2001
+++ gcc/configure.in Sun Mar 25 15:08:53 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/gcc.c.libgcc Sat Mar 24 20:23:30 2001
+++ gcc/gcc.c Sun Mar 25 15:08:54 2001
@@ -157,6 +157,10 @@ static int save_temps_flag;
static const char *compiler_version;
+/* The compiler release. */
+
+static const char *compiler_release;
+
/* The target version specified with -V */
static const char *spec_version = DEFAULT_TARGET_VERSION;
@@ -896,6 +900,7 @@ struct option_map option_map[] =
{"--user-dependencies", "-MM", 0},
{"--verbose", "-v", 0},
{"--version", "-dumpversion", 0},
+ {"--release", "-dumprelease", 0},
{"--warn-", "-W", "*j"},
{"--write-dependencies", "-MD", 0},
{"--write-user-dependencies", "-MMD", 0},
@@ -2886,6 +2891,7 @@ display_help ()
fputs (_(" (Use '-v --help' to display command line options of sub-processes)\n"), stdout);
fputs (_(" -dumpspecs Display all of the built in spec strings\n"), stdout);
fputs (_(" -dumpversion Display the version of the compiler\n"), stdout);
+ fputs (_(" -dumprelease Display the release of the compiler\n"), stdout);
fputs (_(" -dumpmachine Display the compiler's target processor\n"), stdout);
fputs (_(" -print-search-dirs Display the directories in the compiler's search path\n"), stdout);
fputs (_(" -print-libgcc-file-name Display the name of the compiler's companion library\n"), stdout);
@@ -3024,6 +3030,27 @@ process_command (argc, argv)
}
}
+ /* Figure compiler release from version string. */
+ compiler_release = temp1 = xstrdup (version_string);
+
+ for (; *temp1; ++temp1)
+ {
+ if (ISSPACE ((unsigned char) *temp1))
+ *temp1 = '-';
+ else if (*temp1 == '(')
+ {
+ *temp1 = '\0';
+ break;
+ }
+ }
+ for (--temp1; *temp1; --temp1)
+ {
+ if (*temp1 == '-')
+ *temp1 = '\0';
+ else
+ break;
+ }
+
/* Set up the default search paths. If there is no GCC_EXEC_PREFIX,
see if we can create it from the pathname specified in argv[0]. */
@@ -3189,6 +3216,11 @@ process_command (argc, argv)
else if (! strcmp (argv[i], "-dumpversion"))
{
printf ("%s\n", spec_version);
+ exit (0);
+ }
+ else if (! strcmp (argv[i], "-dumprelease"))
+ {
+ printf ("%s\n", compiler_release);
exit (0);
}
else if (! strcmp (argv[i], "-dumpmachine"))
--- gcc/Makefile.in.libgcc Sat Mar 24 20:23:22 2001
+++ gcc/Makefile.in Sun Mar 25 15:08:54 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 \
--- gcc/mklibgcc.in.libgcc Sun Jan 7 01:27:24 2001
+++ gcc/mklibgcc.in Sun Mar 25 16:03:17 2001
@@ -61,6 +61,12 @@ if [ "@enable_shared@" = "no" ]; then
SHLIB_LINK=""
fi
+# shared libgcc may be enabled, but not built.
+build_map=@enable_shared@
+if [ "$build_map" = "no" ]; then
+ build_map=@enable_shared_libgcc@
+fi
+
# Build lines.
gcc_compile='$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES)'
@@ -260,7 +266,7 @@ for ml in $MULTILIBS; do
done
shlib_deps="$libgcc_objs"
- if [ "$SHLIB_LINK" -a "$SHLIB_MKMAP" -a -z "$mapfile" ]; then
+ if [ "$build_map" = "yes" ] || [ "$SHLIB_LINK" -a "$SHLIB_MKMAP" -a -z "$mapfile" ]; then
mapfile="libgcc.map"
echo ""
echo "${mapfile}: $SHLIB_MKMAP $SHLIB_MAPFILES $libgcc_objs"
@@ -276,7 +282,11 @@ for ml in $MULTILIBS; do
done
echo ""
- echo "${dir}/libgcc.a: $libgcc_objs"
+ if [ "$build_map" = "yes" ]; then
+ echo "${dir}/libgcc.a: $libgcc_objs $mapfile"
+ else
+ echo "${dir}/libgcc.a: $libgcc_objs"
+ fi
echo " -rm -rf ${dir}/libgcc.a"
echo ' $(AR_CREATE_FOR_TARGET)' ${dir}/libgcc.a $libgcc_objs
echo ' if $(RANLIB_TEST_FOR_TARGET) ; then' \\
@@ -396,6 +406,10 @@ for ml in $MULTILIBS; do
fi
echo ' $(INSTALL_DATA)' ${dir}/libgcc.a ${ldir}/
echo ' $(RANLIB_FOR_TARGET)' ${ldir}/libgcc.a
+
+ if [ "$build_map" = "yes" -a $dir = . ]; then
+ echo ' $(INSTALL_DATA)' ${dir}/$mapfile ${ldir}/
+ fi
if [ "$SHLIB_LINK" ]; then
if [ -z "$SHLIB_MULTILIB" ]; then