Move getNonexecutableStackSection up to the base ELF class.

The .note.GNU-stack section is not SystemZ/X86 specific.

llvm-svn: 219796
This commit is contained in:
Rafael Espindola 2014-10-15 15:44:16 +00:00
parent fb237520ee
commit ad33dd2914
8 changed files with 12 additions and 23 deletions

View File

@ -15,6 +15,9 @@
namespace llvm {
class MCAsmInfoELF : public MCAsmInfo {
virtual void anchor();
const MCSection *
getNonexecutableStackSection(MCContext &Ctx) const override final;
protected:
MCAsmInfoELF();
};

View File

@ -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";

View File

@ -44,8 +44,3 @@ AMDGPUMCAsmInfo::AMDGPUMCAsmInfo(StringRef &TT) : MCAsmInfoELF() {
//===--- Dwarf Emission Directives -----------------------------------===//
SupportsDebugInformation = true;
}
const MCSection*
AMDGPUMCAsmInfo::getNonexecutableStackSection(MCContext &CTX) const {
return nullptr;
}

View 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

View 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());
}

View 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

View 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) {

View 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 {