Generate the correct EH frame section types on Solaris, this time without breaking...
authorDavid Chisnall <csdavec@swan.ac.uk>
Fri, 17 Feb 2012 17:31:15 +0000 (17:31 +0000)
committerDavid Chisnall <csdavec@swan.ac.uk>
Fri, 17 Feb 2012 17:31:15 +0000 (17:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150819 91177308-0d34-0410-b5e6-96231b3b80d8

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

index e58e7d68f7fd55709e5c27dd880ff435a0ac55b8..5d5801f33dae4622d5476b1cfeb4efa9b4c95ef7 100644 (file)
@@ -47,6 +47,8 @@ protected:
   unsigned FDEEncoding;
   unsigned FDECFIEncoding;
   unsigned TTypeEncoding;
+  // Section flags for eh_frame
+  unsigned EHSectionFlags;
 
   /// TextSection - Section directive for standard text.
   ///
index 1b8653531e8293ed819ef96815a5073804e06395..1a27df5dc0c0d5577ff2e26b25d8e3549bf32cac 100644 (file)
@@ -258,6 +258,13 @@ void MCObjectFileInfo::InitELFMCObjectFileInfo(Triple T) {
     }
   }
 
+  // Solaris requires different flags for .eh_frame to seemingly every other
+  // platform.
+  EHSectionFlags = ELF::SHF_ALLOC;
+  if (T.getOS() == Triple::Solaris)
+    EHSectionFlags |= ELF::SHF_WRITE;
+
+
   // ELF
   BSSSection =
     Ctx->getELFSection(".bss", ELF::SHT_NOBITS,
@@ -559,7 +566,7 @@ void MCObjectFileInfo::InitEHFrameSection() {
   else if (Env == IsELF)
     EHFrameSection =
       Ctx->getELFSection(".eh_frame", ELF::SHT_PROGBITS,
-                         ELF::SHF_ALLOC,
+                         EHSectionFlags,
                          SectionKind::getDataRel());
   else
     EHFrameSection =