gcc.c (version_compare_spec_function): Use fatal() rather than abort().
authorGeoffrey Keating <geoffk@apple.com>
Tue, 15 Nov 2005 04:55:12 +0000 (04:55 +0000)
committerGeoffrey Keating <geoffk@gcc.gnu.org>
Tue, 15 Nov 2005 04:55:12 +0000 (04:55 +0000)
* gcc.c (version_compare_spec_function): Use fatal() rather than
abort().

* config/rs6000/darwin.h (DARWIN_CRT2_SPEC): New.
(SUBTARGET_EXTRA_SPECS): Define %(darwin_crt2).
* config/i386/darwin.h (SUBTARGET_EXTRA_SPECS): Define %(darwin_crt2)
as empty.
* config/darwin.h (STARTFILE_SPEC): Use %(darwin_crt2) to possibly
link in crt2.o.

* config/darwin.h (REAL_LIBGCC_SPEC): Link in shared libgcc depending
on -mmacosx-version-min setting.

From-SVN: r106935

gcc/ChangeLog
gcc/config/darwin.h
gcc/config/i386/darwin.h
gcc/config/rs6000/darwin.h
gcc/gcc.c

index 804e6b5..1447c73 100644 (file)
@@ -1,3 +1,18 @@
+2005-11-14  Geoffrey Keating  <geoffk@apple.com>
+
+       * gcc.c (version_compare_spec_function): Use fatal() rather than
+       abort().
+
+       * config/rs6000/darwin.h (DARWIN_CRT2_SPEC): New.
+       (SUBTARGET_EXTRA_SPECS): Define %(darwin_crt2).
+       * config/i386/darwin.h (SUBTARGET_EXTRA_SPECS): Define %(darwin_crt2)
+       as empty.
+       * config/darwin.h (STARTFILE_SPEC): Use %(darwin_crt2) to possibly
+       link in crt2.o.
+       
+       * config/darwin.h (REAL_LIBGCC_SPEC): Link in shared libgcc depending
+       on -mmacosx-version-min setting.
+
 2005-11-14  Diego Novillo  <dnovillo@redhat.com>
 
        PR 24840
index a4b79c6..5b17c34 100644 (file)
@@ -302,23 +302,31 @@ Boston, MA 02110-1301, USA.  */
 
 #define LIB_SPEC "%{!static:-lSystem}"
 
-/* -dynamiclib implies -shared-libgcc just like -shared would on linux.  
-   Support -mmacosx-version-min by supplying different (stub) libgcc_s.dylib
-   libraries to link against.  */
+/* Support -mmacosx-version-min by supplying different (stub) libgcc_s.dylib
+   libraries to link against, and by not linking against libgcc_s on
+   earlier-than-10.3.9.
+
+   Note that by default, -lgcc_eh is not linked against!  This is
+   because in a future version of Darwin the EH frame information may
+   be in a new format, or the fallback routine might be changed; if
+   you want to explicitly link against the static version of those
+   routines, because you know you don't need to unwind through system
+   libraries, you need to explicitly say -static-libgcc.  
+   
+   If it is linked against, it has to be before -lgcc, because it may
+   need symbols from -lgcc.  */
 #undef REAL_LIBGCC_SPEC
-#define REAL_LIBGCC_SPEC                                               \
-   "%{static|static-libgcc:-lgcc -lgcc_eh;                             \
-      :%{shared-libgcc|Zdynamiclib                                     \
-         :%:version-compare(!> 10.5 mmacosx-version-min= -lgcc_s.10.4) \
-          %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_s.10.5) \
-          -lgcc;                                                       \
-         :-lgcc -lgcc_eh}}"
-
+#define REAL_LIBGCC_SPEC                                                  \
+   "%{static-libgcc|static: -lgcc_eh -lgcc;                               \
+      shared-libgcc|fexceptions:                                          \
+       %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_s.10.4)       \
+       %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_s.10.5)       \
+       -lgcc;                                                             \
+      :%:version-compare(>< 10.3.9 10.5 mmacosx-version-min= -lgcc_s.10.4) \
+       %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_s.10.5)       \
+       -lgcc}"
+                        
 /* We specify crt0.o as -lcrt0.o so that ld will search the library path.  */
-/* We don't want anything to do with crt2.o in the 64-bit case;
-   testing the PowerPC-specific -m64 flag here is a little irregular,
-   but it's overkill to make copies of this spec for each target
-   arch.  */
 
 #undef  STARTFILE_SPEC
 #define STARTFILE_SPEC  \
@@ -326,11 +334,11 @@ Boston, MA 02110-1301, USA.  */
      %{!Zbundle:%{pg:%{static:-lgcrt0.o} \
                      %{!static:%{object:-lgcrt0.o} \
                                %{!object:%{preload:-lgcrt0.o} \
-                                 %{!preload:-lgcrt1.o %{!m64: crt2.o%s}}}}} \
+                                 %{!preload:-lgcrt1.o %(darwin_crt2)}}}} \
                 %{!pg:%{static:-lcrt0.o} \
                       %{!static:%{object:-lcrt0.o} \
                                 %{!object:%{preload:-lcrt0.o} \
-                                  %{!preload:-lcrt1.o %{!m64: crt2.o%s}}}}}}}"
+                                  %{!preload:-lcrt1.o %(darwin_crt2)}}}}}}"
 
 /* The native Darwin linker doesn't necessarily place files in the order
    that they're specified on the link line.  Thus, it is pointless
index 7e8b2dc..8997233 100644 (file)
@@ -50,6 +50,7 @@ Boston, MA 02110-1301, USA.  */
 #undef SUBTARGET_EXTRA_SPECS
 #define SUBTARGET_EXTRA_SPECS                                  \
   { "darwin_arch", "i386" },                                   \
+  { "darwin_crt2", "" },                                       \
   { "darwin_subarch", "i386" },
 
 /* Use the following macro for any Darwin/x86-specific command-line option
index 0d633ef..d1635ff 100644 (file)
@@ -124,9 +124,14 @@ do {                                                                       \
    mcpu=G5:ppc970;                             \
    :ppc}}"
 
+/* crt2.o is at least partially required for 10.3.x and earlier.  */
+#define DARWIN_CRT2_SPEC \
+  "%{!m64:%:version-compare(!> 10.4 mmacosx-version-min= crt2.o%s)}"
+
 #undef SUBTARGET_EXTRA_SPECS
 #define SUBTARGET_EXTRA_SPECS                  \
   { "darwin_arch", "%{m64:ppc64;:ppc}" },      \
+  { "darwin_crt2", DARWIN_CRT2_SPEC },         \
   { "darwin_subarch", DARWIN_SUBARCH_SPEC },
 
 /* Output a .machine directive.  */
index 7bc6ac9..a644d08 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -7699,13 +7699,13 @@ version_compare_spec_function (int argc, const char **argv)
   bool result;
 
   if (argc < 3)
-    abort ();
+    fatal ("too few arguments to %%:version-compare");
   if (argv[0][0] == '\0')
     abort ();
   if ((argv[0][1] == '<' || argv[0][1] == '>') && argv[0][0] != '!')
     nargs = 2;
   if (argc != nargs + 3)
-    abort ();
+    fatal ("too many arguments to %%:version-compare");
 
   switch_len = strlen (argv[nargs + 1]);
   for (i = 0; i < n_switches; i++)
@@ -7746,7 +7746,7 @@ version_compare_spec_function (int argc, const char **argv)
       break;
 
     default:
-      abort ();
+      fatal ("unknown operator %qs in %%:version-compare", argv[0]);
     }
   if (! result)
     return NULL;