The existing BOLT install targets are broken on Windows because they
don't properly handle the output extension. We cannot use the existing
LLVM macros since those make assumptions that don't hold for BOLT. This
change instead implements custom macros following the approach used by
Clang and LLD.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Ping, our toolchain build on Windows is currently broken because of BOLT and I verified that this change resolves the issue so I'd appreciate a review.
I had to redo the patch after investigating the builder failure and better understanding the intention of the original code.
There's still an issue where only bolt is included in LLVM_DISTRIBUTION_COMPONENTS and not individual tools such as llvm-bolt because then the install targets won't be created because of https://github.com/llvm/llvm-project/blob/c7eb1b07470b9babfcd258f014df3661e5f84b30/llvm/cmake/modules/AddLLVM.cmake#L1348. Unfortunately this scenario where the name of the component is different from the tool itself is currently supported in the LLVM build.
@smeenai Do you have any thoughts on this? I don't actually know how to fix this. The intention seems to be allow the use of the bolt target/component as a grouping for other BOLT targets such as llvm-bolt or bolt_rt, so you can only include bolt in LLVM_DISTRIBUTION_COMPONENT. I understand why that may be desirable, but that breaks many of the assumptions that existing macros make and I don't know how to easily fix it.
I have opted for an approach that's similar to the one used by Clang and LLD, although the handling of components is different to preserve the existing behavior. This seems to be working in my local testing.
Makes sense, though @Amir should also take a look.
bolt/CMakeLists.txt | ||
---|---|---|
122 ↗ | (On Diff #526948) | Where is BOLT_DEPENDS being set now? The CMake docs say DEPENDS should only be used for add_custom_command outputs in the same folder, and add_dependencies for everything else, so we want the latter here. I know this is just moving existing code, but we may as well fix that while we're here. I don't think it makes any difference for Ninja, but it might for other generators? |
bolt/tools/heatmap/CMakeLists.txt | ||
8 ↗ | (On Diff #526948) | Why this change? |
Looks good overall. Thanks for adding AddBolt cmake module. Testing the build internally, will reply shortly.
bolt/test/CMakeLists.txt | ||
---|---|---|
40 ↗ | (On Diff #527084) | We have a number of dependencies on llvm-boltdiff and perf2bolt, e.g. in internal and upstream binary tests: https://github.com/rafaelauler/bolt-tests/blob/main/CMakeLists.txt#L22. Can we keep these targets somehow? |
bolt/tools/heatmap/CMakeLists.txt | ||
8 ↗ | (On Diff #526948) | It wasn't included by omission. Let's include it into the umbrella target. |
bolt/test/CMakeLists.txt | ||
---|---|---|
40 ↗ | (On Diff #527084) | These symlinks are now always generated, see the ALWAYS_GENERATED option in add_bolt_tool_symlink so there's no need to specify those as targets here separately. |
I assume this should be add_dependencies?