This is an archive of the discontinued LLVM Phabricator instance.

[BOLT] Support building bolt when LLVM_LINK_LLVM_DYLIB is ON
ClosedPublic

Authored by serge-sans-paille on Sep 22 2022, 6:05 AM.

Details

Summary

This does *not* link with libLLVM, but with static archives instead. Not
super-great, but at least the build works, which is probably better than
failing.

Related to #57551

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald Transcript
serge-sans-paille requested review of this revision.Sep 22 2022, 6:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 22 2022, 6:05 AM
Amir added a comment.Sep 22 2022, 9:57 AM

Awesome, thank you for fixing the issue! Let me test the diff locally first.

Amir added a comment.Sep 22 2022, 11:20 AM

Nice. Works for me. Do you think we really need this statement DISABLE_LLVM_LINK_LLVM_DYLIB in all CMakeLists, or just the ones that touch LLVM's Target libraries?
I've tried setting it only for bolt/lib/Target/*/CMakeLists.txt and it appears to build as well.

Amir accepted this revision.Sep 22 2022, 11:55 AM
Amir added a subscriber: rafaelauler.

Nice. Works for me. Do you think we really need this statement DISABLE_LLVM_LINK_LLVM_DYLIB in all CMakeLists, or just the ones that touch LLVM's Target libraries?
I've tried setting it only for bolt/lib/Target/*/CMakeLists.txt and it appears to build as well.

Sorry, it looks like we need to set it everywhere because otherwise some global symbols are present in both libLLVM and llvm-bolt and that causes a runtime crash:

$ bin/llvm-bolt --version
: CommandLine Error: Option 'aarch64-mark-bti-property' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options
Aborted (core dumped)

With that, LGTM. @rafaelauler @maksfb - please take a look if the change makes sense to you.

This revision is now accepted and ready to land.Sep 22 2022, 11:55 AM