Fix and enable EH for x86-64 Darwin.  Adds
ShortenEHDataFor64Bits as a not-very-accurate
abstraction to cover all the changes in DwarfWriter.
Some cosmetic changes to Darwin assembly code for
gcc testsuite compatibility.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46029 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/X86/X86TargetAsmInfo.cpp b/lib/Target/X86/X86TargetAsmInfo.cpp
index bc698ba..293836a 100644
--- a/lib/Target/X86/X86TargetAsmInfo.cpp
+++ b/lib/Target/X86/X86TargetAsmInfo.cpp
@@ -59,6 +59,7 @@
       SixteenByteConstantSection = "\t.literal16\n";
     ReadOnlySection = "\t.const\n";
     LCOMMDirective = "\t.lcomm\t";
+    SwitchToSectionDirective = "\t.section ";
     COMMDirectiveTakesAlignment = false;
     HasDotTypeDotSizeDirective = false;
     if (TM.getRelocationModel() == Reloc::Static) {
@@ -68,8 +69,13 @@
       StaticCtorsSection = ".mod_init_func";
       StaticDtorsSection = ".mod_term_func";
     }
-    PersonalityPrefix = "L";
-    PersonalitySuffix = "$non_lazy_ptr";
+    if (Subtarget->is64Bit()) {
+      PersonalityPrefix = "";
+      PersonalitySuffix = "+4@GOTPCREL";
+    } else {
+      PersonalityPrefix = "L";
+      PersonalitySuffix = "$non_lazy_ptr";
+    }
     NeedsIndirectEncoding = true;
     InlineAsmStart = "# InlineAsm Start";
     InlineAsmEnd = "# InlineAsm End";
@@ -102,11 +108,12 @@
     DwarfMacInfoSection = ".section __DWARF,__debug_macinfo,regular,debug";
 
     // Exceptions handling
-    if (!Subtarget->is64Bit())
-      SupportsExceptionHandling = true;
+    SupportsExceptionHandling = true;
     GlobalEHDirective = "\t.globl\t";
     SupportsWeakOmittedEHFrame = false;
     AbsoluteEHSectionOffsets = false;
+    if (Subtarget->is64Bit())
+      ShortenEHDataOn64Bit = true;
     DwarfEHFrameSection =
     ".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support";
     DwarfExceptionSection = ".section __DATA,__gcc_except_tab";