From: Bill Wendling Date: Wed, 24 Dec 2008 05:25:49 +0000 (+0000) Subject: GCC doesn't emit DW_EH_PE_sdata4 for the FDE encoding on Darwin. I'm not sure X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d4121bef3cf3af51b80c2d499085a96aca5982ed;p=oota-llvm.git GCC doesn't emit DW_EH_PE_sdata4 for the FDE encoding on Darwin. I'm not sure about other platforms. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61415 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Target/TargetAsmInfo.h b/include/llvm/Target/TargetAsmInfo.h index d4aadb964bd..6080619c368 100644 --- a/include/llvm/Target/TargetAsmInfo.h +++ b/include/llvm/Target/TargetAsmInfo.h @@ -448,6 +448,11 @@ namespace llvm { /// bool DwarfRequiresFrameSection; // Defaults to true. + /// FDEEncodingRequiresSData4 - If set, the FDE Encoding in the EH section + /// includes DW_EH_PE_sdata4. + /// + bool FDEEncodingRequiresSData4; // Defaults to true + /// GlobalEHDirective - This is the directive used to make exception frame /// tables globally visible. /// @@ -814,6 +819,9 @@ namespace llvm { bool doesDwarfRequireFrameSection() const { return DwarfRequiresFrameSection; } + bool doesFDEEncodingRequireSData4() const { + return FDEEncodingRequiresSData4; + } const char *getGlobalEHDirective() const { return GlobalEHDirective; } diff --git a/lib/CodeGen/AsmPrinter/DwarfWriter.cpp b/lib/CodeGen/AsmPrinter/DwarfWriter.cpp index d22bbb2f2c2..42ed34879e3 100644 --- a/lib/CodeGen/AsmPrinter/DwarfWriter.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfWriter.cpp @@ -3017,13 +3017,25 @@ private: Asm->EmitInt8(DW_EH_PE_pcrel | DW_EH_PE_sdata4); Asm->EOL("LSDA Encoding (pcrel sdata4)"); - Asm->EmitInt8(DW_EH_PE_pcrel | DW_EH_PE_sdata4); - Asm->EOL("FDE Encoding (pcrel sdata4)"); + + if (TAI->doesFDEEncodingRequireSData4()) { + Asm->EmitInt8(DW_EH_PE_pcrel | DW_EH_PE_sdata4); + Asm->EOL("FDE Encoding (pcrel sdata4)"); + } else { + Asm->EmitInt8(DW_EH_PE_pcrel); + Asm->EOL("FDE Encoding (pcrel)"); + } } else { Asm->EmitULEB128Bytes(1); Asm->EOL("Augmentation Size"); - Asm->EmitInt8(DW_EH_PE_pcrel | DW_EH_PE_sdata4); - Asm->EOL("FDE Encoding (pcrel sdata4)"); + + if (TAI->doesFDEEncodingRequireSData4()) { + Asm->EmitInt8(DW_EH_PE_pcrel | DW_EH_PE_sdata4); + Asm->EOL("FDE Encoding (pcrel sdata4)"); + } else { + Asm->EmitInt8(DW_EH_PE_pcrel); + Asm->EOL("FDE Encoding (pcrel)"); + } } // Indicate locations of general callee saved registers in frame. diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp index d79652ac566..b6adbe7ac12 100644 --- a/lib/Target/TargetAsmInfo.cpp +++ b/lib/Target/TargetAsmInfo.cpp @@ -99,6 +99,7 @@ void TargetAsmInfo::fillDefaultValues() { SupportsDebugInformation = false; SupportsExceptionHandling = false; DwarfRequiresFrameSection = true; + FDEEncodingRequiresSData4 = true; GlobalEHDirective = 0; SupportsWeakOmittedEHFrame = true; DwarfSectionOffsetDirective = 0; diff --git a/lib/Target/X86/X86TargetAsmInfo.cpp b/lib/Target/X86/X86TargetAsmInfo.cpp index e3336509a76..0dfb8550f6d 100644 --- a/lib/Target/X86/X86TargetAsmInfo.cpp +++ b/lib/Target/X86/X86TargetAsmInfo.cpp @@ -70,6 +70,7 @@ X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM): COMMDirectiveTakesAlignment = (Subtarget->getDarwinVers() >= 9); HasDotTypeDotSizeDirective = false; HasSingleParameterDotFile = false; + FDEEncodingRequiresSData4 = false; if (TM.getRelocationModel() == Reloc::Static) { StaticCtorsSection = ".constructor"; StaticDtorsSection = ".destructor";