summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCObjectFileInfo.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-11-06 15:30:45 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-11-06 15:30:45 +0000
commit889d7bb4cbc8f1d7807e522bb45d0084b118c27e (patch)
treef9df98c519307e85ee4bda26bc4d4590e88538e8 /llvm/lib/MC/MCObjectFileInfo.cpp
parent1954c614d4049bedaae00905a2c22ee4f671b946 (diff)
downloadbcm5719-llvm-889d7bb4cbc8f1d7807e522bb45d0084b118c27e.tar.gz
bcm5719-llvm-889d7bb4cbc8f1d7807e522bb45d0084b118c27e.zip
Bring r252305 back with a test fix.
We now create the .eh_frame section early, just like every other special section. This means that the special flags are visible in code that explicitly asks for ".eh_frame". llvm-svn: 252313
Diffstat (limited to 'llvm/lib/MC/MCObjectFileInfo.cpp')
-rw-r--r--llvm/lib/MC/MCObjectFileInfo.cpp42
1 files changed, 18 insertions, 24 deletions
diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp
index 8849f5d4d12..253564e6d49 100644
--- a/llvm/lib/MC/MCObjectFileInfo.cpp
+++ b/llvm/lib/MC/MCObjectFileInfo.cpp
@@ -49,6 +49,12 @@ void MCObjectFileInfo::initMachOMCObjectFileInfo(Triple T) {
// MachO
SupportsWeakOmittedEHFrame = false;
+ EHFrameSection = Ctx->getMachOSection(
+ "__TEXT", "__eh_frame",
+ MachO::S_COALESCED | MachO::S_ATTR_NO_TOC |
+ MachO::S_ATTR_STRIP_STATIC_SYMS | MachO::S_ATTR_LIVE_SUPPORT,
+ SectionKind::getReadOnly());
+
if (T.isOSDarwin() && T.getArch() == Triple::aarch64)
SupportsCompactUnwindWithoutEHFrame = true;
@@ -416,12 +422,13 @@ void MCObjectFileInfo::initELFMCObjectFileInfo(Triple T) {
break;
}
- EHSectionType = T.getArch() == Triple::x86_64 ? ELF::SHT_X86_64_UNWIND
- : ELF::SHT_PROGBITS;
+ unsigned EHSectionType = T.getArch() == Triple::x86_64
+ ? ELF::SHT_X86_64_UNWIND
+ : ELF::SHT_PROGBITS;
// Solaris requires different flags for .eh_frame to seemingly every other
// platform.
- EHSectionFlags = ELF::SHF_ALLOC;
+ unsigned EHSectionFlags = ELF::SHF_ALLOC;
if (T.isOSSolaris() && T.getArch() != Triple::x86_64)
EHSectionFlags |= ELF::SHF_WRITE;
@@ -546,9 +553,17 @@ void MCObjectFileInfo::initELFMCObjectFileInfo(Triple T) {
FaultMapSection =
Ctx->getELFSection(".llvm_faultmaps", ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
+
+ EHFrameSection =
+ Ctx->getELFSection(".eh_frame", EHSectionType, EHSectionFlags);
}
void MCObjectFileInfo::initCOFFMCObjectFileInfo(Triple T) {
+ EHFrameSection = Ctx->getCOFFSection(
+ ".eh_frame", COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
+ COFF::IMAGE_SCN_MEM_READ | COFF::IMAGE_SCN_MEM_WRITE,
+ SectionKind::getDataRel());
+
bool IsWoA = T.getArch() == Triple::arm || T.getArch() == Triple::thumb;
CommDirectiveSupportsAlignment = true;
@@ -822,24 +837,3 @@ MCSection *MCObjectFileInfo::getDwarfTypesSection(uint64_t Hash) const {
return Ctx->getELFSection(".debug_types", ELF::SHT_PROGBITS, ELF::SHF_GROUP,
0, utostr(Hash));
}
-
-void MCObjectFileInfo::InitEHFrameSection() {
- if (Env == IsMachO)
- EHFrameSection =
- Ctx->getMachOSection("__TEXT", "__eh_frame",
- MachO::S_COALESCED |
- MachO::S_ATTR_NO_TOC |
- MachO::S_ATTR_STRIP_STATIC_SYMS |
- MachO::S_ATTR_LIVE_SUPPORT,
- SectionKind::getReadOnly());
- else if (Env == IsELF)
- EHFrameSection =
- Ctx->getELFSection(".eh_frame", EHSectionType, EHSectionFlags);
- else
- EHFrameSection =
- Ctx->getCOFFSection(".eh_frame",
- COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
- COFF::IMAGE_SCN_MEM_READ |
- COFF::IMAGE_SCN_MEM_WRITE,
- SectionKind::getDataRel());
-}
OpenPOWER on IntegriCloud