Fix the defaults for .eh_frame. We were marking it as writable.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 24 May 2011 02:50:20 +0000 (02:50 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 24 May 2011 02:50:20 +0000 (02:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131951 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/TargetLoweringObjectFileImpl.cpp
test/CodeGen/X86/eh_frame.ll [new file with mode: 0644]

index cb337d84dbadc1ef3c16294fff6d1ce873ba4115..ff88b6f2e99a451b2de742fbc91a55f106a1c402 100644 (file)
@@ -255,7 +255,7 @@ getELFKindForNamedSection(StringRef Name, SectionKind K) {
     return SectionKind::getThreadBSS();
 
   if (Name == ".eh_frame")
-    return SectionKind::getDataRel();
+    return SectionKind::getReadOnlyWithRel();
 
   return K;
 }
@@ -289,7 +289,7 @@ getELFSectionFlags(SectionKind K) {
   if (K.isText())
     Flags |= ELF::SHF_EXECINSTR;
 
-  if (K.isWriteable())
+  if (K.isWriteable() && !K.isReadOnlyWithRel())
     Flags |= ELF::SHF_WRITE;
 
   if (K.isThreadLocal())
diff --git a/test/CodeGen/X86/eh_frame.ll b/test/CodeGen/X86/eh_frame.ll
new file mode 100644 (file)
index 0000000..e8d3c87
--- /dev/null
@@ -0,0 +1,5 @@
+; RUN: llc < %s -mtriple x86_64-unknown-linux-gnu | FileCheck %s
+
+@__FRAME_END__ = constant [1 x i32] zeroinitializer, section ".eh_frame"
+
+; CHECK: .section      .eh_frame,"a",@progbits