mirror of
https://github.com/RPCSX/llvm.git
synced 2025-04-10 04:01:27 +00:00
Simplify handling of --noexecstack by using getNonexecutableStackSection.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219799 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5c2d60d357
commit
90ce9f70e2
@ -915,7 +915,6 @@ private:
|
|||||||
unsigned BundleAlignSize;
|
unsigned BundleAlignSize;
|
||||||
|
|
||||||
unsigned RelaxAll : 1;
|
unsigned RelaxAll : 1;
|
||||||
unsigned NoExecStack : 1;
|
|
||||||
unsigned SubsectionsViaSymbols : 1;
|
unsigned SubsectionsViaSymbols : 1;
|
||||||
|
|
||||||
/// ELF specific e_header flags
|
/// ELF specific e_header flags
|
||||||
@ -1061,9 +1060,6 @@ public:
|
|||||||
bool getRelaxAll() const { return RelaxAll; }
|
bool getRelaxAll() const { return RelaxAll; }
|
||||||
void setRelaxAll(bool Value) { RelaxAll = Value; }
|
void setRelaxAll(bool Value) { RelaxAll = Value; }
|
||||||
|
|
||||||
bool getNoExecStack() const { return NoExecStack; }
|
|
||||||
void setNoExecStack(bool Value) { NoExecStack = Value; }
|
|
||||||
|
|
||||||
bool isBundlingEnabled() const {
|
bool isBundlingEnabled() const {
|
||||||
return BundleAlignSize != 0;
|
return BundleAlignSize != 0;
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ public:
|
|||||||
/// @name MCStreamer Interface
|
/// @name MCStreamer Interface
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
void InitSections() override;
|
void InitSections(bool NoExecStack) override;
|
||||||
void ChangeSection(const MCSection *Section,
|
void ChangeSection(const MCSection *Section,
|
||||||
const MCExpr *Subsection) override;
|
const MCExpr *Subsection) override;
|
||||||
void EmitLabel(MCSymbol *Symbol) override;
|
void EmitLabel(MCSymbol *Symbol) override;
|
||||||
@ -115,8 +115,7 @@ private:
|
|||||||
|
|
||||||
MCELFStreamer *createARMELFStreamer(MCContext &Context, MCAsmBackend &TAB,
|
MCELFStreamer *createARMELFStreamer(MCContext &Context, MCAsmBackend &TAB,
|
||||||
raw_ostream &OS, MCCodeEmitter *Emitter,
|
raw_ostream &OS, MCCodeEmitter *Emitter,
|
||||||
bool RelaxAll, bool NoExecStack,
|
bool RelaxAll, bool IsThumb);
|
||||||
bool IsThumb);
|
|
||||||
|
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Create the default sections and set the initial one.
|
/// Create the default sections and set the initial one.
|
||||||
virtual void InitSections();
|
virtual void InitSections(bool NoExecStack);
|
||||||
|
|
||||||
/// AssignSection - Sets the symbol's section.
|
/// AssignSection - Sets the symbol's section.
|
||||||
///
|
///
|
||||||
@ -766,8 +766,8 @@ MCStreamer *createMachOStreamer(MCContext &Ctx, MCAsmBackend &TAB,
|
|||||||
/// createELFStreamer - Create a machine code streamer which will generate
|
/// createELFStreamer - Create a machine code streamer which will generate
|
||||||
/// ELF format object files.
|
/// ELF format object files.
|
||||||
MCStreamer *createELFStreamer(MCContext &Ctx, MCAsmBackend &TAB,
|
MCStreamer *createELFStreamer(MCContext &Ctx, MCAsmBackend &TAB,
|
||||||
raw_ostream &OS, MCCodeEmitter *CE, bool RelaxAll,
|
raw_ostream &OS, MCCodeEmitter *CE,
|
||||||
bool NoExecStack);
|
bool RelaxAll);
|
||||||
|
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ public:
|
|||||||
/// \name MCStreamer interface
|
/// \name MCStreamer interface
|
||||||
/// \{
|
/// \{
|
||||||
|
|
||||||
void InitSections() override;
|
void InitSections(bool NoExecStack) override;
|
||||||
void EmitLabel(MCSymbol *Symbol) override;
|
void EmitLabel(MCSymbol *Symbol) override;
|
||||||
void EmitAssemblerFlag(MCAssemblerFlag Flag) override;
|
void EmitAssemblerFlag(MCAssemblerFlag Flag) override;
|
||||||
void EmitThumbFunc(MCSymbol *Func) override;
|
void EmitThumbFunc(MCSymbol *Func) override;
|
||||||
|
@ -123,15 +123,10 @@ namespace llvm {
|
|||||||
const MCRegisterInfo &MRI,
|
const MCRegisterInfo &MRI,
|
||||||
const MCSubtargetInfo &STI,
|
const MCSubtargetInfo &STI,
|
||||||
MCContext &Ctx);
|
MCContext &Ctx);
|
||||||
typedef MCStreamer *(*MCObjectStreamerCtorTy)(const Target &T,
|
typedef MCStreamer *(*MCObjectStreamerCtorTy)(
|
||||||
StringRef TT,
|
const Target &T, StringRef TT, MCContext &Ctx, MCAsmBackend &TAB,
|
||||||
MCContext &Ctx,
|
raw_ostream &_OS, MCCodeEmitter *_Emitter, const MCSubtargetInfo &STI,
|
||||||
MCAsmBackend &TAB,
|
bool RelaxAll);
|
||||||
raw_ostream &_OS,
|
|
||||||
MCCodeEmitter *_Emitter,
|
|
||||||
const MCSubtargetInfo &STI,
|
|
||||||
bool RelaxAll,
|
|
||||||
bool NoExecStack);
|
|
||||||
typedef MCStreamer *(*AsmStreamerCtorTy)(MCContext &Ctx,
|
typedef MCStreamer *(*AsmStreamerCtorTy)(MCContext &Ctx,
|
||||||
formatted_raw_ostream &OS,
|
formatted_raw_ostream &OS,
|
||||||
bool isVerboseAsm,
|
bool isVerboseAsm,
|
||||||
@ -423,18 +418,15 @@ namespace llvm {
|
|||||||
/// \param _OS The stream object.
|
/// \param _OS The stream object.
|
||||||
/// \param _Emitter The target independent assembler object.Takes ownership.
|
/// \param _Emitter The target independent assembler object.Takes ownership.
|
||||||
/// \param RelaxAll Relax all fixups?
|
/// \param RelaxAll Relax all fixups?
|
||||||
/// \param NoExecStack Mark file as not needing a executable stack.
|
|
||||||
MCStreamer *createMCObjectStreamer(StringRef TT, MCContext &Ctx,
|
MCStreamer *createMCObjectStreamer(StringRef TT, MCContext &Ctx,
|
||||||
MCAsmBackend &TAB,
|
MCAsmBackend &TAB, raw_ostream &_OS,
|
||||||
raw_ostream &_OS,
|
|
||||||
MCCodeEmitter *_Emitter,
|
MCCodeEmitter *_Emitter,
|
||||||
const MCSubtargetInfo &STI,
|
const MCSubtargetInfo &STI,
|
||||||
bool RelaxAll,
|
bool RelaxAll) const {
|
||||||
bool NoExecStack) const {
|
|
||||||
if (!MCObjectStreamerCtorFn)
|
if (!MCObjectStreamerCtorFn)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
return MCObjectStreamerCtorFn(*this, TT, Ctx, TAB, _OS, _Emitter, STI,
|
return MCObjectStreamerCtorFn(*this, TT, Ctx, TAB, _OS, _Emitter, STI,
|
||||||
RelaxAll, NoExecStack);
|
RelaxAll);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// createAsmStreamer - Create a target specific MCStreamer.
|
/// createAsmStreamer - Create a target specific MCStreamer.
|
||||||
|
@ -173,7 +173,7 @@ bool AsmPrinter::doInitialization(Module &M) {
|
|||||||
const_cast<TargetLoweringObjectFile&>(getObjFileLowering())
|
const_cast<TargetLoweringObjectFile&>(getObjFileLowering())
|
||||||
.Initialize(OutContext, TM);
|
.Initialize(OutContext, TM);
|
||||||
|
|
||||||
OutStreamer.InitSections();
|
OutStreamer.InitSections(false);
|
||||||
|
|
||||||
Mang = new Mangler(TM.getSubtargetImpl()->getDataLayout());
|
Mang = new Mangler(TM.getSubtargetImpl()->getDataLayout());
|
||||||
|
|
||||||
|
@ -201,9 +201,10 @@ bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
|
|||||||
if (!MCE || !MAB)
|
if (!MCE || !MAB)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
AsmStreamer.reset(getTarget().createMCObjectStreamer(
|
AsmStreamer.reset(
|
||||||
getTargetTriple(), *Context, *MAB, Out, MCE, STI,
|
getTarget()
|
||||||
Options.MCOptions.MCRelaxAll, Options.MCOptions.MCNoExecStack));
|
.createMCObjectStreamer(getTargetTriple(), *Context, *MAB, Out, MCE,
|
||||||
|
STI, Options.MCOptions.MCRelaxAll));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CGFT_Null:
|
case CGFT_Null:
|
||||||
@ -255,9 +256,10 @@ bool LLVMTargetMachine::addPassesToEmitMC(PassManagerBase &PM,
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
std::unique_ptr<MCStreamer> AsmStreamer;
|
std::unique_ptr<MCStreamer> AsmStreamer;
|
||||||
AsmStreamer.reset(getTarget().createMCObjectStreamer(
|
AsmStreamer.reset(getTarget()
|
||||||
getTargetTriple(), *Ctx, *MAB, Out, MCE, STI,
|
.createMCObjectStreamer(getTargetTriple(), *Ctx, *MAB,
|
||||||
Options.MCOptions.MCRelaxAll, Options.MCOptions.MCNoExecStack));
|
Out, MCE, STI,
|
||||||
|
Options.MCOptions.MCRelaxAll));
|
||||||
|
|
||||||
// Create the AsmPrinter, which takes ownership of AsmStreamer if successful.
|
// Create the AsmPrinter, which takes ownership of AsmStreamer if successful.
|
||||||
FunctionPass *Printer = getTarget().createAsmPrinter(*this, *AsmStreamer);
|
FunctionPass *Printer = getTarget().createAsmPrinter(*this, *AsmStreamer);
|
||||||
|
@ -1458,14 +1458,7 @@ void ELFObjectWriter::CreateIndexedSections(MCAssembler &Asm,
|
|||||||
RevGroupMapTy &RevGroupMap,
|
RevGroupMapTy &RevGroupMap,
|
||||||
SectionIndexMapTy &SectionIndexMap,
|
SectionIndexMapTy &SectionIndexMap,
|
||||||
const RelMapTy &RelMap) {
|
const RelMapTy &RelMap) {
|
||||||
// Create the .note.GNU-stack section if needed.
|
|
||||||
MCContext &Ctx = Asm.getContext();
|
MCContext &Ctx = Asm.getContext();
|
||||||
if (Asm.getNoExecStack()) {
|
|
||||||
const MCSectionELF *GnuStackSection =
|
|
||||||
Ctx.getELFSection(".note.GNU-stack", ELF::SHT_PROGBITS, 0,
|
|
||||||
SectionKind::getReadOnly());
|
|
||||||
Asm.getOrCreateSectionData(*GnuStackSection);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build the groups
|
// Build the groups
|
||||||
for (MCAssembler::const_iterator it = Asm.begin(), ie = Asm.end();
|
for (MCAssembler::const_iterator it = Asm.begin(), ie = Asm.end();
|
||||||
|
@ -345,9 +345,9 @@ MCSymbolData::MCSymbolData(const MCSymbol &_Symbol, MCFragment *_Fragment,
|
|||||||
MCAssembler::MCAssembler(MCContext &Context_, MCAsmBackend &Backend_,
|
MCAssembler::MCAssembler(MCContext &Context_, MCAsmBackend &Backend_,
|
||||||
MCCodeEmitter &Emitter_, MCObjectWriter &Writer_,
|
MCCodeEmitter &Emitter_, MCObjectWriter &Writer_,
|
||||||
raw_ostream &OS_)
|
raw_ostream &OS_)
|
||||||
: Context(Context_), Backend(Backend_), Emitter(Emitter_), Writer(Writer_),
|
: Context(Context_), Backend(Backend_), Emitter(Emitter_), Writer(Writer_),
|
||||||
OS(OS_), BundleAlignSize(0), RelaxAll(false), NoExecStack(false),
|
OS(OS_), BundleAlignSize(0), RelaxAll(false),
|
||||||
SubsectionsViaSymbols(false), ELFHeaderEFlags(0) {
|
SubsectionsViaSymbols(false), ELFHeaderEFlags(0) {
|
||||||
VersionMinInfo.Major = 0; // Major version == 0 for "none specified"
|
VersionMinInfo.Major = 0; // Major version == 0 for "none specified"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,7 +366,6 @@ void MCAssembler::reset() {
|
|||||||
ThumbFuncs.clear();
|
ThumbFuncs.clear();
|
||||||
BundleAlignSize = 0;
|
BundleAlignSize = 0;
|
||||||
RelaxAll = false;
|
RelaxAll = false;
|
||||||
NoExecStack = false;
|
|
||||||
SubsectionsViaSymbols = false;
|
SubsectionsViaSymbols = false;
|
||||||
ELFHeaderEFlags = 0;
|
ELFHeaderEFlags = 0;
|
||||||
LOHContainer.reset();
|
LOHContainer.reset();
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "llvm/ADT/STLExtras.h"
|
#include "llvm/ADT/STLExtras.h"
|
||||||
#include "llvm/ADT/SmallPtrSet.h"
|
#include "llvm/ADT/SmallPtrSet.h"
|
||||||
#include "llvm/MC/MCAsmBackend.h"
|
#include "llvm/MC/MCAsmBackend.h"
|
||||||
|
#include "llvm/MC/MCAsmInfo.h"
|
||||||
#include "llvm/MC/MCAssembler.h"
|
#include "llvm/MC/MCAssembler.h"
|
||||||
#include "llvm/MC/MCCodeEmitter.h"
|
#include "llvm/MC/MCCodeEmitter.h"
|
||||||
#include "llvm/MC/MCContext.h"
|
#include "llvm/MC/MCContext.h"
|
||||||
@ -38,19 +39,23 @@ using namespace llvm;
|
|||||||
MCELFStreamer::~MCELFStreamer() {
|
MCELFStreamer::~MCELFStreamer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCELFStreamer::InitSections() {
|
void MCELFStreamer::InitSections(bool NoExecStack) {
|
||||||
// This emulates the same behavior of GNU as. This makes it easier
|
// 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.
|
// 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);
|
EmitCodeAlignment(4);
|
||||||
|
|
||||||
SwitchSection(getContext().getObjectFileInfo()->getDataSection());
|
SwitchSection(Ctx.getObjectFileInfo()->getDataSection());
|
||||||
EmitCodeAlignment(4);
|
EmitCodeAlignment(4);
|
||||||
|
|
||||||
SwitchSection(getContext().getObjectFileInfo()->getBSSSection());
|
SwitchSection(Ctx.getObjectFileInfo()->getBSSSection());
|
||||||
EmitCodeAlignment(4);
|
EmitCodeAlignment(4);
|
||||||
|
|
||||||
SwitchSection(getContext().getObjectFileInfo()->getTextSection());
|
SwitchSection(Ctx.getObjectFileInfo()->getTextSection());
|
||||||
|
|
||||||
|
if (NoExecStack)
|
||||||
|
SwitchSection(Ctx.getAsmInfo()->getNonexecutableStackSection(Ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCELFStreamer::EmitLabel(MCSymbol *Symbol) {
|
void MCELFStreamer::EmitLabel(MCSymbol *Symbol) {
|
||||||
@ -543,12 +548,10 @@ void MCELFStreamer::FinishImpl() {
|
|||||||
|
|
||||||
MCStreamer *llvm::createELFStreamer(MCContext &Context, MCAsmBackend &MAB,
|
MCStreamer *llvm::createELFStreamer(MCContext &Context, MCAsmBackend &MAB,
|
||||||
raw_ostream &OS, MCCodeEmitter *CE,
|
raw_ostream &OS, MCCodeEmitter *CE,
|
||||||
bool RelaxAll, bool NoExecStack) {
|
bool RelaxAll) {
|
||||||
MCELFStreamer *S = new MCELFStreamer(Context, MAB, OS, CE);
|
MCELFStreamer *S = new MCELFStreamer(Context, MAB, OS, CE);
|
||||||
if (RelaxAll)
|
if (RelaxAll)
|
||||||
S->getAssembler().setRelaxAll(true);
|
S->getAssembler().setRelaxAll(true);
|
||||||
if (NoExecStack)
|
|
||||||
S->getAssembler().setNoExecStack(true);
|
|
||||||
return S;
|
return S;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -607,7 +607,7 @@ const AsmToken &AsmParser::Lex() {
|
|||||||
bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) {
|
bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) {
|
||||||
// Create the initial section, if requested.
|
// Create the initial section, if requested.
|
||||||
if (!NoInitialTextSection)
|
if (!NoInitialTextSection)
|
||||||
Out.InitSections();
|
Out.InitSections(false);
|
||||||
|
|
||||||
// Prime the lexer.
|
// Prime the lexer.
|
||||||
Lex();
|
Lex();
|
||||||
@ -690,7 +690,7 @@ bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) {
|
|||||||
void AsmParser::checkForValidSection() {
|
void AsmParser::checkForValidSection() {
|
||||||
if (!ParsingInlineAsm && !getStreamer().getCurrentSection().first) {
|
if (!ParsingInlineAsm && !getStreamer().getCurrentSection().first) {
|
||||||
TokError("expected section directive before assembly directive");
|
TokError("expected section directive before assembly directive");
|
||||||
Out.InitSections();
|
Out.InitSections(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ void MCStreamer::EmitEHSymAttributes(const MCSymbol *Symbol,
|
|||||||
MCSymbol *EHSymbol) {
|
MCSymbol *EHSymbol) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCStreamer::InitSections() {
|
void MCStreamer::InitSections(bool NoExecStack) {
|
||||||
SwitchSection(getContext().getObjectFileInfo()->getTextSection());
|
SwitchSection(getContext().getObjectFileInfo()->getTextSection());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ void MCWinCOFFStreamer::EmitInstToData(const MCInst &Inst,
|
|||||||
DF->getContents().append(Code.begin(), Code.end());
|
DF->getContents().append(Code.begin(), Code.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCWinCOFFStreamer::InitSections() {
|
void MCWinCOFFStreamer::InitSections(bool NoExecStack) {
|
||||||
// FIXME: this is identical to the ELF one.
|
// FIXME: this is identical to the ELF one.
|
||||||
// This emulates the same behavior of GNU as. This makes it easier
|
// 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.
|
// to compare the output as the major sections are in the same order.
|
||||||
|
@ -149,12 +149,10 @@ private:
|
|||||||
namespace llvm {
|
namespace llvm {
|
||||||
MCELFStreamer *createAArch64ELFStreamer(MCContext &Context, MCAsmBackend &TAB,
|
MCELFStreamer *createAArch64ELFStreamer(MCContext &Context, MCAsmBackend &TAB,
|
||||||
raw_ostream &OS, MCCodeEmitter *Emitter,
|
raw_ostream &OS, MCCodeEmitter *Emitter,
|
||||||
bool RelaxAll, bool NoExecStack) {
|
bool RelaxAll) {
|
||||||
AArch64ELFStreamer *S = new AArch64ELFStreamer(Context, TAB, OS, Emitter);
|
AArch64ELFStreamer *S = new AArch64ELFStreamer(Context, TAB, OS, Emitter);
|
||||||
if (RelaxAll)
|
if (RelaxAll)
|
||||||
S->getAssembler().setRelaxAll(true);
|
S->getAssembler().setRelaxAll(true);
|
||||||
if (NoExecStack)
|
|
||||||
S->getAssembler().setNoExecStack(true);
|
|
||||||
return S;
|
return S;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ namespace llvm {
|
|||||||
|
|
||||||
MCELFStreamer *createAArch64ELFStreamer(MCContext &Context, MCAsmBackend &TAB,
|
MCELFStreamer *createAArch64ELFStreamer(MCContext &Context, MCAsmBackend &TAB,
|
||||||
raw_ostream &OS, MCCodeEmitter *Emitter,
|
raw_ostream &OS, MCCodeEmitter *Emitter,
|
||||||
bool RelaxAll, bool NoExecStack);
|
bool RelaxAll);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -126,15 +126,14 @@ static MCInstPrinter *createAArch64MCInstPrinter(const Target &T,
|
|||||||
static MCStreamer *createMCStreamer(const Target &T, StringRef TT,
|
static MCStreamer *createMCStreamer(const Target &T, StringRef TT,
|
||||||
MCContext &Ctx, MCAsmBackend &TAB,
|
MCContext &Ctx, MCAsmBackend &TAB,
|
||||||
raw_ostream &OS, MCCodeEmitter *Emitter,
|
raw_ostream &OS, MCCodeEmitter *Emitter,
|
||||||
const MCSubtargetInfo &STI, bool RelaxAll,
|
const MCSubtargetInfo &STI, bool RelaxAll) {
|
||||||
bool NoExecStack) {
|
|
||||||
Triple TheTriple(TT);
|
Triple TheTriple(TT);
|
||||||
|
|
||||||
if (TheTriple.isOSDarwin())
|
if (TheTriple.isOSDarwin())
|
||||||
return createMachOStreamer(Ctx, TAB, OS, Emitter, RelaxAll,
|
return createMachOStreamer(Ctx, TAB, OS, Emitter, RelaxAll,
|
||||||
/*LabelSections*/ true);
|
/*LabelSections*/ true);
|
||||||
|
|
||||||
return createAArch64ELFStreamer(Ctx, TAB, OS, Emitter, RelaxAll, NoExecStack);
|
return createAArch64ELFStreamer(Ctx, TAB, OS, Emitter, RelaxAll);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force static initialization.
|
// Force static initialization.
|
||||||
|
@ -9260,7 +9260,7 @@ bool ARMAsmParser::parseDirectiveEven(SMLoc L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!Section) {
|
if (!Section) {
|
||||||
getStreamer().InitSections();
|
getStreamer().InitSections(false);
|
||||||
Section = getStreamer().getCurrentSection().first;
|
Section = getStreamer().getCurrentSection().first;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1347,10 +1347,9 @@ MCStreamer *createARMNullStreamer(MCContext &Ctx) {
|
|||||||
return S;
|
return S;
|
||||||
}
|
}
|
||||||
|
|
||||||
MCELFStreamer* createARMELFStreamer(MCContext &Context, MCAsmBackend &TAB,
|
MCELFStreamer *createARMELFStreamer(MCContext &Context, MCAsmBackend &TAB,
|
||||||
raw_ostream &OS, MCCodeEmitter *Emitter,
|
raw_ostream &OS, MCCodeEmitter *Emitter,
|
||||||
bool RelaxAll, bool NoExecStack,
|
bool RelaxAll, bool IsThumb) {
|
||||||
bool IsThumb) {
|
|
||||||
ARMELFStreamer *S = new ARMELFStreamer(Context, TAB, OS, Emitter, IsThumb);
|
ARMELFStreamer *S = new ARMELFStreamer(Context, TAB, OS, Emitter, IsThumb);
|
||||||
new ARMTargetELFStreamer(*S);
|
new ARMTargetELFStreamer(*S);
|
||||||
// FIXME: This should eventually end up somewhere else where more
|
// FIXME: This should eventually end up somewhere else where more
|
||||||
@ -1360,8 +1359,6 @@ MCStreamer *createARMNullStreamer(MCContext &Ctx) {
|
|||||||
|
|
||||||
if (RelaxAll)
|
if (RelaxAll)
|
||||||
S->getAssembler().setRelaxAll(true);
|
S->getAssembler().setRelaxAll(true);
|
||||||
if (NoExecStack)
|
|
||||||
S->getAssembler().setNoExecStack(true);
|
|
||||||
return S;
|
return S;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,11 +265,8 @@ static MCCodeGenInfo *createARMMCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
|||||||
// This is duplicated code. Refactor this.
|
// This is duplicated code. Refactor this.
|
||||||
static MCStreamer *createMCStreamer(const Target &T, StringRef TT,
|
static MCStreamer *createMCStreamer(const Target &T, StringRef TT,
|
||||||
MCContext &Ctx, MCAsmBackend &MAB,
|
MCContext &Ctx, MCAsmBackend &MAB,
|
||||||
raw_ostream &OS,
|
raw_ostream &OS, MCCodeEmitter *Emitter,
|
||||||
MCCodeEmitter *Emitter,
|
const MCSubtargetInfo &STI, bool RelaxAll) {
|
||||||
const MCSubtargetInfo &STI,
|
|
||||||
bool RelaxAll,
|
|
||||||
bool NoExecStack) {
|
|
||||||
Triple TheTriple(TT);
|
Triple TheTriple(TT);
|
||||||
|
|
||||||
switch (TheTriple.getObjectFormat()) {
|
switch (TheTriple.getObjectFormat()) {
|
||||||
@ -283,7 +280,7 @@ static MCStreamer *createMCStreamer(const Target &T, StringRef TT,
|
|||||||
assert(TheTriple.isOSWindows() && "non-Windows ARM COFF is not supported");
|
assert(TheTriple.isOSWindows() && "non-Windows ARM COFF is not supported");
|
||||||
return createARMWinCOFFStreamer(Ctx, MAB, *Emitter, OS);
|
return createARMWinCOFFStreamer(Ctx, MAB, *Emitter, OS);
|
||||||
case Triple::ELF:
|
case Triple::ELF:
|
||||||
return createARMELFStreamer(Ctx, MAB, OS, Emitter, false, NoExecStack,
|
return createARMELFStreamer(Ctx, MAB, OS, Emitter, false,
|
||||||
TheTriple.getArch() == Triple::thumb);
|
TheTriple.getArch() == Triple::thumb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,8 @@ void MipsELFStreamer::EmitMipsOptionRecords() {
|
|||||||
namespace llvm {
|
namespace llvm {
|
||||||
MCELFStreamer *createMipsELFStreamer(MCContext &Context, MCAsmBackend &MAB,
|
MCELFStreamer *createMipsELFStreamer(MCContext &Context, MCAsmBackend &MAB,
|
||||||
raw_ostream &OS, MCCodeEmitter *Emitter,
|
raw_ostream &OS, MCCodeEmitter *Emitter,
|
||||||
const MCSubtargetInfo &STI, bool RelaxAll,
|
const MCSubtargetInfo &STI,
|
||||||
bool NoExecStack) {
|
bool RelaxAll) {
|
||||||
return new MipsELFStreamer(Context, MAB, OS, Emitter, STI);
|
return new MipsELFStreamer(Context, MAB, OS, Emitter, STI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,6 @@ public:
|
|||||||
|
|
||||||
MCELFStreamer *createMipsELFStreamer(MCContext &Context, MCAsmBackend &MAB,
|
MCELFStreamer *createMipsELFStreamer(MCContext &Context, MCAsmBackend &MAB,
|
||||||
raw_ostream &OS, MCCodeEmitter *Emitter,
|
raw_ostream &OS, MCCodeEmitter *Emitter,
|
||||||
const MCSubtargetInfo &STI, bool RelaxAll,
|
const MCSubtargetInfo &STI, bool RelaxAll);
|
||||||
bool NoExecStack);
|
|
||||||
} // namespace llvm.
|
} // namespace llvm.
|
||||||
#endif
|
#endif
|
||||||
|
@ -26,8 +26,7 @@ MCELFStreamer *createMipsNaClELFStreamer(MCContext &Context, MCAsmBackend &TAB,
|
|||||||
raw_ostream &OS,
|
raw_ostream &OS,
|
||||||
MCCodeEmitter *Emitter,
|
MCCodeEmitter *Emitter,
|
||||||
const MCSubtargetInfo &STI,
|
const MCSubtargetInfo &STI,
|
||||||
bool RelaxAll, bool NoExecStack);
|
bool RelaxAll);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -109,15 +109,12 @@ static MCInstPrinter *createMipsMCInstPrinter(const Target &T,
|
|||||||
static MCStreamer *createMCStreamer(const Target &T, StringRef TT,
|
static MCStreamer *createMCStreamer(const Target &T, StringRef TT,
|
||||||
MCContext &Context, MCAsmBackend &MAB,
|
MCContext &Context, MCAsmBackend &MAB,
|
||||||
raw_ostream &OS, MCCodeEmitter *Emitter,
|
raw_ostream &OS, MCCodeEmitter *Emitter,
|
||||||
const MCSubtargetInfo &STI,
|
const MCSubtargetInfo &STI, bool RelaxAll) {
|
||||||
bool RelaxAll, bool NoExecStack) {
|
|
||||||
MCStreamer *S;
|
MCStreamer *S;
|
||||||
if (!Triple(TT).isOSNaCl())
|
if (!Triple(TT).isOSNaCl())
|
||||||
S = createMipsELFStreamer(Context, MAB, OS, Emitter, STI, RelaxAll,
|
S = createMipsELFStreamer(Context, MAB, OS, Emitter, STI, RelaxAll);
|
||||||
NoExecStack);
|
|
||||||
else
|
else
|
||||||
S = createMipsNaClELFStreamer(Context, MAB, OS, Emitter, STI, RelaxAll,
|
S = createMipsNaClELFStreamer(Context, MAB, OS, Emitter, STI, RelaxAll);
|
||||||
NoExecStack);
|
|
||||||
new MipsTargetELFStreamer(*S, STI);
|
new MipsTargetELFStreamer(*S, STI);
|
||||||
return S;
|
return S;
|
||||||
}
|
}
|
||||||
|
@ -255,13 +255,11 @@ MCELFStreamer *createMipsNaClELFStreamer(MCContext &Context, MCAsmBackend &TAB,
|
|||||||
raw_ostream &OS,
|
raw_ostream &OS,
|
||||||
MCCodeEmitter *Emitter,
|
MCCodeEmitter *Emitter,
|
||||||
const MCSubtargetInfo &STI,
|
const MCSubtargetInfo &STI,
|
||||||
bool RelaxAll, bool NoExecStack) {
|
bool RelaxAll) {
|
||||||
MipsNaClELFStreamer *S = new MipsNaClELFStreamer(Context, TAB, OS, Emitter,
|
MipsNaClELFStreamer *S = new MipsNaClELFStreamer(Context, TAB, OS, Emitter,
|
||||||
STI);
|
STI);
|
||||||
if (RelaxAll)
|
if (RelaxAll)
|
||||||
S->getAssembler().setRelaxAll(true);
|
S->getAssembler().setRelaxAll(true);
|
||||||
if (NoExecStack)
|
|
||||||
S->getAssembler().setNoExecStack(true);
|
|
||||||
|
|
||||||
// Set bundle-alignment as required by the NaCl ABI for the target.
|
// Set bundle-alignment as required by the NaCl ABI for the target.
|
||||||
S->EmitBundleAlignMode(MIPS_NACL_BUNDLE_ALIGN);
|
S->EmitBundleAlignMode(MIPS_NACL_BUNDLE_ALIGN);
|
||||||
|
@ -208,19 +208,15 @@ public:
|
|||||||
// This is duplicated code. Refactor this.
|
// This is duplicated code. Refactor this.
|
||||||
static MCStreamer *createMCStreamer(const Target &T, StringRef TT,
|
static MCStreamer *createMCStreamer(const Target &T, StringRef TT,
|
||||||
MCContext &Ctx, MCAsmBackend &MAB,
|
MCContext &Ctx, MCAsmBackend &MAB,
|
||||||
raw_ostream &OS,
|
raw_ostream &OS, MCCodeEmitter *Emitter,
|
||||||
MCCodeEmitter *Emitter,
|
const MCSubtargetInfo &STI, bool RelaxAll) {
|
||||||
const MCSubtargetInfo &STI,
|
|
||||||
bool RelaxAll,
|
|
||||||
bool NoExecStack) {
|
|
||||||
if (Triple(TT).isOSDarwin()) {
|
if (Triple(TT).isOSDarwin()) {
|
||||||
MCStreamer *S = createMachOStreamer(Ctx, MAB, OS, Emitter, RelaxAll);
|
MCStreamer *S = createMachOStreamer(Ctx, MAB, OS, Emitter, RelaxAll);
|
||||||
new PPCTargetMachOStreamer(*S);
|
new PPCTargetMachOStreamer(*S);
|
||||||
return S;
|
return S;
|
||||||
}
|
}
|
||||||
|
|
||||||
MCStreamer *S =
|
MCStreamer *S = createELFStreamer(Ctx, MAB, OS, Emitter, RelaxAll);
|
||||||
createELFStreamer(Ctx, MAB, OS, Emitter, RelaxAll, NoExecStack);
|
|
||||||
new PPCTargetELFStreamer(*S);
|
new PPCTargetELFStreamer(*S);
|
||||||
return S;
|
return S;
|
||||||
}
|
}
|
||||||
|
@ -84,12 +84,9 @@ static MCCodeEmitter *createAMDGPUMCCodeEmitter(const MCInstrInfo &MCII,
|
|||||||
|
|
||||||
static MCStreamer *createMCStreamer(const Target &T, StringRef TT,
|
static MCStreamer *createMCStreamer(const Target &T, StringRef TT,
|
||||||
MCContext &Ctx, MCAsmBackend &MAB,
|
MCContext &Ctx, MCAsmBackend &MAB,
|
||||||
raw_ostream &_OS,
|
raw_ostream &_OS, MCCodeEmitter *_Emitter,
|
||||||
MCCodeEmitter *_Emitter,
|
const MCSubtargetInfo &STI, bool RelaxAll) {
|
||||||
const MCSubtargetInfo &STI,
|
return createELFStreamer(Ctx, MAB, _OS, _Emitter, false);
|
||||||
bool RelaxAll,
|
|
||||||
bool NoExecStack) {
|
|
||||||
return createELFStreamer(Ctx, MAB, _OS, _Emitter, false, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void LLVMInitializeR600TargetMC() {
|
extern "C" void LLVMInitializeR600TargetMC() {
|
||||||
|
@ -125,10 +125,8 @@ static MCCodeGenInfo *createSparcV9MCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
|||||||
static MCStreamer *createMCStreamer(const Target &T, StringRef TT,
|
static MCStreamer *createMCStreamer(const Target &T, StringRef TT,
|
||||||
MCContext &Context, MCAsmBackend &MAB,
|
MCContext &Context, MCAsmBackend &MAB,
|
||||||
raw_ostream &OS, MCCodeEmitter *Emitter,
|
raw_ostream &OS, MCCodeEmitter *Emitter,
|
||||||
const MCSubtargetInfo &STI, bool RelaxAll,
|
const MCSubtargetInfo &STI, bool RelaxAll) {
|
||||||
bool NoExecStack) {
|
MCStreamer *S = createELFStreamer(Context, MAB, OS, Emitter, RelaxAll);
|
||||||
MCStreamer *S =
|
|
||||||
createELFStreamer(Context, MAB, OS, Emitter, RelaxAll, NoExecStack);
|
|
||||||
new SparcTargetELFStreamer(*S);
|
new SparcTargetELFStreamer(*S);
|
||||||
return S;
|
return S;
|
||||||
}
|
}
|
||||||
|
@ -181,15 +181,12 @@ static MCInstPrinter *createSystemZMCInstPrinter(const Target &T,
|
|||||||
return new SystemZInstPrinter(MAI, MII, MRI);
|
return new SystemZInstPrinter(MAI, MII, MRI);
|
||||||
}
|
}
|
||||||
|
|
||||||
static MCStreamer *createSystemZMCObjectStreamer(const Target &T, StringRef TT,
|
static MCStreamer *
|
||||||
MCContext &Ctx,
|
createSystemZMCObjectStreamer(const Target &T, StringRef TT, MCContext &Ctx,
|
||||||
MCAsmBackend &MAB,
|
MCAsmBackend &MAB, raw_ostream &OS,
|
||||||
raw_ostream &OS,
|
MCCodeEmitter *Emitter,
|
||||||
MCCodeEmitter *Emitter,
|
const MCSubtargetInfo &STI, bool RelaxAll) {
|
||||||
const MCSubtargetInfo &STI,
|
return createELFStreamer(Ctx, MAB, OS, Emitter, RelaxAll);
|
||||||
bool RelaxAll,
|
|
||||||
bool NoExecStack) {
|
|
||||||
return createELFStreamer(Ctx, MAB, OS, Emitter, RelaxAll, NoExecStack);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void LLVMInitializeSystemZTargetMC() {
|
extern "C" void LLVMInitializeSystemZTargetMC() {
|
||||||
|
@ -351,11 +351,8 @@ static MCCodeGenInfo *createX86MCCodeGenInfo(StringRef TT, Reloc::Model RM,
|
|||||||
|
|
||||||
static MCStreamer *createMCStreamer(const Target &T, StringRef TT,
|
static MCStreamer *createMCStreamer(const Target &T, StringRef TT,
|
||||||
MCContext &Ctx, MCAsmBackend &MAB,
|
MCContext &Ctx, MCAsmBackend &MAB,
|
||||||
raw_ostream &_OS,
|
raw_ostream &_OS, MCCodeEmitter *_Emitter,
|
||||||
MCCodeEmitter *_Emitter,
|
const MCSubtargetInfo &STI, bool RelaxAll) {
|
||||||
const MCSubtargetInfo &STI,
|
|
||||||
bool RelaxAll,
|
|
||||||
bool NoExecStack) {
|
|
||||||
Triple TheTriple(TT);
|
Triple TheTriple(TT);
|
||||||
|
|
||||||
switch (TheTriple.getObjectFormat()) {
|
switch (TheTriple.getObjectFormat()) {
|
||||||
@ -366,7 +363,7 @@ static MCStreamer *createMCStreamer(const Target &T, StringRef TT,
|
|||||||
assert(TheTriple.isOSWindows() && "only Windows COFF is supported");
|
assert(TheTriple.isOSWindows() && "only Windows COFF is supported");
|
||||||
return createX86WinCOFFStreamer(Ctx, MAB, _Emitter, _OS, RelaxAll);
|
return createX86WinCOFFStreamer(Ctx, MAB, _Emitter, _OS, RelaxAll);
|
||||||
case Triple::ELF:
|
case Triple::ELF:
|
||||||
return createELFStreamer(Ctx, MAB, _OS, _Emitter, RelaxAll, NoExecStack);
|
return createELFStreamer(Ctx, MAB, _OS, _Emitter, RelaxAll);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ int Disassembler::disassemble(const Target &T,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set up initial section manually here
|
// Set up initial section manually here
|
||||||
Streamer.InitSections();
|
Streamer.InitSections(false);
|
||||||
|
|
||||||
bool ErrorOccurred = false;
|
bool ErrorOccurred = false;
|
||||||
|
|
||||||
|
@ -471,9 +471,10 @@ int main(int argc, char **argv) {
|
|||||||
assert(FileType == OFT_ObjectFile && "Invalid file type!");
|
assert(FileType == OFT_ObjectFile && "Invalid file type!");
|
||||||
MCCodeEmitter *CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, *STI, Ctx);
|
MCCodeEmitter *CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, *STI, Ctx);
|
||||||
MCAsmBackend *MAB = TheTarget->createMCAsmBackend(*MRI, TripleName, MCPU);
|
MCAsmBackend *MAB = TheTarget->createMCAsmBackend(*MRI, TripleName, MCPU);
|
||||||
Str.reset(TheTarget->createMCObjectStreamer(TripleName, Ctx, *MAB,
|
Str.reset(TheTarget->createMCObjectStreamer(TripleName, Ctx, *MAB, FOS, CE,
|
||||||
FOS, CE, *STI, RelaxAll,
|
*STI, RelaxAll));
|
||||||
NoExecStack));
|
if (NoExecStack)
|
||||||
|
Str->InitSections(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Res = 1;
|
int Res = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user