OSDN Git Service

* darwin.h (ASM_OUTPUT_LABELREF): Handle quoted non-lazy pointers
[pf3gnuchains/gcc-fork.git] / gcc / config / darwin.h
index c1d6b8f..96a501a 100644 (file)
@@ -1,5 +1,6 @@
 /* Target definitions for Darwin (Mac OS X) systems.
-   Copyright (C) 1989, 1990, 1991, 1992, 1993, 2000, 2001, 2002, 2003, 2004
+   Copyright (C) 1989, 1990, 1991, 1992, 1993, 2000, 2001, 2002, 2003, 2004,
+   2005
    Free Software Foundation, Inc.
    Contributed by Apple Computer Inc.
 
@@ -116,6 +117,8 @@ Boston, MA 02111-1307, USA.  */
   { "-dynamic", "-Zdynamic" },  \
   { "-dynamiclib", "-Zdynamiclib" },  \
   { "-exported_symbols_list", "-Zexported_symbols_list" },  \
+  { "-gfull", "-g -fno-eliminate-unused-debug-symbols" }, \
+  { "-gused", "-g -feliminate-unused-debug-symbols" }, \
   { "-segaddr", "-Zsegaddr" }, \
   { "-segs_read_only_addr", "-Zsegs_read_only_addr" }, \
   { "-segs_read_write_addr", "-Zsegs_read_write_addr" }, \
@@ -137,24 +140,6 @@ Boston, MA 02111-1307, USA.  */
   { "-unexported_symbols_list", "-Zunexported_symbols_list" }, \
   SUBTARGET_OPTION_TRANSLATE_TABLE
 
-/* Nonzero if the user has chosen to force sizeof(bool) to be 1
-   by providing the -mone-byte-bool switch.  It would be better
-   to use SUBTARGET_SWITCHES for this instead of SUBTARGET_OPTIONS,
-   but there are no more bits in rs6000 TARGET_SWITCHES.  Note
-   that this switch has no "no-" variant. */
-extern const char *darwin_one_byte_bool;
-  
-extern int darwin_fix_and_continue;
-extern const char *darwin_fix_and_continue_switch;
-
-#undef SUBTARGET_OPTIONS
-#define SUBTARGET_OPTIONS \
-  {"one-byte-bool", &darwin_one_byte_bool, N_("Set sizeof(bool) to 1"), 0 }, \
-  {"fix-and-continue", &darwin_fix_and_continue_switch,                        \
-   N_("Generate code suitable for fast turn around debugging"), 0},    \
-  {"no-fix-and-continue", &darwin_fix_and_continue_switch,             \
-   N_("Don't generate code suitable for fast turn around debugging"), 0}
-
 /* These compiler options take n arguments.  */
 
 #undef  WORD_SWITCH_TAKES_ARG
@@ -223,7 +208,7 @@ extern const char *darwin_fix_and_continue_switch;
     %{!Zdynamiclib:%{A} %{e*} %{m} %{N} %{n} %{r} %{u*} %{x} %{z}} \
     %{@:-o %f%u.out}%{!@:%{o*}%{!o:-o a.out}} \
     %{!Zdynamiclib:%{!A:%{!nostdlib:%{!nostartfiles:%S}}}} \
-    %{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate:-lgcov} \
+    %{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate|coverage:-lgcov} \
     %{!nostdlib:%{!nodefaultlibs:%G %L}} \
     %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} %{F*} }}}}}}}}"
 
@@ -316,10 +301,14 @@ extern const char *darwin_fix_and_continue_switch;
 #define REAL_LIBGCC_SPEC \
    "%{static|static-libgcc:-lgcc -lgcc_eh}\
     %{!static:%{!static-libgcc:\
-      %{!Zdynamiclib:%{!shared-libgcc:-lgcc  -lgcc_eh}\
-      %{shared-libgcc:-lgcc_s -lgcc} } %{Zdynamiclib:-lgcc_s}}}"
+      %{!Zdynamiclib:%{!shared-libgcc:-lgcc -lgcc_eh}\
+      %{shared-libgcc:-lgcc_s -lgcc}} %{Zdynamiclib:-lgcc_s -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  \
@@ -327,11 +316,11 @@ extern const char *darwin_fix_and_continue_switch;
      %{!Zbundle:%{pg:%{static:-lgcrt0.o} \
                      %{!static:%{object:-lgcrt0.o} \
                                %{!object:%{preload:-lgcrt0.o} \
-                                 %{!preload:-lgcrt1.o crt2.o%s}}}} \
+                                 %{!preload:-lgcrt1.o %{!m64: crt2.o%s}}}}} \
                 %{!pg:%{static:-lcrt0.o} \
                       %{!static:%{object:-lcrt0.o} \
                                 %{!object:%{preload:-lcrt0.o} \
-                                  %{!preload:-lcrt1.o crt2.o%s}}}}}}"
+                                  %{!preload:-lcrt1.o %{!m64: crt2.o%s}}}}}}}"
 
 /* The native Darwin linker doesn't necessarily place files in the order
    that they're specified on the link line.  Thus, it is pointless
@@ -385,7 +374,7 @@ extern const char *darwin_fix_and_continue_switch;
   do {                                                                 \
     if (ALIAS)                                                         \
       {                                                                        \
-       warning ("alias definitions not supported in Mach-O; ignored"); \
+       warning (0, "alias definitions not supported in Mach-O; ignored");      \
        break;                                                          \
       }                                                                        \
                                                                        \
@@ -408,10 +397,6 @@ extern const char *darwin_fix_and_continue_switch;
    links to, so there's no need for weak-ness for that.  */
 #define GTHREAD_USE_WEAK 0
 
-/* We support hidden visibility */
-#undef TARGET_SUPPORTS_HIDDEN
-#define TARGET_SUPPORTS_HIDDEN 1
-
 /* The Darwin linker imposes two limitations on common symbols: they 
    can't have hidden visibility, and they can't appear in dylibs.  As
    a consequence, we should never use common symbols to represent 
@@ -548,7 +533,12 @@ extern const char *darwin_fix_and_continue_switch;
             machopic_validate_stub_or_non_lazy_ptr (xname);                 \
           else if (len > 14 && !strcmp ("$non_lazy_ptr", xname + len - 13)) \
             machopic_validate_stub_or_non_lazy_ptr (xname);                 \
-          fputs (&xname[1], FILE);                                          \
+          else if (len > 15 && !strcmp ("$non_lazy_ptr\"", xname + len - 14)) \
+            machopic_validate_stub_or_non_lazy_ptr (xname);                 \
+          if (xname[1] != '"' && name_needs_quotes (&xname[1]))             \
+            fprintf (FILE, "\"%s\"", &xname[1]);                            \
+          else                                                              \
+            fputs (&xname[1], FILE);                                        \
         }                                                                   \
        else if (xname[0] == '+' || xname[0] == '-')                         \
          fprintf (FILE, "\"%s\"", xname);                                   \
@@ -556,6 +546,8 @@ extern const char *darwin_fix_and_continue_switch;
          fprintf (FILE, "L%s", xname);                                      \
        else if (!strncmp (xname, ".objc_class_name_", 17))                  \
         fprintf (FILE, "%s", xname);                                        \
+       else if (xname[0] != '"' && name_needs_quotes (xname))               \
+        fprintf (FILE, "\"%s\"", xname);                                    \
        else                                                                 \
          asm_fprintf (FILE, "%U%s", xname);                                 \
   } while (0)
@@ -582,9 +574,11 @@ extern const char *darwin_fix_and_continue_switch;
 #undef ASM_OUTPUT_ALIGNED_DECL_LOCAL                                   
 #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN)   \
   do {                                                                 \
+    unsigned HOST_WIDE_INT _new_size = SIZE;                           \
     fputs (".lcomm ", (FILE));                                         \
     assemble_name ((FILE), (NAME));                                    \
-    fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", (SIZE),   \
+    if (_new_size == 0) _new_size = 1;                                 \
+    fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", _new_size,        \
             floor_log2 ((ALIGN) / BITS_PER_UNIT));                     \
     if ((DECL) && ((TREE_STATIC (DECL)                                 \
         && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL)))               \
@@ -616,6 +610,10 @@ FUNCTION (void)                                                            \
       if (asm_out_file)                                                        \
        fputs ("\t" DIRECTIVE "\n", asm_out_file);                      \
       in_section = SECTION;                                            \
+      if ((SECTION == in_text_coal)                                     \
+         || (SECTION == in_text_unlikely)                              \
+         || (SECTION == in_text_unlikely_coal))                        \
+        last_text_section = SECTION;                                    \
     }                                                                  \
 }                                                                      \
 
@@ -655,10 +653,6 @@ SECTION_FUNCTION (text_coal_section,                               \
                  in_text_coal,                                 \
                  ".section __TEXT,__textcoal_nt,coalesced,"    \
                    "pure_instructions", 0)                     \
-SECTION_FUNCTION (text_unlikely_section,                       \
-                 in_text_unlikely,                             \
-                 ".section __TEXT,__text_unlikely,coalesced,"  \
-                   "pure_instructions", 0)                     \
 SECTION_FUNCTION (text_unlikely_coal_section,                  \
                  in_text_unlikely_coal,                        \
                  ".section __TEXT,__text_unlikely_coal,"       \
@@ -991,7 +985,7 @@ enum machopic_addr_class {
 #undef ASM_PREFERRED_EH_DATA_FORMAT
 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)  \
   (((CODE) == 2 && (GLOBAL) == 1) \
-   ? (DW_EH_PE_pcrel | DW_EH_PE_indirect) : \
+   ? (DW_EH_PE_pcrel | DW_EH_PE_indirect | DW_EH_PE_sdata4) : \
      ((CODE) == 1 || (GLOBAL) == 0) ? DW_EH_PE_pcrel : DW_EH_PE_absptr)
 
 #define ASM_OUTPUT_DWARF_DELTA(FILE,SIZE,LABEL1,LABEL2)  \
@@ -1003,6 +997,12 @@ enum machopic_addr_class {
        goto DONE;                                                                      \
       }
 
+/* Experimentally, putting jump tables in text is faster on SPEC.
+   Also this is needed for correctness for coalesced functions.  */
+
+#ifndef JUMP_TABLES_IN_TEXT_SECTION
+#define JUMP_TABLES_IN_TEXT_SECTION 1
+#endif
 
 #define TARGET_TERMINATE_DW2_EH_FRAME_INFO false