authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2020-12-16 10:40:56+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2020-12-16 12:18:14+01:00
log83ff94406e13e18c8826cd48a68c2c8d676feaac
tree2d59a8986d026dc8831d6cabb2fbacf703c3ab18
parent9c2d8056ce177fef2a1b859016b11362686213b1

Update clang drivers

llvm commit b2851aea80e5a8f0cfd6c3c5a56a6b00fb28c6b6

2 files changed, 21 insertions(+), 15 deletions(-)

src/zig_clang_cc1as_main.cpp+14-15
...@@ -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);
223223
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-detection227 .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 }
238232
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;
435429
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!");
439436
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 }
528527
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();
src/zig_clang_driver.cpp+7
...@@ -528,6 +528,13 @@ int ZigClang_main(int argc_, const char **argv_) {...@@ -528,6 +528,13 @@ int ZigClang_main(int argc_, const char **argv_) {
528 IsCrash = CommandRes < 0 || CommandRes == 70;528 IsCrash = CommandRes < 0 || CommandRes == 70;
529#ifdef _WIN32529#ifdef _WIN32
530 IsCrash |= CommandRes == 3;530 IsCrash |= CommandRes == 3;
531#endif
532#if LLVM_ON_UNIX
533 // When running in integrated-cc1 mode, the CrashRecoveryContext returns
534 // the same codes as if the program crashed. See section "Exit Status for
535 // Commands":
536 // https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xcu_chap02.html
537 IsCrash |= CommandRes > 128;
531#endif538#endif
532 if (IsCrash) {539 if (IsCrash) {
533 TheDriver.generateCompilationDiagnostics(*C, *FailingCommand);540 TheDriver.generateCompilationDiagnostics(*C, *FailingCommand);