llvm.org GIT mirror llvm / fc5436c
Always print the implicit .text at the start of an asm file. Before llvm-mc would print it, but llc was assuming that it would produce another section changing directive before one was needed. That assumption is false with inline asm. Fixes PR19049. Another option would be to always create the section, but in the asm printer avoid printing sections changes during initialization. That would work, but * We do use the fact that llvm-mc prints it in testing. The tests can be changed if needed. * A quick poll on IRC suggest that most developers prefer the implicit .text to be printed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203001 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 5 years ago
9 changed file(s) with 18 addition(s) and 17 deletion(s). Raw diff Collapse all Expand all
4343 /// @name MCStreamer Interface
4444 /// @{
4545
46 virtual void InitSections(bool Force);
46 virtual void InitSections();
4747 virtual void ChangeSection(const MCSection *Section,
4848 const MCExpr *Subsection);
4949 virtual void EmitLabel(MCSymbol *Symbol);
351351 }
352352
353353 /// Create the default sections and set the initial one.
354 ///
355 /// @param Force - If false, a text streamer implementation can be a nop.
356 /// Used by CodeGen to avoid starting every file with '.text'.
357 virtual void InitSections(bool Force = true);
354 virtual void InitSections();
358355
359356 /// AssignSection - Sets the symbol's section.
360357 ///
174174 const_cast(getObjFileLowering())
175175 .Initialize(OutContext, TM);
176176
177 OutStreamer.InitSections(false);
177 OutStreamer.InitSections();
178178
179179 Mang = new Mangler(TM.getDataLayout());
180180
125125
126126 virtual void ChangeSection(const MCSection *Section,
127127 const MCExpr *Subsection);
128
129 virtual void InitSections(bool Force) {
130 if (Force)
131 SwitchSection(getContext().getObjectFileInfo()->getTextSection());
132 }
133128
134129 virtual void EmitLabel(MCSymbol *Symbol);
135130 virtual void EmitDebugLabel(MCSymbol *Symbol);
3737 MCELFStreamer::~MCELFStreamer() {
3838 }
3939
40 void MCELFStreamer::InitSections(bool Force) {
40 void MCELFStreamer::InitSections() {
4141 // This emulates the same behavior of GNU as. This makes it easier
4242 // to compare the output as the major sections are in the same order.
4343 SwitchSection(getContext().getObjectFileInfo()->getTextSection());
204204 MCSymbol *EHSymbol) {
205205 }
206206
207 void MCStreamer::InitSections(bool Force) {
207 void MCStreamer::InitSections() {
208208 SwitchSection(getContext().getObjectFileInfo()->getTextSection());
209209 }
210210
4949
5050 // MCStreamer interface
5151
52 virtual void InitSections(bool Force);
52 virtual void InitSections();
5353 virtual void EmitLabel(MCSymbol *Symbol);
5454 virtual void EmitDebugLabel(MCSymbol *Symbol);
5555 virtual void EmitAssemblerFlag(MCAssemblerFlag Flag);
122122
123123 // MCStreamer interface
124124
125 void WinCOFFStreamer::InitSections(bool Force) {
125 void WinCOFFStreamer::InitSections() {
126126 // FIXME: this is identical to the ELF one.
127127 // This emulates the same behavior of GNU as. This makes it easier
128128 // to compare the output as the major sections are in the same order.
0 ; RUN: llc < %s -mtriple=x86_64-linux-gnu | FileCheck %s
11
2 ; CHECK: .text
3 ; CHECK-NEXT: .file ""
4
25 define i32 @main(i32 %x) nounwind gc "ocaml" {
3 ; CHECK: .text
4 ; CHECK-NEXT: .globl "caml__code_begin"
6 ; CHECK: .globl "caml__code_begin"
57 ; CHECK-NEXT: "caml__code_begin":
68 ; CHECK-NEXT: .data
79 ; CHECK-NEXT: .globl "caml__data_begin"
0 ; RUN: llc -mtriple x86_64-pc-linux %s -o - | FileCheck %s
1
2 module asm ".pushsection foo"
3 module asm ".popsection"
4
5 ; CHECK: .section foo,"",@progbits
6 ; CHECK: .text