unwind-dw2-fde-darwin.c (examine_objects): Use 64-bit Mach-O getters if ppc64.
authorStan Shebs <shebs@apple.com>
Wed, 5 Jan 2005 18:39:43 +0000 (18:39 +0000)
committerStan Shebs <shebs@gcc.gnu.org>
Wed, 5 Jan 2005 18:39:43 +0000 (18:39 +0000)
        * unwind-dw2-fde-darwin.c (examine_objects): Use 64-bit
        Mach-O getters if ppc64.
        * config/darwin.c (darwin_asm_output_dwarf_delta): Obey
        size argument.
        * config/darwin.h (ASM_PREFERRED_EH_DATA_FORMAT): Use
        signed four-byte field for global code case.
        (STARTFILE_SPEC): Avoid crt2.o for 64-bit compilation.

From-SVN: r92962

gcc/ChangeLog
gcc/config/darwin.c
gcc/config/darwin.h
gcc/unwind-dw2-fde-darwin.c

index 7589a23c83c8a7a1123a27cfef8f19bdf728a96b..442e06d543e77c5cfb463eafab60284adc10b0b3 100644 (file)
@@ -1,3 +1,13 @@
+2005-01-05  Stan Shebs  <shebs@apple.com>
+
+       * unwind-dw2-fde-darwin.c (examine_objects): Use 64-bit
+       Mach-O getters if ppc64.
+       * config/darwin.c (darwin_asm_output_dwarf_delta): Obey
+       size argument.
+       * config/darwin.h (ASM_PREFERRED_EH_DATA_FORMAT): Use
+       signed four-byte field for global code case.
+       (STARTFILE_SPEC): Avoid crt2.o for 64-bit compilation.
+
 2005-01-05  Roger Sayle  <roger@eyesopen.com>
 
        PR middle-end/19100
index b95c438988eba9d9b05a9c42a5ee18fd1ef812fc..cb3ba0a42e475d16c553762f9df4414686a72423 100644 (file)
@@ -1358,21 +1358,22 @@ darwin_assemble_visibility (tree decl, int vis)
 static int darwin_dwarf_label_counter;
 
 void
-darwin_asm_output_dwarf_delta (FILE *file, int size ATTRIBUTE_UNUSED,
+darwin_asm_output_dwarf_delta (FILE *file, int size,
                               const char *lab1, const char *lab2)
 {
   int islocaldiff = (lab1[0] == '*' && lab1[1] == 'L'
                     && lab2[0] == '*' && lab2[1] == 'L');
+  char *directive = (size == 8 ? ".quad" : ".long");
 
   if (islocaldiff)
     fprintf (file, "\t.set L$set$%d,", darwin_dwarf_label_counter);
   else
-    fprintf (file, "\t%s\t", ".long");
+    fprintf (file, "\t%s\t", directive);
   assemble_name_raw (file, lab1);
   fprintf (file, "-");
   assemble_name_raw (file, lab2);
   if (islocaldiff)
-    fprintf (file, "\n\t.long L$set$%d", darwin_dwarf_label_counter++);
+    fprintf (file, "\n\t%s L$set$%d", directive, darwin_dwarf_label_counter++);
 }
 
 void
index 6afa6be568653c27fcc5808f8b2a55f9d64624bd..37a5e7c6da8cad7e0725d8b6bb99bbe058bb0f7b 100644 (file)
@@ -322,6 +322,10 @@ extern const char *darwin_fix_and_continue_switch;
       %{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  \
@@ -329,11 +333,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
@@ -989,7 +993,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)  \
index 24cf3bca7e999e94018230936eacd6cb7d390c06..12c9ed377f0e5dad2623a7ef54cfda23ce0c2b8e 100644 (file)
@@ -57,8 +57,11 @@ extern void _keymgr_set_and_unlock_processwide_ptr (int, void *);
 extern void _keymgr_unlock_processwide_ptr (int);
 
 struct mach_header;
+struct mach_header_64;
 extern char *getsectdatafromheader (struct mach_header*, const char*,
                        const char *, unsigned long *);
+extern char *getsectdatafromheader_64 (struct mach_header*, const char*,
+                       const char *, unsigned long *);
 
 /* This is referenced from KEYMGR_GCC3_DW2_OBJ_LIST.  */
 struct km_object_info {
@@ -151,11 +154,21 @@ examine_objects (void *pc, struct dwarf_eh_bases *bases, int dont_alloc)
        char *fde;
        unsigned long sz;
 
+#ifdef __ppc64__
+       fde = getsectdatafromheader_64 ((struct mach_header_64 *) image->mh,
+                                    "__DATA", "__eh_frame", &sz);
+#else
        fde = getsectdatafromheader (image->mh, "__DATA", "__eh_frame", &sz);
+#endif
        if (fde == NULL)
          {
+#ifdef __ppc64__
+           fde = getsectdatafromheader_64 ((struct mach_header_64 *) image->mh,
+                                        "__TEXT", "__eh_frame", &sz);
+#else
            fde = getsectdatafromheader (image->mh, "__TEXT",
                                         "__eh_frame", &sz);
+#endif
            if (fde != NULL)
              image->examined_p |= IMAGE_IS_TEXT_MASK;
          }