[llvm-commits] [llvm] r150818 - in /llvm/trunk: include/llvm/MC/MCObjectFileInfo.h lib/MC/MCObjectFileInfo.cpp
David Chisnall
csdavec at swan.ac.uk
Fri Feb 17 08:51:02 PST 2012
Author: theraven
Date: Fri Feb 17 10:51:02 2012
New Revision: 150818
URL: http://llvm.org/viewvc/llvm-project?rev=150818&view=rev
Log:
Revert r150814. It turns out that there is a good reason for this after all...
Modified:
llvm/trunk/include/llvm/MC/MCObjectFileInfo.h
llvm/trunk/lib/MC/MCObjectFileInfo.cpp
Modified: llvm/trunk/include/llvm/MC/MCObjectFileInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCObjectFileInfo.h?rev=150818&r1=150817&r2=150818&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCObjectFileInfo.h (original)
+++ llvm/trunk/include/llvm/MC/MCObjectFileInfo.h Fri Feb 17 10:51:02 2012
@@ -284,6 +284,8 @@
const MCSection *getXDataSection() const { return XDataSection; }
const MCSection *getEHFrameSection() {
+ if (!EHFrameSection)
+ InitEHFrameSection();
return EHFrameSection;
}
@@ -298,6 +300,9 @@
void InitELFMCObjectFileInfo(Triple T);
void InitCOFFMCObjectFileInfo(Triple T);
+ /// InitEHFrameSection - Initialize EHFrameSection on demand.
+ ///
+ void InitEHFrameSection();
};
} // end namespace llvm
Modified: llvm/trunk/lib/MC/MCObjectFileInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectFileInfo.cpp?rev=150818&r1=150817&r2=150818&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCObjectFileInfo.cpp (original)
+++ llvm/trunk/lib/MC/MCObjectFileInfo.cpp Fri Feb 17 10:51:02 2012
@@ -142,14 +142,6 @@
}
// Exception Handling.
- EHFrameSection =
- Ctx->getMachOSection("__TEXT", "__eh_frame",
- MCSectionMachO::S_COALESCED |
- MCSectionMachO::S_ATTR_NO_TOC |
- MCSectionMachO::S_ATTR_STRIP_STATIC_SYMS |
- MCSectionMachO::S_ATTR_LIVE_SUPPORT,
- SectionKind::getReadOnly());
-
LSDASection = Ctx->getMachOSection("__TEXT", "__gcc_except_tab", 0,
SectionKind::getReadOnlyWithRel());
@@ -347,17 +339,6 @@
// Exception Handling Sections.
- // Solaris requires different flags for .eh_frame to seemingly every other
- // platform.
- unsigned EHSectionFlags = ELF::SHF_ALLOC;
- if (T.getOS() == Triple::Solaris)
- EHSectionFlags |= ELF::SHF_WRITE;
-
- EHFrameSection =
- Ctx->getELFSection(".eh_frame", ELF::SHT_PROGBITS,
- EHSectionFlags,
- SectionKind::getDataRel());
-
// FIXME: We're emitting LSDA info into a readonly section on ELF, 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
@@ -434,13 +415,6 @@
COFF::IMAGE_SCN_MEM_WRITE,
SectionKind::getDataRel());
- EHFrameSection =
- Ctx->getCOFFSection(".eh_frame",
- COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
- COFF::IMAGE_SCN_MEM_READ |
- COFF::IMAGE_SCN_MEM_WRITE,
- 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
@@ -573,3 +547,25 @@
}
}
+void MCObjectFileInfo::InitEHFrameSection() {
+ if (Env == IsMachO)
+ EHFrameSection =
+ Ctx->getMachOSection("__TEXT", "__eh_frame",
+ MCSectionMachO::S_COALESCED |
+ MCSectionMachO::S_ATTR_NO_TOC |
+ MCSectionMachO::S_ATTR_STRIP_STATIC_SYMS |
+ MCSectionMachO::S_ATTR_LIVE_SUPPORT,
+ SectionKind::getReadOnly());
+ else if (Env == IsELF)
+ EHFrameSection =
+ Ctx->getELFSection(".eh_frame", ELF::SHT_PROGBITS,
+ ELF::SHF_ALLOC,
+ SectionKind::getDataRel());
+ else
+ EHFrameSection =
+ Ctx->getCOFFSection(".eh_frame",
+ COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
+ COFF::IMAGE_SCN_MEM_READ |
+ COFF::IMAGE_SCN_MEM_WRITE,
+ SectionKind::getDataRel());
+}
More information about the llvm-commits
mailing list