mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-21 02:24:22 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172450 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -36,6 +36,7 @@ public:
|
||||
/// @{
|
||||
|
||||
virtual void InitSections();
|
||||
virtual void InitToTextSection();
|
||||
virtual void EmitLabel(MCSymbol *Symbol);
|
||||
virtual void EmitDebugLabel(MCSymbol *Symbol);
|
||||
virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
|
||||
@ -104,11 +105,14 @@ public:
|
||||
} // end anonymous namespace.
|
||||
|
||||
void MCPureStreamer::InitSections() {
|
||||
InitToTextSection();
|
||||
}
|
||||
|
||||
void MCPureStreamer::InitToTextSection() {
|
||||
// FIMXE: To what!?
|
||||
SwitchSection(getContext().getMachOSection("__TEXT", "__text",
|
||||
MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
|
||||
0, SectionKind::getText()));
|
||||
|
||||
}
|
||||
|
||||
void MCPureStreamer::EmitLabel(MCSymbol *Symbol) {
|
||||
|
Reference in New Issue
Block a user