From 812209a58c5520c604bc9279aa069e5ae066e860 Mon Sep 17 00:00:00 2001 From: Bob Wilson Date: Wed, 30 Sep 2009 22:06:26 +0000 Subject: Add a new virtual EmitStartOfAsmFile method to the AsmPrinter and use this to emit target-specific things at the beginning of the asm output. This fixes a problem for PPC, where the text sections are not being kept together as expected. The base class doInitialization code calls DW->BeginModule() which emits a bunch of DWARF section directives. The PPC doInitialization code then emits all the TEXT section directives, with the intention that they will be kept together. But as I understand it, the Darwin assembler treats the default TEXT section as a special case and moves it to the beginning of the file, which means that all those DWARF sections are in the middle of the text. With this change, the EmitStartOfAsmFile hook is called before the DWARF section directives are emitted, so that all the PPC text section directives come out right at the beginning of the file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83176 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'lib/Target/Mips') diff --git a/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp b/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp index 4962603..fb5e5fc 100644 --- a/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp +++ b/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp @@ -85,7 +85,7 @@ namespace { static const char *getRegisterName(unsigned RegNo); bool runOnMachineFunction(MachineFunction &F); - bool doInitialization(Module &M); + void EmitStartOfAsmFile(Module &M); }; } // end of anonymous namespace @@ -408,7 +408,7 @@ printFCCOperand(const MachineInstr *MI, int opNum, const char *Modifier) { O << Mips::MipsFCCToString((Mips::CondCode)MO.getImm()); } -bool MipsAsmPrinter::doInitialization(Module &M) { +void MipsAsmPrinter::EmitStartOfAsmFile(Module &M) { // FIXME: Use SwitchSection. // Tell the assembler which ABI we are using @@ -421,8 +421,6 @@ bool MipsAsmPrinter::doInitialization(Module &M) { // return to previous section O << "\t.previous" << '\n'; - - return AsmPrinter::doInitialization(M); } void MipsAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) { -- cgit v1.1