mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 22:06:38 +00:00

Bolt currently links and initializes all LLVM targets. This substantially increases the binary size, and link time if LTO is used. Instead, only link the targets specified by BOLT_TARGETS_TO_BUILD. We also have to only initialize those targets, so generate a TargetConfig.def file with the necessary information. The way the initialization is done mirrors what llvm-exegesis does. This reduces llvm-bolt size from 137MB to 78MB for me.
20 lines
325 B
CMake
20 lines
325 B
CMake
set(LLVM_LINK_COMPONENTS
|
|
${BOLT_TARGETS_TO_BUILD}
|
|
MC
|
|
Object
|
|
Support
|
|
)
|
|
|
|
add_bolt_tool(llvm-bolt-binary-analysis
|
|
binary-analysis.cpp
|
|
DISABLE_LLVM_LINK_LLVM_DYLIB
|
|
)
|
|
|
|
target_link_libraries(llvm-bolt-binary-analysis
|
|
PRIVATE
|
|
LLVMBOLTRewrite
|
|
LLVMBOLTUtils
|
|
)
|
|
|
|
add_dependencies(bolt llvm-bolt-binary-analysis)
|