]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - opencl/llvm.git/commitdiff
Initialize object file info before output streamer
authorNico Rieck <nico.rieck@gmail.com>
Thu, 4 Jul 2013 21:37:26 +0000 (21:37 +0000)
committerNico Rieck <nico.rieck@gmail.com>
Thu, 4 Jul 2013 21:37:26 +0000 (21:37 +0000)
r179494 switched to using the object file info to retrieve the default text
section for some MC streamers. It is possible that initializing an MC
streamer can request sections before the object file info is initialized
when the AutoInitSections flag is set on the streamer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185670 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/AsmPrinter.cpp

index f9fe44196defb31094c122e4b53dfdf52fa2648e..52e52b4162aedbcdc4638ecb8376142e3aca4820 100644 (file)
@@ -155,8 +155,6 @@ void AsmPrinter::getAnalysisUsage(AnalysisUsage &AU) const {
 }
 
 bool AsmPrinter::doInitialization(Module &M) {
-  OutStreamer.InitStreamer();
-
   MMI = getAnalysisIfAvailable<MachineModuleInfo>();
   MMI->AnalyzeModule(M);
 
@@ -164,6 +162,8 @@ bool AsmPrinter::doInitialization(Module &M) {
   const_cast<TargetLoweringObjectFile&>(getObjFileLowering())
     .Initialize(OutContext, TM);
 
+  OutStreamer.InitStreamer();
+
   Mang = new Mangler(OutContext, &TM);
 
   // Allow the target to emit any magic that it wants at the start of the file.