[PATCH] D79140: [ThinLTO] return error instead of crashing on invalid input
Sergei Trofimovich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 29 16:12:59 PDT 2020
trofi created this revision.
trofi added a reviewer: lattner.
Herald added subscribers: llvm-commits, dexonsmith, hiraditya, inglorion.
Herald added a project: LLVM.
In https://bugs.llvm.org/show_bug.cgi?id=45636 firefox was linked
against stale object files that don't match profiled build.
Before the change `ld.lld` was crashing with a backtrace as:
LLVM ERROR: Function Import: link error:
linking module flags 'ProfileSummary':
IDs have conflicting values in 'Mutex_posix.o' and 'nsBrowserApp.o'
PLEASE submit a bug report to https://bugs.llvm.org/ and include the
crash backtrace.
#0 0x000055b58915b86a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
llvm/lib/Support/Unix/Signals.inc:564:22
...
#11 0x000055b589111f89 llvm::report_fatal_error(llvm::Twine const&, bool)
llvm/lib/Support/ErrorHandling.cpp:113:27
#12 0x000055b5891120e1 llvm/lib/Support/ErrorHandling.cpp:87:21
#13 0x000055b58a22611f llvm::FunctionImporter::importFunctions(...)
llvm/lib/Transforms/IPO/FunctionImport.cpp:1250:25
After the change `ld.lld` collects all errors during ThinLTO and reports
them as usual:
ld.lld: error: Function Import: link error:
linking module flags 'ProfileSummary':
IDs have conflicting values in 'Mutex_posix.o' and 'nsBrowserApp.o'
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D79140
Files:
llvm/lib/Transforms/IPO/FunctionImport.cpp
Index: llvm/lib/Transforms/IPO/FunctionImport.cpp
===================================================================
--- llvm/lib/Transforms/IPO/FunctionImport.cpp
+++ llvm/lib/Transforms/IPO/FunctionImport.cpp
@@ -39,6 +39,7 @@
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
+#include "llvm/Support/Errc.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FileSystem.h"
@@ -1247,8 +1248,9 @@
std::move(SrcModule), GlobalsToImport.getArrayRef(),
[](GlobalValue &, IRMover::ValueAdder) {},
/*IsPerformingImport=*/true))
- report_fatal_error("Function Import: link error: " +
- toString(std::move(Err)));
+ return createStringError(errc::invalid_argument,
+ "Function Import: link error: %s",
+ toString(std::move(Err)).c_str());
ImportedCount += GlobalsToImport.size();
NumImportedModules++;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79140.261078.patch
Type: text/x-patch
Size: 1046 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200429/9773fd03/attachment.bin>
More information about the llvm-commits
mailing list