C++ exceptions for 64-bit Darwin

Stan Shebs shebs@apple.com
Wed Jan 5 18:37:00 GMT 2005


Four more patches for 64-bit Darwin, three of them for C++ EH, and
one overlooked a while back. These knock off a bunch of failures in
the C++ part of the testsuite, though not all.

Stan

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.

Index: unwind-dw2-fde-darwin.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/unwind-dw2-fde-darwin.c,v
retrieving revision 1.7
diff -p -r1.7 unwind-dw2-fde-darwin.c
*** unwind-dw2-fde-darwin.c    1 Nov 2003 09:59:50 -0000    1.7
--- unwind-dw2-fde-darwin.c    5 Jan 2005 18:01:41 -0000
*************** extern void _keymgr_set_and_unlock_proce
*** 57,64 ****
--- 57,67 ----
  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 {
*************** examine_objects (void *pc, struct dwarf_
*** 151,161 ****
--- 154,174 ----
      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;
        }
Index: config/darwin.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin.c,v
retrieving revision 1.102
diff -p -r1.102 darwin.c
*** config/darwin.c    3 Jan 2005 23:26:47 -0000    1.102
--- config/darwin.c    5 Jan 2005 18:01:41 -0000
*************** darwin_assemble_visibility (tree decl, i
*** 1358,1378 ****
  static int darwin_dwarf_label_counter;
 
  void
! darwin_asm_output_dwarf_delta (FILE *file, int size ATTRIBUTE_UNUSED,
                     const char *lab1, const char *lab2)
  {
    int islocaldiff = (lab1[0] == '*' && lab1[1] == 'L'
               && lab2[0] == '*' && lab2[1] == 'L');
 
    if (islocaldiff)
      fprintf (file, "\t.set L$set$%d,", darwin_dwarf_label_counter);
    else
!     fprintf (file, "\t%s\t", ".long");
    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++);
  }
 
  void
--- 1358,1379 ----
  static int darwin_dwarf_label_counter;
 
  void
! 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", directive);
    assemble_name_raw (file, lab1);
    fprintf (file, "-");
    assemble_name_raw (file, lab2);
    if (islocaldiff)
!     fprintf (file, "\n\t%s L$set$%d", directive, 
darwin_dwarf_label_counter++);
  }
 
  void
Index: config/darwin.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin.h,v
retrieving revision 1.109
diff -p -r1.109 darwin.h
*** config/darwin.h    2 Dec 2004 18:42:24 -0000    1.109
--- config/darwin.h    5 Jan 2005 18:01:42 -0000
*************** extern const char *darwin_fix_and_contin
*** 322,327 ****
--- 322,331 ----
        %{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  \
*************** extern const char *darwin_fix_and_contin
*** 329,339 ****
       %{!Zbundle:%{pg:%{static:-lgcrt0.o} \
                       %{!static:%{object:-lgcrt0.o} \
                                 %{!object:%{preload:-lgcrt0.o} \
!                                  %{!preload:-lgcrt1.o crt2.o%s}}}} \
                  %{!pg:%{static:-lcrt0.o} \
                        %{!static:%{object:-lcrt0.o} \
                                  %{!object:%{preload:-lcrt0.o} \
!                                   %{!preload:-lcrt1.o 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
--- 333,343 ----
       %{!Zbundle:%{pg:%{static:-lgcrt0.o} \
                       %{!static:%{object:-lgcrt0.o} \
                                 %{!object:%{preload:-lgcrt0.o} \
!                                  %{!preload:-lgcrt1.o %{!m64: 
crt2.o%s}}}}} \
                  %{!pg:%{static:-lcrt0.o} \
                        %{!static:%{object:-lcrt0.o} \
                                  %{!object:%{preload:-lcrt0.o} \
!                                   %{!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
*************** enum machopic_addr_class {
*** 989,995 ****
  #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) : \
       ((CODE) == 1 || (GLOBAL) == 0) ? DW_EH_PE_pcrel : DW_EH_PE_absptr)
 
  #define ASM_OUTPUT_DWARF_DELTA(FILE,SIZE,LABEL1,LABEL2)  \
--- 993,999 ----
  #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_sdata4) : \
       ((CODE) == 1 || (GLOBAL) == 0) ? DW_EH_PE_pcrel : DW_EH_PE_absptr)
 
  #define ASM_OUTPUT_DWARF_DELTA(FILE,SIZE,LABEL1,LABEL2)  \



More information about the Gcc-patches mailing list