From b510f8d08c6a1ba3ec1df4e9cfac9567c43e5bb6 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 15 Oct 2014 15:44:16 +0000 Subject: [PATCH] Move getNonexecutableStackSection up to the base ELF class. 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 | 3 +++ lib/MC/MCAsmInfoELF.cpp | 9 +++++++++ lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.cpp | 5 ----- lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.h | 1 - lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp | 6 ------ lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.h | 3 --- lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp | 6 ------ lib/Target/X86/MCTargetDesc/X86MCAsmInfo.h | 2 -- 8 files changed, 12 insertions(+), 23 deletions(-) diff --git a/include/llvm/MC/MCAsmInfoELF.h b/include/llvm/MC/MCAsmInfoELF.h index 27fea84e7a6..7bd246056ec 100644 --- a/include/llvm/MC/MCAsmInfoELF.h +++ b/include/llvm/MC/MCAsmInfoELF.h @@ -15,6 +15,9 @@ namespace llvm { class MCAsmInfoELF : public MCAsmInfo { virtual void anchor(); + const MCSection * + getNonexecutableStackSection(MCContext &Ctx) const override final; + protected: MCAsmInfoELF(); }; diff --git a/lib/MC/MCAsmInfoELF.cpp b/lib/MC/MCAsmInfoELF.cpp index ccb3dc3c6ed..9f70d8da80a 100644 --- a/lib/MC/MCAsmInfoELF.cpp +++ b/lib/MC/MCAsmInfoELF.cpp @@ -13,10 +13,19 @@ //===----------------------------------------------------------------------===// #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"; diff --git a/lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.cpp b/lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.cpp index d8939fd86e3..f332e4da0df 100644 --- a/lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.cpp +++ b/lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.cpp @@ -44,8 +44,3 @@ AMDGPUMCAsmInfo::AMDGPUMCAsmInfo(StringRef &TT) : MCAsmInfoELF() { //===--- Dwarf Emission Directives -----------------------------------===// SupportsDebugInformation = true; } - -const MCSection* -AMDGPUMCAsmInfo::getNonexecutableStackSection(MCContext &CTX) const { - return nullptr; -} diff --git a/lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.h b/lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.h index 637a977f59f..8f75c76c425 100644 --- a/lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.h +++ b/lib/Target/R600/MCTargetDesc/AMDGPUMCAsmInfo.h @@ -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 diff --git a/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp b/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp index aed407e9878..35887faef83 100644 --- a/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp +++ b/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp @@ -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()); -} diff --git a/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.h b/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.h index f582bd383c1..19b5b4b0972 100644 --- a/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.h +++ b/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.h @@ -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 diff --git a/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp b/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp index 63aa0861fcc..3a67f6a5f91 100644 --- a/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp +++ b/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp @@ -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) { diff --git a/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.h b/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.h index 26fb8a7da7e..f2f06c358bf 100644 --- a/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.h +++ b/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.h @@ -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 { -- 2.34.1