Use the correct section types on Solaris for unwind data on both x86 and x86-64.

Patch by Dmitri Shubin!

llvm-svn: 154391
This commit is contained in:
David Chisnall 2012-04-10 11:44:33 +00:00
parent bc42d44112
commit bbec87205d
2 changed files with 9 additions and 3 deletions

View File

@ -47,6 +47,7 @@ protected:
unsigned FDECFIEncoding;
unsigned TTypeEncoding;
// Section flags for eh_frame
unsigned EHSectionType;
unsigned EHSectionFlags;
/// TextSection - Section directive for standard text.

View File

@ -260,9 +260,14 @@ void MCObjectFileInfo::InitELFMCObjectFileInfo(Triple T) {
// Solaris requires different flags for .eh_frame to seemingly every other
// platform.
EHSectionType = ELF::SHT_PROGBITS;
EHSectionFlags = ELF::SHF_ALLOC;
if (T.getOS() == Triple::Solaris)
EHSectionFlags |= ELF::SHF_WRITE;
if (T.getOS() == Triple::Solaris) {
if (T.getArch() == Triple::x86_64)
EHSectionType = ELF::SHT_X86_64_UNWIND;
else
EHSectionFlags |= ELF::SHF_WRITE;
}
// ELF
@ -575,7 +580,7 @@ void MCObjectFileInfo::InitEHFrameSection() {
SectionKind::getReadOnly());
else if (Env == IsELF)
EHFrameSection =
Ctx->getELFSection(".eh_frame", ELF::SHT_PROGBITS,
Ctx->getELFSection(".eh_frame", EHSectionType,
EHSectionFlags,
SectionKind::getDataRel());
else