Add a new virtual EmitStartOfAsmFile method to the AsmPrinter and use this
authorBob Wilson <bob.wilson@apple.com>
Wed, 30 Sep 2009 22:06:26 +0000 (22:06 +0000)
committerBob Wilson <bob.wilson@apple.com>
Wed, 30 Sep 2009 22:06:26 +0000 (22:06 +0000)
commit812209a58c5520c604bc9279aa069e5ae066e860
treed57f4a8be52b4d6df644ea8d1a2d6e4efd7c9b28
parentc4c39faa054eade47f84496ebea3a6842c03ab64
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
include/llvm/CodeGen/AsmPrinter.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp