diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-11-06 14:51:09 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-11-06 14:51:09 +0000 |
commit | 1aa4d1c56f276672bd2d8950fefdc6e7454481e2 (patch) | |
tree | 7a886203c4bbc471d498637cff34eda31d4b82dd /llvm/lib/MC/MCObjectFileInfo.cpp | |
parent | e69bcd7ef818ceb982932a4b1bd410a8ebb1192b (diff) | |
download | bcm5719-llvm-1aa4d1c56f276672bd2d8950fefdc6e7454481e2.tar.gz bcm5719-llvm-1aa4d1c56f276672bd2d8950fefdc6e7454481e2.zip |
Revert "Simplify the creation of .eh_frame/.debug_frame sections."
This reverts commit r252305.
Investigating a test failure.
llvm-svn: 252306
Diffstat (limited to 'llvm/lib/MC/MCObjectFileInfo.cpp')
-rw-r--r-- | llvm/lib/MC/MCObjectFileInfo.cpp | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp index 253564e6d49..8849f5d4d12 100644 --- a/llvm/lib/MC/MCObjectFileInfo.cpp +++ b/llvm/lib/MC/MCObjectFileInfo.cpp @@ -49,12 +49,6 @@ 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; @@ -422,13 +416,12 @@ void MCObjectFileInfo::initELFMCObjectFileInfo(Triple T) { break; } - unsigned EHSectionType = T.getArch() == Triple::x86_64 - ? ELF::SHT_X86_64_UNWIND - : ELF::SHT_PROGBITS; + 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. - unsigned EHSectionFlags = ELF::SHF_ALLOC; + EHSectionFlags = ELF::SHF_ALLOC; if (T.isOSSolaris() && T.getArch() != Triple::x86_64) EHSectionFlags |= ELF::SHF_WRITE; @@ -553,17 +546,9 @@ 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; @@ -837,3 +822,24 @@ 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()); +} |