summaryrefslogtreecommitdiff
path: root/clang/cmake
Commit message (Collapse)AuthorAgeFilesLines
* [Fuchsia] Correctly pass lists from STAGE2_ varsAlex Brachet2023-05-171-1/+2
| | | | Differential Revision: https://reviews.llvm.org/D150799
* [Clang][CMake] Use perf-training for Clang-BOLTAmir Ayupov2023-05-131-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Leverage perf-training flow for BOLT profile collection, enabling reproducible BOLT optimization. Remove the use of bootstrapped build for profile collection. Test Plan: - Regular (single-stage) build ``` $ cmake ... -C .../clang/cmake/caches/BOLT.cmake $ ninja clang-bolt ... [21/24] Instrumenting clang binary with BOLT [21/24] Generating BOLT profile for Clang [23/24] Merging BOLT fdata Profile from 2 files merged. [24/24] Optimizing Clang with BOLT ... 1291202496 : executed instructions (-1.1%) 27005133 : taken branches (-71.5%) ... ``` - Two stage build (ThinLTO+InstPGO) ``` $ cmake ... -C .../clang/cmake/caches/BOLT.cmake -C .../clang/cmake/caches/BOLT-PGO.cmake $ ninja clang-bolt $ ninja stage2-clang-bolt ... [2756/2759] Instrumenting clang binary with BOLT [2756/2759] Generating BOLT profile for Clang [2758/2759] Merging BOLT fdata [2759/2759] Optimizing Clang with BOLT ... BOLT-INFO: 7092 out of 184104 functions in the binary (3.9%) have non-empty execution profile 756531927 : executed instructions (-0.5%) 15399400 : taken branches (-40.3%) ... ``` Reviewed By: beanz Differential Revision: https://reviews.llvm.org/D143553
* [CMake] Switch back to -fPIC for Fuchsia ToolchainDaniel Thornburgh2023-04-191-5/+0
| | | | | | | | | | | | This reverts commit 1fab236e6e4575d5af4f4722216df4dd6a872795. Shipping LLDB means distributing libLLDB.so, which will need to be built with PIC. Disabling PIC also removes the libLTO target, which is a hard dependency of the LLDB test suite. Reviewed By: abrachet Differential Revision: https://reviews.llvm.org/D148577
* [CMake] Switch to -fPIE for Fuchsia ToolchainAlex Brachet2023-03-301-0/+5
| | | | | | | This is a reland of D135471, save for dropping libLTO which was already done in a separate change. Differential Revision: https://reviews.llvm.org/D147250
* [Fuchsia][CMake] Always use multiple distribution model.Daniel Thornburgh2023-03-282-29/+6
|
* [Fuchsia] Add FUCHSIA_USE_MULTIPLE_DISTRIBUTIONS.Daniel Thornburgh2023-03-242-11/+52
| | | | | | | | | | | | | | This flag causes the toolchain distribution to be built using LLVM CMake's multiple distribution feature. The distribution* family of CMake targets would be replaced with the toolchain-distribution* family. This shouldn't otherwise affect the semantics of the build, but it sets up the ability to split out the LLDB build from the main distribution used by Fuchsia. Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D146665
* [CMake] Build runtimes for riscv64-unknown-fuchsiaPetr Hosek2023-03-221-7/+7
| | | | | | This is necessary to have a complete RISC-V toolchain for Fuchsia. Differential Revision: https://reviews.llvm.org/D146608
* [Fuchsia] Add LLDB to CLANG_BOOTSTRAP_TARGETS.Daniel Thornburgh2023-03-101-2/+4
| | | | | | | | | | stage2-check-lldb should be run in a 2-stage build to test the final LLDB artifact, so it and related targets must be exported to the stage 1 project. Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D145818
* [Fuchsia] Add LLDB options to stage 1 cmake.Daniel Thornburgh2023-03-072-1/+14
| | | | | | | | | | | | | | | LLVM_ENABLE_PROJECTS is automatically forwarded from stage 1 builds to stage 2 builds, so setting FUCHSIA_ENABLE_LLDB has no effect on two-stage builds. Instead, add FUCHSIA_ENABLE_LLDB to the stage one build as well. This also disables curses and libedit by default for now in both stage1 and stage 2 builds; these should be opt-in. Reviewed By: haowei Differential Revision: https://reviews.llvm.org/D145449
* [Fuchsia] Add other necessary components to LLDB install.Daniel Thornburgh2023-03-031-2/+2
| | | | | | Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D145187
* [Fuchsia] Enable LLVM_USE_RELATIVE_PATHS_IN_FILES in bootstrapHaowei Wu2023-02-281-0/+1
| | | | | | | This patch enables LLVM_USE_RELATIVE_PATHS_IN_FILES when building the bootstrap toolchain for 2 stages build. Differential Revision: https://reviews.llvm.org/D145010
* [Fuchsia] Use cleaner method of adding driver binaryAlex Brachet2023-02-201-4/+2
|
* [Fuchsia] Fix driver build on WindowsAlex Brachet2023-02-201-1/+4
| | | | Don't include llvm-driver when building for Windows
* Reland "[Fuchsia] Enable llvm-driver build".Alex Brachet2023-02-201-0/+3
| | | | | | | | The MacOS problem has been fixed. Additionally, don't enable the driver build on Windows. We can look into enabling it later if symlinks work better than I think on Windows. Differential Revision: https://reviews.llvm.org/D144287
* Revert "[Fuchsia] Enable llvm-driver build"Alex Brachet2023-02-171-2/+0
| | | | | | This reverts commit 4eadd19cc423b860f7ce0217000276da769b7809. Doesn't work on macos. I'll investigate more
* [Fuchsia] Enable llvm-driver buildAlex Brachet2023-02-171-0/+2
| | | | Differential Revision: https://reviews.llvm.org/D144287
* [Fuchsia] Set /winsysroot in Windows runtimes linker flagsHaowei Wu2023-02-141-8/+7
| | | | | | | This patch sets '/winsysroot' flag when building Windows runtimes so we don't have to explicitly set Windows library search paths. Differential Revision: https://reviews.llvm.org/D143960
* [Fuchsia] Add FUCHSIA_ENABLE_LLDB option.Daniel Thornburgh2023-02-131-4/+12
| | | | | | | | | | This CMake option builds/installs LLDB as part of the Fuchsia toolchain. Once this is better supported, the effects of this will be inlined into the toolchain cache file. Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D143794
* [Clang][CMake] Set up distribution target for Clang-BOLTAmir Ayupov2023-02-072-1/+14
| | | | | | | | | | | | Provide a way to install usable BOLT-optimized Clang (clang + resource headers) using `ninja clang-bolt install-distribution` with BOLT.cmake cache file or `ninja stage2-clang-bolt stage2-install-distribution` with BOLT-PGO.cmake cache file. Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D140565
* Revert "[Fuchsia] Simplify Fuchsia stage2 toolchain setup"Haowei Wu2023-02-061-2/+0
| | | | | This reverts commit f9ff49882a65ab26ab347f4df8f2a58368d37185. Accidentally landed a draft patch.
* [Fuchsia] Build windows runtimes using cross compilation on LinuxHaowei Wu2023-02-062-1/+40
| | | | | | | This patch provides initial support of building Clang runtimes for Windows when using Fuchsia Clang toolchains under Linux. Differential Revision: https://reviews.llvm.org/D141738
* [Fuchsia] Simplify Fuchsia stage2 toolchain setupHaowei Wu2023-02-061-0/+2
| | | | WIP
* [Fuchsia] Simplified the stage2 build setupHaowei Wu2023-02-061-6/+28
| | | | | | | This patch simplified the BOOTSTRAP_ flags, allowing them to be pass through from regular flags. Differential Revision: https://reviews.llvm.org/D143288
* [Fuchsia] Re-enable HWASan for globals in runtimesPetr Hosek2023-01-311-2/+0
| | | | | | This is now supported. Differential Revision: https://reviews.llvm.org/D142917
* [CMake] Replace clang binary if using clang-bolt targetAmir Ayupov2023-01-281-2/+0
| | | | | | | | | | | | Instead of creating an extra clang-bolt binary and clang++-bolt symlink, replace the original clang binary with BOLT-optimized one. This fixes the issue with installing optimized binary as `install-clang` target now copies the new version. Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D139454
* [CMake] Include clang-bolt bootstrap target in BOLT-PGO.cmakeAmir Ayupov2023-01-271-0/+2
| | | | | | Preemptively include clang-bolt target in BOLT-PGO CMake cache file, in preparation of https://reviews.llvm.org/D139454 to avoid breaking bolt-x86_64-ubuntu-clang-bolt-lto-pgo buildbot.
* [CMake] Remove libLTO from Fuchsia toolchainAlex Brachet2023-01-261-1/+0
| | | | Differential Revision: https://reviews.llvm.org/D142649
* Revert "[Fuchsia] Build windows runtimes using cross compilation on Linux"Haowei Wu2023-01-231-38/+1
| | | | | This reverts commit 20bb7658f53b0b8db165ff4d404ede3f9b34862d. It breaks Fuchsia stage2 builders.
* [Fuchsia] Build windows runtimes using cross compilation on LinuxHaowei Wu2023-01-231-1/+38
| | | | | | | This patch provides initial support of building Clang runtimes for Windows when using Fuchsia Clang toolchains under Linux. Differential Revision: https://reviews.llvm.org/D141738
* [cmake] Fix path to LLVMConfig.cmake for multi-config buildsNhat Nguyen2023-01-131-1/+2
| | | | | | | | | | | | D139623 replaces CMAKE_CFG_INTDIR with '.' for multi-config builds. However, this change has not been reflected in mlir, flang, polly, lld, and clang. The patch updates the path to LLVMConfig.cmake for those projects. Reviewed By: sebastian-ne Differential Revision: https://reviews.llvm.org/D141538
* Revert "build: with -DCLANGD_ENABLE_REMOTE=ON, search for grpc++ ↵Kadir Cetinkaya2023-01-121-6/+1
| | | | | | | | dependencies too" This reverts commit 9f3081dc6fe8447e85741865846840bc491866e5. Broke clangd buildbots in https://lab.llvm.org/buildbot/#/builders/131/builds/38935.
* [CMake][Fuchsia] Include llvm-ml in Fuchsia toolchainHaowei Wu2023-01-111-0/+1
| | | | | | This change includes llvm-ml tool in Fuchsia toolchain. Differential Revision: https://reviews.llvm.org/D141448
* build: with -DCLANGD_ENABLE_REMOTE=ON, search for grpc++ dependencies tooSylvestre Ledru2023-01-101-1/+6
| | | | | | Fixes: https://github.com/llvm/llvm-project/issues/59844 Differential Revision: https://reviews.llvm.org/D141047
* Add version to all LLVM cmake packageThomas Preud'homme2022-11-253-1/+24
| | | | | | | | | | Add a version to non-LLVM cmake package so that users needing an exact version match can use the version parameter to find_package. Also adjust the find_package(LLVM) to use an exact version match as well. Reviewed By: arsenm, stellaraccident, mceier Differential Revision: https://reviews.llvm.org/D138274
* Revert: Add version to all LLVM cmake packageThomas Preud'homme2022-11-253-24/+1
| | | | | | | | Summary: This reverts commit ad485b71b51168ce13282ae159bd8feff48baf84. Reviewers: Subscribers:
* Add version to all LLVM cmake packageThomas Preud'homme2022-11-203-1/+24
| | | | | | | | | | Add a version to non-LLVM cmake package so that users needing an exact version match can use the version parameter to find_package. Also adjust the find_package(LLVM) to use an exact version match as well. Reviewed By: arsenm, stellaraccident Differential Revision: https://reviews.llvm.org/D138274
* Revert "[CMake] Drop libLTO and switch to PIE for Fuchsia toolchain"Alex Brachet2022-11-171-5/+1
| | | | | | | | | This reverts commit a6f621b8cacca926d809010c135be038fd05652c. We suspect that this patch might be the culprit that is causing every llvm executable to be sigkill'd immediately on Apple Silicon machines. Notably, the only other cache file with CMAKE_POSITION_INDEPENDENT_CODE is Apple's and they have it off.
* [clang] Replace BACKEND_PACKAGE_STRING with LLVM_VERSION_STRINGFangrui Song2022-10-251-1/+1
| | | | | | | | | | | | | | | | | 420d7ccbac0f499a6ff9595bdbfa99cd3376df22 introduced BACKEND_PACKAGE_STRING to replace `PACKAGE_VERSION` (llvm/Config/config.h) to support standalone builds. This is used in the output of `clang -cc1 -v`. Since llvm-config.h is available for both standalone and non-standalone builds, we can just use `LLVM_VERSION_STRING` from llvm-config.h. clang/cmake/modules/AddClang.cmake uses `VERSION_STRING "${CLANG_VERSION} (${BACKEND_PACKAGE_STRING})"`. Just simplify it to `"${CLANG_VERSION}"` so that we can remove the CMake variable BACKEND_PACKAGE_STRING. Reviewed By: tstellar Differential Revision: https://reviews.llvm.org/D136660
* [CMake] Drop libLTO and switch to PIE for Fuchsia toolchainPetr Hosek2022-10-231-1/+5
| | | | | | All our users have migrated to ld64.lld so we no longer need libLTO. Differential Revision: https://reviews.llvm.org/D135471
* Revert "[CMake] Drop libLTO and switch to PIE for Fuchsia toolchain"Petr Hosek2022-10-211-1/+1
| | | | | This reverts commit 8d89dbceeb576171efd12a5657c038a2ec2e54a5 since this broke the compiler-rt build.
* [CMake] Drop libLTO and switch to PIE for Fuchsia toolchainPetr Hosek2022-10-211-1/+1
| | | | | | All our users have migrated to ld64.lld so we no longer need libLTO. Differential Revision: https://reviews.llvm.org/D135471
* [CMake] Disable BOLT instrumentation of Clang on instrumented buildAmir Ayupov2022-10-191-0/+11
| | | | | | | | | | | | | | | | | | | | | | This enables multi-stage PGO build optimized by BOLT using BOLT.cmake cache. The issue is that `-DPGO_BUILD_CONFIGURATION` cache file is passed to both stage2-instrumented and stage2-optimized builds (for them to be identical), but in case of BOLT.cmake, it doesn't make sense to BOLT-instrument the instrumented binary (it's not going to be optimized). Hence turn off `CLANG_BOLT_INSTRUMENT` code if `LLVM_BUILD_INSTRUMENTED` is enabled. The final workflow that enables multi-stage InstrPGO+ThinLTO+BOLT Clang build: ``` cmake <llvm-project>/llvm -GNinja -DLLVM_ENABLE_LLD=ON \ -DBOOTSTRAP_LLVM_ENABLE_LLD=ON -DBOOTSTRAP_BOOTSTRAP_LLVM_ENABLE_LLD=ON \ -DPGO_INSTRUMENT_LTO=Thin -C llvm-project/clang/cmake/caches/BOLT-PGO.cmake ninja stage2-clang++-bolt ``` Reviewed By: rafauler Differential Revision: https://reviews.llvm.org/D136023
* [cmake] Remove LLVM_INCLUDE_GO_TESTS variableNikita Popov2022-10-142-2/+0
| | | | | | As pointed out by thakis in https://reviews.llvm.org/D135436#3858463, this variable can be dropped now that the Go bindings have been removed.
* [CMake] Fix FindGRPC cmake module to allow different layeringSteven Wu2022-10-121-0/+11
| | | | | | | | | | | | Take the library target out of `generate_protos` function so the caller can decide where to layer the library using the source generated from the function. Fixes: https://github.com/llvm/llvm-project/issues/58075 Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D135712
* [CMake] Update cache file for Win to ARM Linux cross toolchain builders. NFC.Vladimir Vereschaka2022-10-061-1/+1
| | | | | | Do not specify the execution directory in the remote execution script command line for the compiler-rt builtin library tests. There is a single execution file tests within the single directory. No need to pack all of them every time, just run one by one.
* [llvm-driver] Support single distributionsAlex Brachet2022-10-011-2/+8
| | | | | | | | | | `LLVM_DISTRIBUTION_COMPONENTS` now influences the llvm binary in the normal cmake output directory when it is set. This allows for distribution targets to only include tools they want in the llvm binary. It must be done this way because only one target can be associated with a specific output name. Differential Revision: https://reviews.llvm.org/D131310
* [llvm-driver][NFC] Simplify handling of tool symlinksAlex Brachet2022-10-011-1/+1
| | | | Differential Revision: https://reviews.llvm.org/D134979
* [runtimes] Remove all traces of the legacy testing configuration systemLouis Dionne2022-09-301-13/+1
| | | | | | | | | | | | | Now that all jobs have moved over to the new style of Lit configuration, we can remove all traces of the legacy testing configuration system. This includes: - Cache settings that are not honored or useful anymore - Several CMake options that were only useful in the context of the legacy Lit configuration system - A bunch of Python support code that is not used anymore - The legacy lit.cfg.in files themselves Differential Revision: https://reviews.llvm.org/D134650
* [CMake] Add `CLANG_ENABLE_HLSL` CMake optionChris Bieneman2022-09-271-0/+2
| | | | | | | | | | | | | | The HLSL support in clang is in progress and not fully functioning. As such we don't want to install the related optional build components by default (yet), but we do need an option to build and install them locally for testing and for some key users. This adds the `CLANG_ENABLE_HLSL` option which is off by default and can be enabled to install the HLSL clang headers and the clang-dxc symlink. Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D134693
* [CMake] Add clang-bolt targetAmir Ayupov2022-09-231-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds `CLANG_BOLT_INSTRUMENT` option that applies BOLT instrumentation to Clang, performs a bootstrap build with the resulting Clang, merges resulting fdata files into a single profile file, and uses it to perform BOLT optimization on the original Clang binary. The projects and targets used for bootstrap/profile collection are configurable via `CLANG_BOLT_INSTRUMENT_PROJECTS` and `CLANG_BOLT_INSTRUMENT_TARGETS`. The defaults are "llvm" and "count" respectively, which results in a profile with ~5.3B dynamically executed instructions. The intended use of the functionality is through BOLT CMake cache file, similar to PGO 2-stage build: ``` cmake <llvm-project>/llvm -C <llvm-project>/clang/cmake/caches/BOLT.cmake ninja clang++-bolt # pulls clang-bolt ``` Stats with a recent checkout (clang-16), pre-built BOLT and Clang, 72vCPU/224G | CMake configure with host Clang + BOLT.cmake | 1m6.592s | Instrumenting Clang with BOLT | 2m50.508s | CMake configure `llvm` with instrumented Clang | 5m46.364s (~5x slowdown) | CMake build `not` with instrumented Clang |0m6.456s | Merging fdata files | 0m9.439s | Optimizing Clang with BOLT | 0m39.201s Building Clang: ```cmake ../llvm-project/llvm -DCMAKE_C_COMPILER=... -DCMAKE_CXX_COMPILER=... -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS=clang -DLLVM_TARGETS_TO_BUILD=Native -GNinja``` | | Release | BOLT-optimized | cmake | 0m24.016s | 0m22.333s | ninja clang | 5m55.692s | 4m35.122s I know it's not rigorous, but shows a ballpark figure. Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D132975