summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/WinCOFFStreamer.cpp
diff options
context:
space:
mode:
authorEli Bendersky <eliben@google.com>2013-01-14 19:04:57 +0000
committerEli Bendersky <eliben@google.com>2013-01-14 19:04:57 +0000
commitcbb2514d510b49bad9a4f2787ac49e4f905b20e1 (patch)
tree87448eeb9b41f1e452c85ed83b770570178fe52e /llvm/lib/MC/WinCOFFStreamer.cpp
parenta7b905eeaaf19be454c1aea0f06bb2fc23b16743 (diff)
downloadbcm5719-llvm-cbb2514d510b49bad9a4f2787ac49e4f905b20e1.tar.gz
bcm5719-llvm-cbb2514d510b49bad9a4f2787ac49e4f905b20e1.zip
Expose an InitToTextSection through MCStreamer.
The aim of this patch is to fix the following piece of code in the platform-independent AsmParser: void AsmParser::CheckForValidSection() { if (!ParsingInlineAsm && !getStreamer().getCurrentSection()) { TokError("expected section directive before assembly directive"); Out.SwitchSection(Ctx.getMachOSection( "__TEXT", "__text", MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS, 0, SectionKind::getText())); } } This was added for the "-n" option of llvm-mc. The proposed fix adds another virtual method to MCStreamer, called InitToTextSection. Conceptually, it's similar to the existing InitSections which initializes all common sections and switches to text. The new method is implemented by each platform streamer in a way that it sees fit. So AsmParser can now do this: void AsmParser::CheckForValidSection() { if (!ParsingInlineAsm && !getStreamer().getCurrentSection()) { TokError("expected section directive before assembly directive"); Out.InitToTextSection(); } } Which is much more reasonable. llvm-svn: 172450
Diffstat (limited to 'llvm/lib/MC/WinCOFFStreamer.cpp')
-rw-r--r--llvm/lib/MC/WinCOFFStreamer.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/MC/WinCOFFStreamer.cpp b/llvm/lib/MC/WinCOFFStreamer.cpp
index 5489ef8d89d..cc2c272f38b 100644
--- a/llvm/lib/MC/WinCOFFStreamer.cpp
+++ b/llvm/lib/MC/WinCOFFStreamer.cpp
@@ -50,6 +50,7 @@ public:
// MCStreamer interface
virtual void InitSections();
+ virtual void InitToTextSection();
virtual void EmitLabel(MCSymbol *Symbol);
virtual void EmitDebugLabel(MCSymbol *Symbol);
virtual void EmitAssemblerFlag(MCAssemblerFlag Flag);
@@ -173,6 +174,10 @@ void WinCOFFStreamer::AddCommonSymbol(MCSymbol *Symbol, uint64_t Size,
// MCStreamer interface
+void WinCOFFStreamer::InitToTextSection() {
+ SetSectionText();
+}
+
void WinCOFFStreamer::InitSections() {
SetSectionText();
SetSectionData();
OpenPOWER on IntegriCloud