diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-10-15 16:12:52 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-10-15 16:12:52 +0000 |
commit | 7b61ddfa6e62bf1b26cc1ca3a8ecc62e23b082ef (patch) | |
tree | 0d242fbbfb63b5f6fc7b8db88361b65c4bca0464 /llvm/lib/MC/MCELFStreamer.cpp | |
parent | 3bfffde27a820789b37a0c6e3d7f32d3757f4b32 (diff) | |
download | bcm5719-llvm-7b61ddfa6e62bf1b26cc1ca3a8ecc62e23b082ef.tar.gz bcm5719-llvm-7b61ddfa6e62bf1b26cc1ca3a8ecc62e23b082ef.zip |
Simplify handling of --noexecstack by using getNonexecutableStackSection.
llvm-svn: 219799
Diffstat (limited to 'llvm/lib/MC/MCELFStreamer.cpp')
-rw-r--r-- | llvm/lib/MC/MCELFStreamer.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/llvm/lib/MC/MCELFStreamer.cpp b/llvm/lib/MC/MCELFStreamer.cpp index 7c70540dd5b..34049b7c967 100644 --- a/llvm/lib/MC/MCELFStreamer.cpp +++ b/llvm/lib/MC/MCELFStreamer.cpp @@ -15,6 +15,7 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/MC/MCAsmBackend.h" +#include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCCodeEmitter.h" #include "llvm/MC/MCContext.h" @@ -38,19 +39,23 @@ using namespace llvm; MCELFStreamer::~MCELFStreamer() { } -void MCELFStreamer::InitSections() { +void MCELFStreamer::InitSections(bool NoExecStack) { // This emulates the same behavior of GNU as. This makes it easier // to compare the output as the major sections are in the same order. - SwitchSection(getContext().getObjectFileInfo()->getTextSection()); + MCContext &Ctx = getContext(); + SwitchSection(Ctx.getObjectFileInfo()->getTextSection()); EmitCodeAlignment(4); - SwitchSection(getContext().getObjectFileInfo()->getDataSection()); + SwitchSection(Ctx.getObjectFileInfo()->getDataSection()); EmitCodeAlignment(4); - SwitchSection(getContext().getObjectFileInfo()->getBSSSection()); + SwitchSection(Ctx.getObjectFileInfo()->getBSSSection()); EmitCodeAlignment(4); - SwitchSection(getContext().getObjectFileInfo()->getTextSection()); + SwitchSection(Ctx.getObjectFileInfo()->getTextSection()); + + if (NoExecStack) + SwitchSection(Ctx.getAsmInfo()->getNonexecutableStackSection(Ctx)); } void MCELFStreamer::EmitLabel(MCSymbol *Symbol) { @@ -543,12 +548,10 @@ void MCELFStreamer::FinishImpl() { MCStreamer *llvm::createELFStreamer(MCContext &Context, MCAsmBackend &MAB, raw_ostream &OS, MCCodeEmitter *CE, - bool RelaxAll, bool NoExecStack) { + bool RelaxAll) { MCELFStreamer *S = new MCELFStreamer(Context, MAB, OS, CE); if (RelaxAll) S->getAssembler().setRelaxAll(true); - if (NoExecStack) - S->getAssembler().setNoExecStack(true); return S; } |