[PATCH] D129423: [LinkerWrapper] Fix errors not exiting inside of the LTO pipeline
Joseph Huber via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Jul 9 08:29:30 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdbd3ade17bc1: [LinkerWrapper] Fix errors not exiting inside of the LTO pipeline (authored by jhuber6).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129423/new/
https://reviews.llvm.org/D129423
Files:
clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
Index: clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
===================================================================
--- clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
+++ clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
@@ -89,6 +89,9 @@
/// Codegen flags for LTO backend.
static codegen::RegisterCodeGenFlags CodeGenFlags;
+/// Global flag to indicate that the LTO pipeline threw an error.
+static std::atomic<bool> LTOError;
+
/// Magic section string that marks the existence of offloading data. The
/// section will contain one or more offloading binaries stored contiguously.
#define OFFLOAD_SECTION_MAGIC_STR ".llvm.offloading"
@@ -694,6 +697,7 @@
switch (DI.getSeverity()) {
case DS_Error:
WithColor::error(errs(), LinkerExecutable) << ErrStorage << "\n";
+ LTOError = true;
break;
case DS_Warning:
WithColor::warning(errs(), LinkerExecutable) << ErrStorage << "\n";
@@ -763,6 +767,8 @@
if (Conf.OptLevel > 0)
Conf.UseDefaultPipeline = true;
Conf.DefaultTriple = Triple.getTriple();
+
+ LTOError = false;
Conf.DiagHandler = diagnosticHandler;
Conf.PTO.LoopVectorization = Conf.OptLevel > 1;
@@ -968,6 +974,10 @@
if (Error Err = LTOBackend->run(AddStream))
return Err;
+ if (LTOError)
+ return createStringError(inconvertibleErrorCode(),
+ "Errors encountered inside the LTO pipeline.");
+
// If we are embedding bitcode we only need the intermediate output.
if (Args.hasArg(OPT_embed_bitcode)) {
if (BitcodeOutput.size() != 1 || !WholeProgram)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129423.443442.patch
Type: text/x-patch
Size: 1589 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220709/55cf6aa5/attachment.bin>
More information about the cfe-commits
mailing list