| ... | @@ -221,19 +221,13 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts, | ... | @@ -221,19 +221,13 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts, |
| 221 | // Any DebugInfoKind implies GenDwarfForAssembly. | 221 | // Any DebugInfoKind implies GenDwarfForAssembly. |
| 222 | Opts.GenDwarfForAssembly = Args.hasArg(OPT_debug_info_kind_EQ); | 222 | Opts.GenDwarfForAssembly = Args.hasArg(OPT_debug_info_kind_EQ); |
| 223 | | 223 | |
| 224 | if (const Arg *A = Args.getLastArg(OPT_compress_debug_sections, | 224 | if (const Arg *A = Args.getLastArg(OPT_compress_debug_sections_EQ)) { |
| 225 | OPT_compress_debug_sections_EQ)) { | 225 | Opts.CompressDebugSections = |
| 226 | if (A->getOption().getID() == OPT_compress_debug_sections) { | 226 | llvm::StringSwitch<llvm::DebugCompressionType>(A->getValue()) |
| 227 | // TODO: be more clever about the compression type auto-detection | 227 | .Case("none", llvm::DebugCompressionType::None) |
| 228 | Opts.CompressDebugSections = llvm::DebugCompressionType::GNU; | 228 | .Case("zlib", llvm::DebugCompressionType::Z) |
| 229 | } else { | 229 | .Case("zlib-gnu", llvm::DebugCompressionType::GNU) |
| 230 | Opts.CompressDebugSections = | 230 | .Default(llvm::DebugCompressionType::None); |
| 231 | llvm::StringSwitch<llvm::DebugCompressionType>(A->getValue()) | | |
| 232 | .Case("none", llvm::DebugCompressionType::None) | | |
| 233 | .Case("zlib", llvm::DebugCompressionType::Z) | | |
| 234 | .Case("zlib-gnu", llvm::DebugCompressionType::GNU) | | |
| 235 | .Default(llvm::DebugCompressionType::None); | | |
| 236 | } | | |
| 237 | } | 231 | } |
| 238 | | 232 | |
| 239 | Opts.RelaxELFRelocations = Args.hasArg(OPT_mrelax_relocations); | 233 | Opts.RelaxELFRelocations = Args.hasArg(OPT_mrelax_relocations); |
| ... | @@ -434,8 +428,11 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts, | ... | @@ -434,8 +428,11 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts, |
| 434 | std::unique_ptr<MCStreamer> Str; | 428 | std::unique_ptr<MCStreamer> Str; |
| 435 | | 429 | |
| 436 | std::unique_ptr<MCInstrInfo> MCII(TheTarget->createMCInstrInfo()); | 430 | std::unique_ptr<MCInstrInfo> MCII(TheTarget->createMCInstrInfo()); |
| | 431 | assert(MCII && "Unable to create instruction info!"); |
| | 432 | |
| 437 | std::unique_ptr<MCSubtargetInfo> STI( | 433 | std::unique_ptr<MCSubtargetInfo> STI( |
| 438 | TheTarget->createMCSubtargetInfo(Opts.Triple, Opts.CPU, FS)); | 434 | TheTarget->createMCSubtargetInfo(Opts.Triple, Opts.CPU, FS)); |
| | 435 | assert(STI && "Unable to create subtarget info!"); |
| 439 | | 436 | |
| 440 | raw_pwrite_stream *Out = FDOS.get(); | 437 | raw_pwrite_stream *Out = FDOS.get(); |
| 441 | std::unique_ptr<buffer_ostream> BOS; | 438 | std::unique_ptr<buffer_ostream> BOS; |
| ... | @@ -474,6 +471,8 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts, | ... | @@ -474,6 +471,8 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts, |
| 474 | TheTarget->createMCCodeEmitter(*MCII, *MRI, Ctx)); | 471 | TheTarget->createMCCodeEmitter(*MCII, *MRI, Ctx)); |
| 475 | std::unique_ptr<MCAsmBackend> MAB( | 472 | std::unique_ptr<MCAsmBackend> MAB( |
| 476 | TheTarget->createMCAsmBackend(*STI, *MRI, MCOptions)); | 473 | TheTarget->createMCAsmBackend(*STI, *MRI, MCOptions)); |
| | 474 | assert(MAB && "Unable to create asm backend!"); |
| | 475 | |
| 477 | std::unique_ptr<MCObjectWriter> OW = | 476 | std::unique_ptr<MCObjectWriter> OW = |
| 478 | DwoOS ? MAB->createDwoObjectWriter(*Out, *DwoOS) | 477 | DwoOS ? MAB->createDwoObjectWriter(*Out, *DwoOS) |
| 479 | : MAB->createObjectWriter(*Out); | 478 | : MAB->createObjectWriter(*Out); |
| ... | @@ -526,8 +525,8 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts, | ... | @@ -526,8 +525,8 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts, |
| 526 | Failed = Parser->Run(Opts.NoInitialTextSection); | 525 | Failed = Parser->Run(Opts.NoInitialTextSection); |
| 527 | } | 526 | } |
| 528 | | 527 | |
| 529 | // Close Streamer first. | 528 | // Parser has a reference to the output stream (Str), so close Parser first. |
| 530 | // It might have a reference to the output stream. | 529 | Parser.reset(); |
| 531 | Str.reset(); | 530 | Str.reset(); |
| 532 | // Close the output stream early. | 531 | // Close the output stream early. |
| 533 | BOS.reset(); | 532 | BOS.reset(); |