From 316c37407ebff91d29a997bf9fa795cbf71e850d Mon Sep 17 00:00:00 2001 From: Nico Rieck Date: Thu, 4 Jul 2013 21:37:26 +0000 Subject: [PATCH] Initialize object file info before output streamer 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. llvm-svn: 185670 --- llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index f9fe441..52e52b4 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -155,8 +155,6 @@ void AsmPrinter::getAnalysisUsage(AnalysisUsage &AU) const { } bool AsmPrinter::doInitialization(Module &M) { - OutStreamer.InitStreamer(); - MMI = getAnalysisIfAvailable(); MMI->AnalyzeModule(M); @@ -164,6 +162,8 @@ bool AsmPrinter::doInitialization(Module &M) { const_cast(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. -- 2.7.4