aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Chisnall <csdavec@swan.ac.uk>2012-02-17 16:51:02 +0000
committerDavid Chisnall <csdavec@swan.ac.uk>2012-02-17 16:51:02 +0000
commit8bb51ef6d2a396715f1dbc6edc1599892779e4d6 (patch)
treeb1e5be73e51fbe58f3a0430e0ec86be5656c1382
parent0f7de3542f792da8abced2ad1809b2dfa8a4daff (diff)
downloadexternal_llvm-8bb51ef6d2a396715f1dbc6edc1599892779e4d6.zip
external_llvm-8bb51ef6d2a396715f1dbc6edc1599892779e4d6.tar.gz
external_llvm-8bb51ef6d2a396715f1dbc6edc1599892779e4d6.tar.bz2
Revert r150814. It turns out that there is a good reason for this after all...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150818 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/MC/MCObjectFileInfo.h5
-rw-r--r--lib/MC/MCObjectFileInfo.cpp48
2 files changed, 27 insertions, 26 deletions
diff --git a/include/llvm/MC/MCObjectFileInfo.h b/include/llvm/MC/MCObjectFileInfo.h
index 7525f00..e58e7d6 100644
--- a/include/llvm/MC/MCObjectFileInfo.h
+++ b/include/llvm/MC/MCObjectFileInfo.h
@@ -284,6 +284,8 @@ public:
const MCSection *getXDataSection() const { return XDataSection; }
const MCSection *getEHFrameSection() {
+ if (!EHFrameSection)
+ InitEHFrameSection();
return EHFrameSection;
}
@@ -298,6 +300,9 @@ private:
void InitELFMCObjectFileInfo(Triple T);
void InitCOFFMCObjectFileInfo(Triple T);
+ /// InitEHFrameSection - Initialize EHFrameSection on demand.
+ ///
+ void InitEHFrameSection();
};
} // end namespace llvm
diff --git a/lib/MC/MCObjectFileInfo.cpp b/lib/MC/MCObjectFileInfo.cpp
index 3c3b50c..1b86535 100644
--- a/lib/MC/MCObjectFileInfo.cpp
+++ b/lib/MC/MCObjectFileInfo.cpp
@@ -142,14 +142,6 @@ void MCObjectFileInfo::InitMachOMCObjectFileInfo(Triple T) {
}
// 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 @@ void MCObjectFileInfo::InitELFMCObjectFileInfo(Triple T) {
// 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 @@ void MCObjectFileInfo::InitCOFFMCObjectFileInfo(Triple T) {
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::InitMCObjectFileInfo(StringRef TT, Reloc::Model relocm,
}
}
+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());
+}