diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/driver/cc1as_main.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/driver/cc1as_main.cpp b/tools/driver/cc1as_main.cpp index 0d06371dc1..8521c2a120 100644 --- a/tools/driver/cc1as_main.cpp +++ b/tools/driver/cc1as_main.cpp @@ -296,6 +296,11 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts, std::unique_ptr<MCAsmInfo> MAI(TheTarget->createMCAsmInfo(*MRI, Opts.Triple)); assert(MAI && "Unable to create target asm info!"); + // Ensure MCAsmInfo initialization occurs before any use, otherwise sections + // may be created with a combination of default and explicit settings. + if (Opts.CompressDebugSections) + MAI->setCompressDebugSections(true); + bool IsBinary = Opts.OutputType == AssemblerInvocation::FT_Obj; formatted_raw_ostream *Out = GetOutputStream(Opts, Diags, IsBinary); if (!Out) @@ -305,9 +310,6 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts, // MCObjectFileInfo needs a MCContext reference in order to initialize itself. std::unique_ptr<MCObjectFileInfo> MOFI(new MCObjectFileInfo()); - if (Opts.CompressDebugSections) - MAI->setCompressDebugSections(true); - MCContext Ctx(MAI.get(), MRI.get(), MOFI.get(), &SrcMgr); // FIXME: Assembler behavior can change with -static. MOFI->InitMCObjectFileInfo(Opts.Triple, |