diff options
author | Mark Mitchell <mark@codesourcery.com> | 2001-02-02 17:42:00 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2001-02-02 17:42:00 +0000 |
commit | 049f6ec972093cb435f6d842386872c1c6001a0c (patch) | |
tree | 3e8cc7d5d1480250560533db491107be11d42779 /gcc/gcc.c | |
parent | 483b9fd0fe4e0da56b15a09be666c2012169274d (diff) | |
download | gcc-049f6ec972093cb435f6d842386872c1c6001a0c.zip gcc-049f6ec972093cb435f6d842386872c1c6001a0c.tar.gz gcc-049f6ec972093cb435f6d842386872c1c6001a0c.tar.bz2 |
gcc.c (init_gcc_specs): New function.
* gcc.c (init_gcc_specs): New function. Make -shared-libgcc
the default when building a shared object.
(init_spec): Use it.
* testsuite/lib/g++.exp: Include the directory where libgcc
is located to the LD_LIBRARY_PATH list.
* inovke.texi (-shared-libgcc): Document the cases in which
* Make-lang.in (g++spec.o): Add DRIVER_DEFINES to the list
of macros used when compiling g++spec.c.
* g++spec.c (lang_specific_driver): Link with the shared
libgcc by default.
From-SVN: r39408
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r-- | gcc/gcc.c | 49 |
1 files changed, 42 insertions, 7 deletions
@@ -268,6 +268,9 @@ static int execute PARAMS ((void)); static void clear_args PARAMS ((void)); static void fatal_error PARAMS ((int)); static void set_input PARAMS ((const char *)); +static void init_gcc_specs PARAMS ((struct obstack *, + const char *, + const char *)); /* Specs are strings containing lines, each of which (if not blank) is made up of a program name, and arguments separated by spaces. @@ -1252,6 +1255,35 @@ static struct spec_list *extra_specs = (struct spec_list *) 0; static struct spec_list *specs = (struct spec_list *) 0; +/* Add appropriate libgcc specs to OBSTACK, taking into account + various permutations of -shared-libgcc, -shared, and such. */ + +static void +init_gcc_specs (obstack, shared_name, static_name) + struct obstack *obstack; + const char *shared_name; + const char *static_name; +{ + char buffer[128]; + + /* If we see -shared-libgcc, then use the shared version. */ + sprintf (buffer, "%%{shared-libgcc:%s}", shared_name); + obstack_grow (obstack, buffer, strlen (buffer)); + /* If we see -static-libgcc, then use the shared version. */ + sprintf (buffer, "%%{static-libgcc:%s}", static_name); + obstack_grow (obstack, buffer, strlen (buffer)); + /* Otherwise, if we see -shared, then use the shared version. */ + sprintf (buffer, + "%%{!shared-libgcc:%%{!static-libgcc:%%{shared:%s}}}", + shared_name); + obstack_grow (obstack, buffer, strlen (buffer)); + /* Otherwise, use the static version. */ + sprintf (buffer, + "%%{!shared-libgcc:%%{!static-libgcc:%%{!shared:%s}}}", + static_name); + obstack_grow (obstack, buffer, strlen (buffer)); +} + /* Initialize the specs lookup routines. */ static void @@ -1326,15 +1358,16 @@ init_spec () when given the proper command line arguments. */ while (*p) { - const char *r; if (in_sep && *p == '-' && strncmp (p, "-lgcc", 5) == 0) { + init_gcc_specs (&obstack, #ifdef NO_SHARED_LIBGCC_MULTILIB - r = "%{shared-libgcc:-lgcc_s}%{!shared-libgcc:-lgcc}"; + "-lgcc_s" #else - r = "%{shared-libgcc:-lgcc_s%M}%{!shared-libgcc:-lgcc}"; + "-lgcc_s%M" #endif - obstack_grow (&obstack, r, strlen(r)); + , + "-lgcc"); p += 5; in_sep = 0; } @@ -1342,12 +1375,14 @@ init_spec () { /* Ug. We don't know shared library extensions. Hope that systems that use this form don't do shared libraries. */ + init_gcc_specs (&obstack, #ifdef NO_SHARED_LIBGCC_MULTILIB - r = "%{shared-libgcc:-lgcc_s}%{!shared-libgcc:libgcc.a%s}"; + "-lgcc_s" #else - r = "%{shared-libgcc:-lgcc_s%M}%{!shared-libgcc:libgcc.a%s}"; + "-lgcc_s%M" #endif - obstack_grow (&obstack, r, strlen(r)); + , + "libgcc.a%s"); p += 10; in_sep = 0; } |