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/PowerPC/PPCTargetAsmInfo.cpp b/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
index e593482..8728def 100644
--- a/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
+++ b/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
@@ -50,6 +50,7 @@
StaticCtorsSection = ".mod_init_func";
StaticDtorsSection = ".mod_term_func";
}
+ SwitchToSectionDirective = "\t.section ";
UsedDirective = "\t.no_dead_strip\t";
WeakDefDirective = "\t.weak_definition ";
WeakRefDirective = "\t.weak_reference ";
diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp
index 8f48162..b0e8165 100644
--- a/lib/Target/X86/X86AsmPrinter.cpp
+++ b/lib/Target/X86/X86AsmPrinter.cpp
@@ -358,7 +358,8 @@
O << "\n";
- if (ExceptionHandling && TAI->doesSupportExceptionHandling() && MMI) {
+ if (ExceptionHandling && TAI->doesSupportExceptionHandling() && MMI &&
+ !Subtarget->is64Bit()) {
// Add the (possibly multiple) personalities to the set of global values.
const std::vector<Function *>& Personalities = MMI->getPersonalities();
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";