Use the correct section types on Solaris for unwind data on both x86 and x86-64.
authorDavid Chisnall <csdavec@swan.ac.uk>
Tue, 10 Apr 2012 11:44:33 +0000 (11:44 +0000)
committerDavid Chisnall <csdavec@swan.ac.uk>
Tue, 10 Apr 2012 11:44:33 +0000 (11:44 +0000)
Patch by Dmitri Shubin!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154391 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCObjectFileInfo.h
lib/MC/MCObjectFileInfo.cpp

index df8f9f32411f53bae097cd7fb61a898ad66cb73f..aea4b410fea20213705d78c40ed5738979ee3499 100644 (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.
index 7dd06e7059ae161483ff0d8cd77f31b0366607a3..b22ae331c9a915b8e508361dbdb88153ab07be89 100644 (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