Move getNonexecutableStackSection up to the base ELF class.
authorRafael Espindola <rafael.espindola@gmail.com>
Wed, 15 Oct 2014 15:44:16 +0000 (15:44 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Wed, 15 Oct 2014 15:44:16 +0000 (15:44 +0000)
The .note.GNU-stack section is not SystemZ/X86 specific.

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

include/llvm/MC/MCAsmInfoELF.h
lib/MC/MCAsmInfoELF.cpp
lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.cpp
lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.h
lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp
lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.h
lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp
lib/Target/X86/MCTargetDesc/X86MCAsmInfo.h

index 27fea84e7a6daac12039e2548ac22bf323c15792..7bd246056eca074248216f9b552c45aeb6fbe717 100644 (file)
@@ -15,6 +15,9 @@
 namespace llvm {
 class MCAsmInfoELF : public MCAsmInfo {
   virtual void anchor();
+  const MCSection *
+  getNonexecutableStackSection(MCContext &Ctx) const override final;
+
 protected:
   MCAsmInfoELF();
 };
index ccb3dc3c6edadb80c939e62d72f5f372078bc617..9f70d8da80a255671b1f248efebea835250ab662 100644 (file)
 //===----------------------------------------------------------------------===//
 
 #include "llvm/MC/MCAsmInfoELF.h"
+#include "llvm/MC/MCContext.h"
+#include "llvm/MC/MCSectionELF.h"
+#include "llvm/Support/ELF.h"
 using namespace llvm;
 
 void MCAsmInfoELF::anchor() { }
 
+const MCSection *
+MCAsmInfoELF::getNonexecutableStackSection(MCContext &Ctx) const {
+  return Ctx.getELFSection(".note.GNU-stack", ELF::SHT_PROGBITS,
+                           0, SectionKind::getMetadata());
+}
+
 MCAsmInfoELF::MCAsmInfoELF() {
   HasIdentDirective = true;
   WeakRefDirective = "\t.weak\t";
index d8939fd86e3bf460363794e378fa154b9bcb4602..f332e4da0df581b6d8c1682d39e45bc090ed673e 100644 (file)
@@ -44,8 +44,3 @@ AMDGPUMCAsmInfo::AMDGPUMCAsmInfo(StringRef &TT) : MCAsmInfoELF() {
   //===--- Dwarf Emission Directives -----------------------------------===//
   SupportsDebugInformation = true;
 }
-
-const MCSection*
-AMDGPUMCAsmInfo::getNonexecutableStackSection(MCContext &CTX) const {
-  return nullptr;
-}
index 637a977f59f895ec40595bfd4f018ebea08b6dcc..8f75c76c4257520b5cc7b30ac8daed860926fd5f 100644 (file)
@@ -27,7 +27,6 @@ class StringRef;
 class AMDGPUMCAsmInfo : public MCAsmInfoELF {
 public:
   explicit AMDGPUMCAsmInfo(StringRef &TT);
-  const MCSection* getNonexecutableStackSection(MCContext &CTX) const override;
 };
 } // namespace llvm
 #endif
index aed407e9878061b03e712fad97e2dea462a1d763..35887faef831f76b813128b706cbe15e47466f65 100644 (file)
@@ -25,9 +25,3 @@ SystemZMCAsmInfo::SystemZMCAsmInfo(StringRef TT) {
   SupportsDebugInformation = true;
   ExceptionsType = ExceptionHandling::DwarfCFI;
 }
-
-const MCSection *
-SystemZMCAsmInfo::getNonexecutableStackSection(MCContext &Ctx) const {
-  return Ctx.getELFSection(".note.GNU-stack", ELF::SHT_PROGBITS,
-                           0, SectionKind::getMetadata());
-}
index f582bd383c15d2cc8b1e4ddb6ba5d77f83fe063c..19b5b4b09724909175ec835eafebad03dec8c7c7 100644 (file)
@@ -19,9 +19,6 @@ class StringRef;
 class SystemZMCAsmInfo : public MCAsmInfoELF {
 public:
   explicit SystemZMCAsmInfo(StringRef TT);
-
-  // Override MCAsmInfo;
-  const MCSection *getNonexecutableStackSection(MCContext &Ctx) const override;
 };
 
 } // end namespace llvm
index 63aa0861fcc6c62bb5de4e6b2c163bd62b6ce5cc..3a67f6a5f9135b9e9930d2018802380cb7dac5fa 100644 (file)
@@ -130,12 +130,6 @@ X86_64MCAsmInfoDarwin::getExprForPersonalitySymbol(const MCSymbol *Sym,
   return MCBinaryExpr::CreateAdd(Res, Four, Context);
 }
 
-const MCSection *X86ELFMCAsmInfo::
-getNonexecutableStackSection(MCContext &Ctx) const {
-  return Ctx.getELFSection(".note.GNU-stack", ELF::SHT_PROGBITS,
-                           0, SectionKind::getMetadata());
-}
-
 void X86MCAsmInfoMicrosoft::anchor() { }
 
 X86MCAsmInfoMicrosoft::X86MCAsmInfoMicrosoft(const Triple &Triple) {
index 26fb8a7da7e8928d5bf10e790246929b983a55f7..f2f06c358bf7704792f5297b523a07d49fe6a738 100644 (file)
@@ -39,8 +39,6 @@ namespace llvm {
     void anchor() override;
   public:
     explicit X86ELFMCAsmInfo(const Triple &Triple);
-    const MCSection *
-    getNonexecutableStackSection(MCContext &Ctx) const override;
   };
 
   class X86MCAsmInfoMicrosoft : public MCAsmInfoMicrosoft {