mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-30 02:25:19 +00:00
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
This commit is contained in:
@@ -44,7 +44,7 @@ public:
|
|||||||
/// @name MCStreamer Interface
|
/// @name MCStreamer Interface
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
virtual void InitSections(bool Force);
|
virtual void InitSections();
|
||||||
virtual void ChangeSection(const MCSection *Section,
|
virtual void ChangeSection(const MCSection *Section,
|
||||||
const MCExpr *Subsection);
|
const MCExpr *Subsection);
|
||||||
virtual void EmitLabel(MCSymbol *Symbol);
|
virtual void EmitLabel(MCSymbol *Symbol);
|
||||||
|
@@ -352,10 +352,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Create the default sections and set the initial one.
|
/// Create the default sections and set the initial one.
|
||||||
///
|
virtual void InitSections();
|
||||||
/// @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.
|
/// AssignSection - Sets the symbol's section.
|
||||||
///
|
///
|
||||||
|
@@ -175,7 +175,7 @@ bool AsmPrinter::doInitialization(Module &M) {
|
|||||||
const_cast<TargetLoweringObjectFile&>(getObjFileLowering())
|
const_cast<TargetLoweringObjectFile&>(getObjFileLowering())
|
||||||
.Initialize(OutContext, TM);
|
.Initialize(OutContext, TM);
|
||||||
|
|
||||||
OutStreamer.InitSections(false);
|
OutStreamer.InitSections();
|
||||||
|
|
||||||
Mang = new Mangler(TM.getDataLayout());
|
Mang = new Mangler(TM.getDataLayout());
|
||||||
|
|
||||||
|
@@ -127,11 +127,6 @@ public:
|
|||||||
virtual void ChangeSection(const MCSection *Section,
|
virtual void ChangeSection(const MCSection *Section,
|
||||||
const MCExpr *Subsection);
|
const MCExpr *Subsection);
|
||||||
|
|
||||||
virtual void InitSections(bool Force) {
|
|
||||||
if (Force)
|
|
||||||
SwitchSection(getContext().getObjectFileInfo()->getTextSection());
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void EmitLabel(MCSymbol *Symbol);
|
virtual void EmitLabel(MCSymbol *Symbol);
|
||||||
virtual void EmitDebugLabel(MCSymbol *Symbol);
|
virtual void EmitDebugLabel(MCSymbol *Symbol);
|
||||||
|
|
||||||
|
@@ -38,7 +38,7 @@ using namespace llvm;
|
|||||||
MCELFStreamer::~MCELFStreamer() {
|
MCELFStreamer::~MCELFStreamer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCELFStreamer::InitSections(bool Force) {
|
void MCELFStreamer::InitSections() {
|
||||||
// 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());
|
SwitchSection(getContext().getObjectFileInfo()->getTextSection());
|
||||||
|
@@ -205,7 +205,7 @@ void MCStreamer::EmitEHSymAttributes(const MCSymbol *Symbol,
|
|||||||
MCSymbol *EHSymbol) {
|
MCSymbol *EHSymbol) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCStreamer::InitSections(bool Force) {
|
void MCStreamer::InitSections() {
|
||||||
SwitchSection(getContext().getObjectFileInfo()->getTextSection());
|
SwitchSection(getContext().getObjectFileInfo()->getTextSection());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -50,7 +50,7 @@ public:
|
|||||||
|
|
||||||
// MCStreamer interface
|
// MCStreamer interface
|
||||||
|
|
||||||
virtual void InitSections(bool Force);
|
virtual void InitSections();
|
||||||
virtual void EmitLabel(MCSymbol *Symbol);
|
virtual void EmitLabel(MCSymbol *Symbol);
|
||||||
virtual void EmitDebugLabel(MCSymbol *Symbol);
|
virtual void EmitDebugLabel(MCSymbol *Symbol);
|
||||||
virtual void EmitAssemblerFlag(MCAssemblerFlag Flag);
|
virtual void EmitAssemblerFlag(MCAssemblerFlag Flag);
|
||||||
@@ -123,7 +123,7 @@ void WinCOFFStreamer::AddCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
|||||||
|
|
||||||
// MCStreamer interface
|
// MCStreamer interface
|
||||||
|
|
||||||
void WinCOFFStreamer::InitSections(bool Force) {
|
void WinCOFFStreamer::InitSections() {
|
||||||
// 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.
|
||||||
|
@@ -1,8 +1,10 @@
|
|||||||
; RUN: llc < %s -mtriple=x86_64-linux-gnu | FileCheck %s
|
; RUN: llc < %s -mtriple=x86_64-linux-gnu | FileCheck %s
|
||||||
|
|
||||||
define i32 @main(i32 %x) nounwind gc "ocaml" {
|
|
||||||
; CHECK: .text
|
; CHECK: .text
|
||||||
; CHECK-NEXT: .globl "caml<stdin>__code_begin"
|
; CHECK-NEXT: .file "<stdin>"
|
||||||
|
|
||||||
|
define i32 @main(i32 %x) nounwind gc "ocaml" {
|
||||||
|
; CHECK: .globl "caml<stdin>__code_begin"
|
||||||
; CHECK-NEXT: "caml<stdin>__code_begin":
|
; CHECK-NEXT: "caml<stdin>__code_begin":
|
||||||
; CHECK-NEXT: .data
|
; CHECK-NEXT: .data
|
||||||
; CHECK-NEXT: .globl "caml<stdin>__data_begin"
|
; CHECK-NEXT: .globl "caml<stdin>__data_begin"
|
||||||
|
7
test/CodeGen/X86/pr19049.ll
Normal file
7
test/CodeGen/X86/pr19049.ll
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
; RUN: llc -mtriple x86_64-pc-linux %s -o - | FileCheck %s
|
||||||
|
|
||||||
|
module asm ".pushsection foo"
|
||||||
|
module asm ".popsection"
|
||||||
|
|
||||||
|
; CHECK: .section foo,"",@progbits
|
||||||
|
; CHECK: .text
|
Reference in New Issue
Block a user