From ef4a661725716c60b49c40eed5225cac52f877e9 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Tue, 11 Sep 2007 17:20:55 +0000 Subject: [PATCH] Add a bool to indicate if we should set the "indirect encoding" bit in the Dwarf information for EH. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41852 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Target/TargetAsmInfo.h | 5 +++++ lib/CodeGen/DwarfWriter.cpp | 7 ++++++- lib/Target/TargetAsmInfo.cpp | 1 + lib/Target/X86/X86TargetAsmInfo.cpp | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/llvm/Target/TargetAsmInfo.h b/include/llvm/Target/TargetAsmInfo.h index 97eaa3598cb..3326088a965 100644 --- a/include/llvm/Target/TargetAsmInfo.h +++ b/include/llvm/Target/TargetAsmInfo.h @@ -116,6 +116,11 @@ namespace llvm { const char *PersonalityPrefix; // Defaults to "" const char *PersonalitySuffix; // Defaults to "" + /// NeedsIndirectEncoding - If set, we need to set the indirect encoding bit + /// for EH in Dwarf. + /// + bool NeedsIndirectEncoding; // Defaults to false + /// InlineAsmStart/End - If these are nonempty, they contain a directive to /// emit before and after an inline assembly statement. const char *InlineAsmStart; // Defaults to "#APP\n" diff --git a/lib/CodeGen/DwarfWriter.cpp b/lib/CodeGen/DwarfWriter.cpp index 2b4b4ce135f..cf6a922d23c 100644 --- a/lib/CodeGen/DwarfWriter.cpp +++ b/lib/CodeGen/DwarfWriter.cpp @@ -2789,7 +2789,12 @@ private: if (Personality) { Asm->EmitULEB128Bytes(7); Asm->EOL("Augmentation Size"); - Asm->EmitInt8(DW_EH_PE_pcrel | DW_EH_PE_sdata4 | DW_EH_PE_indirect); + + if (TAI->getNeedsIndirectEncoding()) + Asm->EmitInt8(DW_EH_PE_pcrel | DW_EH_PE_sdata4 | DW_EH_PE_indirect); + else + Asm->EmitInt8(DW_EH_PE_pcrel | DW_EH_PE_sdata4); + Asm->EOL("Personality (pcrel sdata4 indirect)"); PrintRelDirective(); diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp index 09a8d5ab8e7..1a3daf0eaa9 100644 --- a/lib/Target/TargetAsmInfo.cpp +++ b/lib/Target/TargetAsmInfo.cpp @@ -40,6 +40,7 @@ TargetAsmInfo::TargetAsmInfo() : FunctionAddrSuffix(""), PersonalityPrefix(""), PersonalitySuffix(""), + NeedsIndirectEncoding(false), InlineAsmStart("#APP"), InlineAsmEnd("#NO_APP"), AssemblerDialect(0), diff --git a/lib/Target/X86/X86TargetAsmInfo.cpp b/lib/Target/X86/X86TargetAsmInfo.cpp index 414782ee4db..05cf2bfdaba 100644 --- a/lib/Target/X86/X86TargetAsmInfo.cpp +++ b/lib/Target/X86/X86TargetAsmInfo.cpp @@ -70,6 +70,7 @@ X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) { } PersonalityPrefix = "L"; PersonalitySuffix = "$non_lazy_ptr"; + NeedsIndirectEncoding = true; InlineAsmStart = "# InlineAsm Start"; InlineAsmEnd = "# InlineAsm End"; SetDirective = "\t.set"; -- 2.34.1