* gcc.c (LIBGCC_SPEC): If REAL_LIBGCC_SPEC is defined, and
authoraustern <austern@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 19 Feb 2004 05:52:38 +0000 (05:52 +0000)
committeraustern <austern@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 19 Feb 2004 05:52:38 +0000 (05:52 +0000)
LIBGCC_SPEC isn't, set LIBGCC_SPEC to REAL_LIBGCC_SPEC.
(init_gcc_spec): Don't define or call if REAL_LIBGCC_SPEC is
defined.  Instead use REAL_LIBGCC_SPEC, unmodifed, as the libgcc
spec string.
* doc/tm.texi (REAL_LIBGCC_SPEC): Document.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@78072 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/doc/tm.texi
gcc/gcc.c

index a32d3f8..eb59a5e 100644 (file)
@@ -1,3 +1,12 @@
+2003-02-18  Matt Austern  <austern@apple.com>
+
+       * gcc.c (LIBGCC_SPEC): If REAL_LIBGCC_SPEC is defined, and
+       LIBGCC_SPEC isn't, set LIBGCC_SPEC to REAL_LIBGCC_SPEC.
+       (init_gcc_spec): Don't define or call if REAL_LIBGCC_SPEC is
+       defined.  Instead use REAL_LIBGCC_SPEC, unmodifed, as the libgcc
+       spec string.
+       * doc/tm.texi (REAL_LIBGCC_SPEC): Document.
+       
 2004-02-18  Zack Weinberg  <zack@codesourcery.com>
 
        * dwarf2out.c (loclabel_num): Move outside #ifdef
index a141627..395eec8 100644 (file)
@@ -293,6 +293,18 @@ If this macro is not defined, the GCC driver provides a default that
 passes the string @option{-lgcc} to the linker.
 @end defmac
 
+@defmac REAL_LIBGCC_SPEC
+By default, if @code{ENABLE_SHARED_LIBGCC} is defined, the
+@code{LIBGCC_SPEC} is not directly used by the driver program but is
+instead modified to refer to different versions of @file{libgcc.a}
+depending on the values of the command line flags @code{-static},
+@code{-shared}, @code{-static-libgcc}, and @code{-shared-libgcc}.  On
+targets where these modifications are inappropriate, define
+@code{REAL_LIBGCC_SPEC} instead.  @code{REAL_LIBGCC_SPEC} tells the
+driver how to place a reference to @file{libgcc} on the link command
+line, but, unlike @code{LIBGCC_SPEC}, it is used unmodified.
+@end defmac
+
 @defmac STARTFILE_SPEC
 Another C string constant used much like @code{LINK_SPEC}.  The
 difference between the two is that @code{STARTFILE_SPEC} is used at
index 3403220..ebefeb8 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -345,7 +345,7 @@ static int execute (void);
 static void alloc_args (void);
 static void clear_args (void);
 static void fatal_error (int);
-#ifdef ENABLE_SHARED_LIBGCC
+#if defined(ENABLE_SHARED_LIBGCC) && !defined(REAL_LIBGCC_SPEC)
 static void init_gcc_specs (struct obstack *, const char *, const char *,
                            const char *);
 #endif
@@ -598,7 +598,9 @@ proper position among the other output files.  */
 /* config.h can define LIBGCC_SPEC to override how and when libgcc.a is
    included.  */
 #ifndef LIBGCC_SPEC
-#if defined(LINK_LIBGCC_SPECIAL) || defined(LINK_LIBGCC_SPECIAL_1)
+#if defined(REAL_LIBGCC_SPEC)
+#define LIBGCC_SPEC REAL_LIBGCC_SPEC
+#elif defined(LINK_LIBGCC_SPECIAL) || defined(LINK_LIBGCC_SPECIAL_1)
 /* Have gcc do the search for libgcc.a.  */
 #define LIBGCC_SPEC "libgcc.a%s"
 #else
@@ -1522,7 +1524,7 @@ static int processing_spec_function;
 /* Add appropriate libgcc specs to OBSTACK, taking into account
    various permutations of -shared-libgcc, -shared, and such.  */
 
-#ifdef ENABLE_SHARED_LIBGCC
+#if defined(ENABLE_SHARED_LIBGCC) && !defined(REAL_LIBGCC_SPEC)
 static void
 init_gcc_specs (struct obstack *obstack, const char *shared_name,
                const char *static_name, const char *eh_name)
@@ -1589,7 +1591,7 @@ init_spec (void)
       next = sl;
     }
 
-#ifdef ENABLE_SHARED_LIBGCC
+#if defined(ENABLE_SHARED_LIBGCC) && !defined(REAL_LIBGCC_SPEC)
   /* ??? If neither -shared-libgcc nor --static-libgcc was
      seen, then we should be making an educated guess.  Some proposed
      heuristics for ELF include: