Page MenuHomePhabricator

[ThinLTO] return error instead of crashing on invalid input
Needs ReviewPublic

Authored by trofi on Apr 29 2020, 4:04 PM.

Details

Summary

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'

Diff Detail

Event Timeline

trofi created this revision.Apr 29 2020, 4:04 PM

Could you add a test case for this?

(@tejohnson - might be the suitable reviewer here)

jdoerfert added a subscriber: jdoerfert.

Having a backtrace and the bug filing message seems excessive. Maybe you can even mention stale obj files in the message.
I'll add some reviewers that might want to chime in, otherwise I'll revisit this.

dmajor added a subscriber: dmajor.May 18 2020, 3:54 PM
lattner resigned from this revision.May 18 2020, 9:06 PM