/// @name MCStreamer Interface
/// @{
- virtual void InitSections();
+ virtual void InitSections(bool Force);
virtual void ChangeSection(const MCSection *Section,
const MCExpr *Subsection);
virtual void EmitLabel(MCSymbol *Symbol);
/// values saved by PushSection.
SmallVector<std::pair<MCSectionSubPair, MCSectionSubPair>, 4> SectionStack;
- bool AutoInitSections;
-
protected:
MCStreamer(MCContext &Ctx, MCTargetStreamer *TargetStreamer);
SectionStack.back().first = MCSectionSubPair(Section, Subsection);
}
- /// Initialize the streamer.
- void InitStreamer() {
- if (AutoInitSections)
- InitSections();
- }
-
- /// Tell this MCStreamer to call InitSections upon initialization.
- void setAutoInitSections(bool AutoInitSections) {
- this->AutoInitSections = AutoInitSections;
- }
-
- /// InitSections - Create the default sections and set the initial one.
- virtual void InitSections();
+ /// Create the default sections and set the initial one.
+ ///
+ /// @param Force - If false, a text streamer implementation can be a nop.
+ /// Used by CodeGen to avoid starting every file with '.text'.
+ virtual void InitSections(bool Force = true);
/// AssignSection - Sets the symbol's section.
///
const_cast<TargetLoweringObjectFile&>(getObjFileLowering())
.Initialize(OutContext, TM);
- OutStreamer.InitStreamer();
+ OutStreamer.InitSections(false);
Mang = new Mangler(TM.getDataLayout());
*Context, *MAB, Out,
MCE, hasMCRelaxAll(),
hasMCNoExecStack()));
- AsmStreamer.get()->setAutoInitSections(true);
break;
}
case CGFT_Null:
virtual void ChangeSection(const MCSection *Section,
const MCExpr *Subsection);
+ virtual void InitSections(bool Force) {
+ if (Force)
+ SwitchSection(getContext().getObjectFileInfo()->getTextSection());
+ }
+
virtual void EmitLabel(MCSymbol *Symbol);
virtual void EmitDebugLabel(MCSymbol *Symbol);
MCELFStreamer::~MCELFStreamer() {
}
-void MCELFStreamer::InitSections() {
+void MCELFStreamer::InitSections(bool Force) {
// 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());
MCStreamer::MCStreamer(MCContext &Ctx, MCTargetStreamer *TargetStreamer)
: Context(Ctx), TargetStreamer(TargetStreamer), EmitEHFrame(true),
- EmitDebugFrame(false), CurrentW64UnwindInfo(0), LastSymbol(0),
- AutoInitSections(false) {
+ EmitDebugFrame(false), CurrentW64UnwindInfo(0), LastSymbol(0) {
SectionStack.push_back(std::pair<MCSectionSubPair, MCSectionSubPair>());
if (TargetStreamer)
TargetStreamer->setStreamer(this);
MCSymbol *EHSymbol) {
}
-void MCStreamer::InitSections() {
+void MCStreamer::InitSections(bool Force) {
SwitchSection(getContext().getObjectFileInfo()->getTextSection());
}
// MCStreamer interface
- virtual void InitSections();
+ virtual void InitSections(bool Force);
virtual void EmitLabel(MCSymbol *Symbol);
virtual void EmitDebugLabel(MCSymbol *Symbol);
virtual void EmitAssemblerFlag(MCAssemblerFlag Flag);
// MCStreamer interface
-void WinCOFFStreamer::InitSections() {
+void WinCOFFStreamer::InitSections(bool Force) {
// FIXME: this is identical to the ELF one.
// 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.