From: Chris Lattner Date: Tue, 18 Aug 2009 16:56:17 +0000 (+0000) Subject: fix COFF targets (mingw/cygwin) to provide ehframe and LSDA sections X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=35c3531754c392a533921a465a22f67f7e8fb743;p=oota-llvm.git fix COFF targets (mingw/cygwin) to provide ehframe and LSDA sections git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79346 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/AsmPrinter/DwarfException.cpp b/lib/CodeGen/AsmPrinter/DwarfException.cpp index 7ab0bb0975a..06dfac4550c 100644 --- a/lib/CodeGen/AsmPrinter/DwarfException.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfException.cpp @@ -56,10 +56,7 @@ void DwarfException::EmitCommonEHFrame(const Function *Personality, TD->getPointerSize() : -TD->getPointerSize(); // Begin eh frame section. - // FIXME: THIS IS A HORRIBLE HACK. MingW isn't specifying an EHFrame section. - if (const MCSection *EHFrameSec = - Asm->getObjFileLowering().getEHFrameSection()) - Asm->SwitchToSection(EHFrameSec); + Asm->SwitchToSection(Asm->getObjFileLowering().getEHFrameSection()); if (TAI->is_EHSymbolPrivate()) O << TAI->getPrivateGlobalPrefix(); @@ -153,10 +150,7 @@ void DwarfException::EmitEHFrame(const FunctionEHFrameInfo &EHFrameInfo) { const Function *TheFunc = EHFrameInfo.function; - // FIXME: THIS IS A HORRIBLE HACK. MingW isn't specifying an EHFrame section. - if (const MCSection *EHFrameSec = - Asm->getObjFileLowering().getEHFrameSection()) - Asm->SwitchToSection(EHFrameSec); + Asm->SwitchToSection(Asm->getObjFileLowering().getEHFrameSection()); // Externally visible entry into the functions eh frame info. If the // corresponding function is static, this should not be externally visible. diff --git a/lib/Target/TargetLoweringObjectFile.cpp b/lib/Target/TargetLoweringObjectFile.cpp index 67fbc1f6ca0..84b1b93ab01 100644 --- a/lib/Target/TargetLoweringObjectFile.cpp +++ b/lib/Target/TargetLoweringObjectFile.cpp @@ -963,6 +963,14 @@ void TargetLoweringObjectFileCOFF::Initialize(MCContext &Ctx, StaticDtorSection = getCOFFSection(".dtors", false, SectionKind::getDataRel()); + // FIXME: We're emitting LSDA info into a readonly section on COFF, even + // though it contains relocatable pointers. In PIC mode, this is probably a + // big runtime hit for C++ apps. Either the contents of the LSDA need to be + // adjusted or this should be a data section. + LSDASection = + getCOFFSection(".gcc_except_table", false, SectionKind::getReadOnly()); + EHFrameSection = + getCOFFSection(".eh_frame", false, SectionKind::getDataRel()); // Debug info. // FIXME: Don't use 'directive' mode here.