This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho] Initialize LTO backend with diagnostic handler
ClosedPublic

Authored by int3 on Sep 4 2021, 10:56 AM.

Details

Summary

Failing to do so results in std::bad_function_call being
thrown when a pass tries to emit a diagnostic.

I've copied the relevant test over from LLD-ELF's test suite.

Diff Detail

Event Timeline

int3 created this revision.Sep 4 2021, 10:56 AM
Herald added a project: Restricted Project. · View Herald Transcript
int3 requested review of this revision.Sep 4 2021, 10:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 4 2021, 10:56 AM
thevinster accepted this revision.Sep 4 2021, 12:49 PM
thevinster added a subscriber: thevinster.

Thanks! This seems to check out with the stack trace line that I was seeing.

8 ld64.lld 0x0000000103aeca10 llvm::LLVMContext::diagnose(llvm::DiagnosticInfo const&) + 96

I see from the tests in LLD-ELF that it's separated LTO tests in to its own folder. I'm wondering if we should also do the same for the MachO port? I don't have any strong opinions either ways other than consistency with the ELF port.

This revision is now accepted and ready to land.Sep 4 2021, 12:49 PM
int3 added a comment.Sep 4 2021, 2:16 PM

I intentionally put the tests in a single folder because I didn't really see the value of a subfolder... all our lto tests are prefixed by lto-, so they're easy to glob for anyway. Also, a lot of the ELF tests were written before split-file became available, so they have a lot of extra files under Inputs, and I guess that gets messy after a while without breaking things up into subfolders.

This revision was landed with ongoing or failed builds.Sep 4 2021, 2:40 PM
This revision was automatically updated to reflect the committed changes.