This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: PATCH: Handle the shared libgcc is a system library
On Mon, Jul 02, 2001 at 11:14:06AM -0300, Alexandre Oliva wrote:
>
> > At this point, $host = $target. When $build = $target != $host, you
> > are building a cross compiler, slibdir is set to $(build_tooldir)/lib.
>
> Would you please add a comment explaining the dependence on the code
> above and the inferences you're making? This could help the next
> person who chooses to modify that chunk of code get the whole
> picture.
Ok. Added.
>
> > I don't think many people will do
>
> > # make install
>
> > for a canadian cross build. The possible usage is
>
> I'll concede that I'm not a typical user, but I often do it.
I removed that part.
>
> Isn't your argument that having more than one copy of libgcc_s.so.1
> can get the whole system unstable? How does moving it change this
More precisely, only the system libgcc_s.so.1 should be visible to the
system dynamic linker for the binaries come from the ditribution vendor.
I have many copies of libc.so.6 on my machine. It is ok as long as they
are not visible to the system dynamic linker. One word of caution, never
set DT_RPATH to "" in the system binaries :-).
> fact? There will still be one more copy, and users are likely to add
> GCC's internal library search path to ld.so.conf as well. For one,
> that's where the libobjc libraries are installed. For another, that's
> what they're going to do to make sure they're using the newer copy of
> libgcc_s.so.1, or just because they had to do it on other OSs that
> don't have libgcc_s.so.1 in /lib.
>
I can live with that. At least, the users should be aware that they are
tempering with the system library :-).
Here is an update on my last patch.
Thanks for all the comments.
H.J.
---
2001-07-02 H.J. Lu (hjl@gnu.org)
* configure.in (slibdir): Set according to if the shared libgcc
library is a system shared library.
* configure: Rebuild.
* 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 Wed Jun 13 13:36:24 2001
+++ gcc/configure.in Mon Jul 2 08:25:31 2001
@@ -1945,14 +1945,26 @@ AC_ARG_ENABLE(version-specific-runtime-l
AC_ARG_WITH(slibdir,
[ --with-slibdir=DIR shared libraries in DIR [LIBDIR]],
-slibdir="$with_slibdir",
+slibdir="$with_slibdir",[
if test "${enable_version_specific_runtime_libs+set}" = set; then
slibdir='$(libsubdir)'
elif test "$host" != "$target"; then
slibdir='$(build_tooldir)/lib'
else
+ # We are building a nativa compiler here since "$host" = "$target".
slibdir='$(libdir)'
-fi)
+ if test "$build" = "$target"; then
+ # For systems where there is the shared libgcc in /lib or /usr/lib,
+ # we assume it is a system library come from the system vendor, we
+ # install our shared libgcc into $(libsubdir). We only check the
+ # system shared libgcc for the native build.
+ # FIXME: Need to check if the system shared libgcc library is
+ # really ok.
+ if test -e /lib/libgcc_s.so.1 || test -e /usr/lib/libgcc_s.so.1; then
+ slibdir='$(libsubdir)'
+ fi
+ fi
+fi])
AC_SUBST(slibdir)
# Nothing to do for FLOAT_H, float_format already handled.
--- gcc/gcc.c.libgcc Tue Jun 12 14:38:51 2001
+++ gcc/gcc.c Mon Jul 2 08:18:19 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;
@@ -898,6 +902,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},
@@ -2897,6 +2902,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);
@@ -3035,6 +3041,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]. */
@@ -3200,6 +3227,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"))