aboutsummaryrefslogtreecommitdiff
path: root/lld/CMakeLists.txt
AgeCommit message (Collapse)AuthorFilesLines
2023-07-06[lld] respect LLVM_EXTERNAL_LITKonrad Kleine1-3/+3
Consider a setup without a system-wide installation of lit. Instead you pass the path to lit like this: ``` cmake ... -DLLVM_EXTERNAL_LIT=<PATH_TO_LIT_BINARY> ... ``` Then you will run into this error: ``` ninja: error: unknown target 'check-lld' ``` I have a buildbot builder that fails with this message. Here's the passage that triggers this error: https://github.com/llvm/llvm-zorg/blob/d3bfd5ccbceb542098c350e4d071ceceac6854cb/zorg/buildbot/builders/annotated/standalone-build.sh#L194-L239 By using `LLVM_EXTERNAL_LIT` instead of `LLVM_LIT` we fix this problem. See [here](https://llvm.org/docs/GettingStarted.html#stand-alone-builds) for a description: > Both the LLVM_ROOT and LLVM_EXTERNAL_LIT options are required to do stand-alone builds for all sub-projects. Additional required options for each sub-project can be found in the table below. Differential Revision: https://reviews.llvm.org/D154599
2023-06-19Re-land [LLD] Allow usage of LLD as a libraryAlexandre Ganea1-0/+2
This reverts commit aa495214b39d475bab24b468de7a7c676ce9e366. As discussed in https://github.com/llvm/llvm-project/issues/53475 this patch allows for using LLD-as-a-lib. It also lets clients link only the drivers that they want (see unit tests). This also adds the unit test infra as in the other LLVM projects. Among the test coverage, I've added the original issue from @krzysz00, see: https://github.com/ROCmSoftwarePlatform/D108850-lld-bug-reproduction Important note: this doesn't allow (yet) linking in parallel. This will come a bit later hopefully, in subsequent patches, for COFF at least. Differential revision: https://reviews.llvm.org/D119049
2023-06-14Revert "[LLD] Allow usage of LLD as a library"Leonard Chan1-2/+0
This reverts commit 2700da5fe28d8b17c66e5c960d2188276a6ced39. Reverting since this causes some test failures on our builders: https://ci.chromium.org/ui/p/fuchsia/builders/toolchain.ci/clang-linux-x64/b8778372807208184913/overview
2023-06-13[LLD] Allow usage of LLD as a libraryAlexandre Ganea1-0/+2
As discussed in https://github.com/llvm/llvm-project/issues/53475 this patch allows using LLD-as-a-lib. It also lets clients link only the drivers that they want (see unit tests). This also adds the unit test infra as in the other LLVM projects. Among the test coverage, I've added the original issue from @krzysz00, see: https://github.com/ROCmSoftwarePlatform/D108850-lld-bug-reproduction Important note: this doesn't allow (yet) linking in parallel. This will come a bit later, in subsequent patches, for COFF at last. Differential revision: https://reviews.llvm.org/D119049
2023-05-30[lld-macho] Remove linking bitcode supportKeith Smiley1-4/+0
Apple deprecated bitcode in the deployment process in Xcode 14.0. Last month Apple started requiring Xcode 14.1+ to submit apps to the App Store. Since there isn't a use for bundling bitcode outside of submitting to the App Store we should be safe to delete this handling entirely from LLD. Differential Revision: https://reviews.llvm.org/D150697
2023-05-27Reland "[CMake] Bumps minimum version to 3.20.0.Mark de Wever1-8/+1
This reverts commit d763c6e5e2d0a6b34097aa7dabca31e9aff9b0b6. Adds the patch by @hans from https://github.com/llvm/llvm-project/issues/62719 This patch fixes the Windows build. d763c6e5e2d0a6b34097aa7dabca31e9aff9b0b6 reverted the reviews D144509 [CMake] Bumps minimum version to 3.20.0. This partly undoes D137724. This change has been discussed on discourse https://discourse.llvm.org/t/rfc-upgrading-llvms-minimum-required-cmake-version/66193 Note this does not remove work-arounds for older CMake versions, that will be done in followup patches. D150532 [OpenMP] Compile assembly files as ASM, not C Since CMake 3.20, CMake explicitly passes "-x c" (or equivalent) when compiling a file which has been set as having the language C. This behaviour change only takes place if "cmake_minimum_required" is set to 3.20 or newer, or if the policy CMP0119 is set to new. Attempting to compile assembly files with "-x c" fails, however this is workarounded in many cases, as OpenMP overrides this with "-x assembler-with-cpp", however this is only added for non-Windows targets. Thus, after increasing cmake_minimum_required to 3.20, this breaks compiling the GNU assembly for Windows targets; the GNU assembly is used for ARM and AArch64 Windows targets when building with Clang. This patch unbreaks that. D150688 [cmake] Set CMP0091 to fix Windows builds after the cmake_minimum_required bump The build uses other mechanism to select the runtime. Fixes #62719 Reviewed By: #libc, Mordante Differential Revision: https://reviews.llvm.org/D151344
2023-05-17Revert "Reland "[CMake] Bumps minimum version to 3.20.0.""Nico Weber1-1/+8
This reverts commit 65429b9af6a2c99d340ab2dcddd41dab201f399c. Broke several projects, see https://reviews.llvm.org/D144509#4347562 onwards. Also reverts follow-up commit "[OpenMP] Compile assembly files as ASM, not C" This reverts commit 4072c8aee4c89c4457f4f30d01dc9bb4dfa52559. Also reverts fix attempt "[cmake] Set CMP0091 to fix Windows builds after the cmake_minimum_required bump" This reverts commit 7d47dac5f828efd1d378ba44a97559114f00fb64.
2023-05-13Reland "[CMake] Bumps minimum version to 3.20.0."Mark de Wever1-8/+1
The owner of the last two failing buildbots updated CMake. This reverts commit e8e8707b4aa6e4cc04c0cffb2de01d2de71165fc.
2023-05-06Revert "Reland "[CMake] Bumps minimum version to 3.20.0.""Mark de Wever1-1/+8
Unfortunatly not all buildbots are updated. This reverts commit ffb807ab5375b3f78df198dc5d4302b3b552242f.
2023-05-06Reland "[CMake] Bumps minimum version to 3.20.0."Mark de Wever1-8/+1
All build bots should be updated now. This reverts commit 44d38022ab29a3156349602733b3459df5beef93.
2023-04-15Revert "Revert "Revert "[CMake] Bumps minimum version to 3.20.0."""Mark de Wever1-1/+8
This reverts commit 1ef4c3c859728008cf707cad8d67f45ae5070ae1. Two buildbots still haven't been updated.
2023-04-15Revert "Revert "[CMake] Bumps minimum version to 3.20.0.""Mark de Wever1-8/+1
This reverts commit 92523a35a827539db8557bbc3ecab7f9ea3f6ade. Reland to see whether CIs are updated.
2023-03-18Revert "Reland "[CMake] Bumps minimum version to 3.20.0.""Mark de Wever1-1/+8
This reverts commit a72165e5df59032cdd54dcb18155f2630d73abd1. Some buildbots have not been updated yet.
2023-03-18Reland "[CMake] Bumps minimum version to 3.20.0."Mark de Wever1-8/+1
This reverts commit 92523a35a827539db8557bbc3ecab7f9ea3f6ade. Test whether all CI runners are updated.
2023-03-13[lld] Use installed llvm_gtest in standalone buildsMichał Górny1-5/+3
Use the installed llvm_gtest library instead of rebuilding it locally when standalone builds are used. This change is now required as otherwise the build fails due to duplicate llvm_gtest target. This is based on 82169103958583d3320b3a9a1e6542e8d32ef8da in clang. Differential Revision: https://reviews.llvm.org/D145964
2023-03-04Revert "[CMake] Bumps minimum version to 3.20.0."Mark de Wever1-1/+8
Some build bots have not been updated to the new minimal CMake version. Reverting for now and ping the buildbot owners. This reverts commit 44c6b905f8527635e49bb3ea97dea315f92d38ec.
2023-03-04[CMake] Bumps minimum version to 3.20.0.Mark de Wever1-8/+1
This partly undoes D137724. This change has been discussed on discourse https://discourse.llvm.org/t/rfc-upgrading-llvms-minimum-required-cmake-version/66193 Note this does not remove work-arounds for older CMake versions, that will be done in followup patches. Reviewed By: mehdi_amini, MaskRay, ChuanqiXu, to268, thieta, tschuett, phosek, #libunwind, #libc_vendors, #libc, #libc_abi, sivachandra, philnik, zibi Differential Revision: https://reviews.llvm.org/D144509
2023-01-10[lld] Fix comment typos to cycle botsNico Weber1-1/+1
2022-12-11[CMake] Warn when the version is older than 3.20.0.Mark de Wever1-0/+7
This is a preparation to require CMake 3.20.0 after LLVM 16 has been released. This change has been discussed on discourse https://discourse.llvm.org/t/rfc-upgrading-llvms-minimum-required-cmake-version/66193 Reviewed By: #libc_vendors, MaskRay, ChuanqiXu, to268, thieta, stellaraccident, ldionne, #libc, #libc_abi, phosek Differential Revision: https://reviews.llvm.org/D137724
2022-11-09Move googletest to the third-party directoryTom Stellard1-2/+2
Rre-commit of 59052468c3e38cab15582cefbb5133fd4c2ffce5 with a typo fix in compiler-rt/CMakeLists.txt
2022-11-09Revert "Move googletest to the third-party directory"Tom Stellard1-2/+2
This reverts commit 59052468c3e38cab15582cefbb5133fd4c2ffce5. It looks like this patch breaks the build when compiler-rt is passed to LLVM_ENABLE_PROJECTS instead of LLVM_ENABLE_RUNTIMES.
2022-11-09Move googletest to the third-party directoryTom Stellard1-2/+2
This will help improve the project's layering, so that sub-projects that don't actually need any llvm code can still use googletest without having to reference code in the llvm directory. This will also make it easier to consolidate and simplify the standalone build configurations. Reviewed By: stellaraccident, lattner, probinson, phosek Differential Revision: https://reviews.llvm.org/D131919
2022-10-28Harmonize cmake_policy() across standalone builds of all projectsMichał Górny1-4/+6
Move `cmake_policy()` settings from `llvm/CMakeLists.txt` into a shared `cmake/modules/CMakePolicy.cmake`. Include it from all relevant projects that support standalone builds, in order to ensure that the policies are consistently set whether they are built in-tree or stand-alone. Differential Revision: https://reviews.llvm.org/D136572
2022-10-27Revert "Harmonize cmake_policy() across standalone builds of all projects"Michał Górny1-2/+0
This reverts commit 88d7508dc479210f07abccb17f0194b66264b125. It's reported to break builds when symlinking other projects inside the `tools` directory.
2022-10-27Harmonize cmake_policy() across standalone builds of all projectsMichał Górny1-0/+2
Move `cmake_policy()` settings from `llvm/CMakeLists.txt` into a shared `cmake/modules/CMakePolicy.cmake`. Include it from all relevant projects that support standalone builds, in order to ensure that the policies are consistently set whether they are built in-tree or stand-alone. Differential Revision: https://reviews.llvm.org/D136572
2022-08-18Revert "[cmake] Use `CMAKE_INSTALL_LIBDIR` too"John Ericson1-1/+1
This reverts commit f7a33090a91015836497c75f173775392ab0304d. Unfortunately this causes a number of failures that didn't show up in my local build.
2022-08-18[cmake] Use `CMAKE_INSTALL_LIBDIR` tooJohn Ericson1-1/+1
We held off on this before as `LLVM_LIBDIR_SUFFIX` conflicted with it. Now we return this. `LLVM_LIBDIR_SUFFIX` is kept as a deprecated way to set `CMAKE_INSTALL_LIBDIR`. The other `*_LIBDIR_SUFFIX` are just removed entirely. I imagine this is too potentially-breaking to make LLVM 15. That's fine. I have a more minimal version of this in the disto (NixOS) patches for LLVM 15 (like previous versions). This more expansive version I will test harder after the release is cut. Reviewed By: sebastian-ne, ldionne, #libc, #libc_abi Differential Revision: https://reviews.llvm.org/D130586
2022-08-06lld/cmake: Drop use of llvm-config for LLVM install discoveryTom Stellard1-61/+4
This has been deprecated since D116492 earlier in 2022. That seems recent, but with the recent cut of LLVM 15 that is still two releases (14 and 15). Meanwhile Clang has deprecated `llvm-config` for a lot longer, and since it is likely that LLD users are also Clang users, this serves as an extra "heads up" that `llvm-config` is on its way out. Remove it in favor of using CMake's find_package() function. Reviewed By: MaskRay, mgorny Differential Revision: https://reviews.llvm.org/D131144
2022-08-06[LLVM] Update C++ standard to 17Tobias Hieta1-1/+1
Also make the soft toolchain requirements hard. This allows us to use C++17 features in LLVM now. If we find patterns with C++17 that improve readability it should be recommended in the coding standards. Reviewed By: jhenderson, cor3ntin, MaskRay Differential Revision: https://reviews.llvm.org/D130689
2022-07-28[clang][lld][cmake] Simplify header dirsJohn Ericson1-3/+5
We don't need to recompute the list LLVMConfig.cmake provides us. When LLVM is being built, the list is two elements long: generated headers and headers from source. When LLVM is already built,the list is one element long: the installed header directory containing both generated and hand-written sources. Reviewed By: sebastian-ne Differential Revision: https://reviews.llvm.org/D130553
2022-07-21[cmake] Don't export `LLVM_TOOLS_INSTALL_DIR` anymoreJohn Ericson1-0/+4
First of all, `LLVM_TOOLS_INSTALL_DIR` put there breaks our NixOS builds, because `LLVM_TOOLS_INSTALL_DIR` defined the same as `CMAKE_INSTALL_BINDIR` becomes an *absolute* path, and then when downstream projects try to install there too this breaks because our builds always install to fresh directories for isolation's sake. Second of all, note that `LLVM_TOOLS_INSTALL_DIR` stands out against the other specially crafted `LLVM_CONFIG_*` variables substituted in `llvm/cmake/modules/LLVMConfig.cmake.in`. @beanz added it in d0e1c2a550ef348aae036d0fe78cab6f038c420c to fix a dangling reference in `AddLLVM`, but I am suspicious of how this variable doesn't follow the pattern. Those other ones are carefully made to be build-time vs install-time variables depending on which `LLVMConfig.cmake` is being generated, are carefully made relative as appropriate, etc. etc. For my NixOS use-case they are also fine because they are never used as downstream install variables, only for reading not writing. To avoid the problems I face, and restore symmetry, I deleted the exported and arranged to have many `${project}_TOOLS_INSTALL_DIR`s. `AddLLVM` now instead expects each project to define its own, and they do so based on `CMAKE_INSTALL_BINDIR`. `LLVMConfig` still exports `LLVM_TOOLS_BINARY_DIR` which is the location for the tools defined in the usual way, matching the other remaining exported variables. For the `AddLLVM` changes, I tried to copy the existing pattern of internal vs non-internal or for LLVM vs for downstream function/macro names, but it would good to confirm I did that correctly. Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D117977
2022-06-24[NFC][lld] Fix typos to test commit accessDaniel Bertalan1-1/+1
2022-06-10Revert "[cmake] Don't export `LLVM_TOOLS_INSTALL_DIR` anymore"John Ericson1-4/+0
This reverts commit d5daa5c5b091cafb9b7ffd19b5dfa2daadef3229.
2022-06-10[cmake] Don't export `LLVM_TOOLS_INSTALL_DIR` anymoreJohn Ericson1-0/+4
First of all, `LLVM_TOOLS_INSTALL_DIR` put there breaks our NixOS builds, because `LLVM_TOOLS_INSTALL_DIR` defined the same as `CMAKE_INSTALL_BINDIR` becomes an *absolute* path, and then when downstream projects try to install there too this breaks because our builds always install to fresh directories for isolation's sake. Second of all, note that `LLVM_TOOLS_INSTALL_DIR` stands out against the other specially crafted `LLVM_CONFIG_*` variables substituted in `llvm/cmake/modules/LLVMConfig.cmake.in`. @beanz added it in d0e1c2a550ef348aae036d0fe78cab6f038c420c to fix a dangling reference in `AddLLVM`, but I am suspicious of how this variable doesn't follow the pattern. Those other ones are carefully made to be build-time vs install-time variables depending on which `LLVMConfig.cmake` is being generated, are carefully made relative as appropriate, etc. etc. For my NixOS use-case they are also fine because they are never used as downstream install variables, only for reading not writing. To avoid the problems I face, and restore symmetry, I deleted the exported and arranged to have many `${project}_TOOLS_INSTALL_DIR`s. `AddLLVM` now instead expects each project to define its own, and they do so based on `CMAKE_INSTALL_BINDIR`. `LLVMConfig` still exports `LLVM_TOOLS_BINARY_DIR` which is the location for the tools defined in the usual way, matching the other remaining exported variables. For the `AddLLVM` changes, I tried to copy the existing pattern of internal vs non-internal or for LLVM vs for downstream function/macro names, but it would good to confirm I did that correctly. Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D117977
2022-02-22[lld] Require C++14 in LLD standalone buildJez Ng1-0/+4
This is what the Clang standalone build does too. And setting this seems to be required to get the standalone build to work on my Mac. Reviewed By: #lld-macho, MaskRay, Ericson2314, smeenai Differential Revision: https://reviews.llvm.org/D120269
2022-02-03[lld][clang][cmake] Clean up a few thingsJohn Ericson1-6/+12
- If not using `llvm-config`, `LLVM_MAIN_SRC_DIR` now has a sane default - `LLVM_CONFIG_PATH` will continue to work for LLD for back compat. - More quoting of paths in an abundance of caution. Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D118792
2022-01-20[cmake] Make include(GNUInstallDirs) always below project(..)John Ericson1-4/+6
Its defaulting logic must go after `project(..)` to work correctly, but `project(..)` is often in a standalone condition making this awkward, since the rest of the condition code may also need GNUInstallDirs. The good thing is there are the various standalone booleans, which I had missed before. This makes splitting the conditional blocks less awkward. Reviewed By: arichardson, phosek, beanz, ldionne, #libunwind, #libc, #libc_abi Differential Revision: https://reviews.llvm.org/D117639
2022-01-07[lld] Deprecate using llvm-config to detect llvm installationJohn Ericson1-40/+66
This is continuing in the path of D51714, which did this for Clang. I have rearranged the source code Clang so one can diff the top-level CMakeLists.txt of Clang and LLD, ensuring we use the same strategy for both. Besides diffing the two files, `git diff --color-moved` on LLD also helps review. Reviewed By: beanz Differential Revision: https://reviews.llvm.org/D116492
2022-01-01Set the path to the shared cmake modules based on the llvm directoryJohn Ericson1-1/+5
It’s still possible to build parts of the main llvm build (lld, clang etc) by symlinking them into llvm/tools. Reviewed By: Ericson2314 Differential Revision: https://reviews.llvm.org/D116472
2021-12-31[lld][CMake] Use `GNUInstallDirs` to support custom installation dirsJohn Ericson1-4/+10
Extracted from D99484. My new plan is to start from the outside and work inward. Reviewed By: stephenneuendorffer Differential Revision: https://reviews.llvm.org/D115568
2021-12-02[lld-macho] Remove old macho darwin lldKeith Smiley1-2/+0
During the llvm round table it was generally agreed that the newer macho lld implementation is feature complete enough to replace the old implementation entirely. This will reduce confusion for new users who aren't aware of the history. Differential Revision: https://reviews.llvm.org/D114842
2021-09-16[LLVM][CMake][NFC] Resolve FIXME: Rename LLVM_CMAKE_PATH to LLVM_CMAKE_DIR ↵Alfonso Gregory1-5/+5
throughout the project This way, we do not need to set LLVM_CMAKE_PATH to LLVM_CMAKE_DIR when (NOT LLVM_CONFIG_FOUND) Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D107717
2021-05-19Fix lld macho standalone build by including llvm/Config/llvm-config.h ↵Mariusz Ceier1-0/+4
instead of llvm/Config/config.h lld/MachO/Driver.cpp and lld/MachO/SyntheticSections.cpp include llvm/Config/config.h which doesn't exist when building standalone lld. This patch replaces llvm/Config/config.h include with llvm/Config/llvm-config.h just like it is in lld/ELF/Driver.cpp and HAVE_LIBXAR with LLVM_HAVE_LIXAR and moves LLVM_HAVE_LIBXAR from config.h to llvm-config.h Also it adds LLVM_HAVE_LIBXAR to LLVMConfig.cmake and links liblldMachO2.so with XAR_LIB if LLVM_HAVE_LIBXAR is set. Differential Revision: https://reviews.llvm.org/D102084
2021-05-05[lld] Convert LLVM_CMAKE_PATH to a CMake pathIsuru Fernando1-0/+1
Otherwise I get the following error on windows. ``` CMake Error at D:/bld/lld_1569206597988/work/build/CMakeFiles/CMakeTmp/CMakeLists.txt:2 (set): Syntax error in cmake code at D:/bld/lld_1569206597988/work/build/CMakeFiles/CMakeTmp/CMakeLists.txt:2 when parsing string D:\bld\lld_1569206597988\_h_env\Library\lib\cmake\llvm Invalid character escape '\b'. CMake Error at D:/bld/lld_1569206597988/_build_env/Library/share/cmake-3.15/Modules/CheckSymbolExists.cmake:100 (try_compile): Failed to configure test project build system. Call Stack (most recent call first): D:/bld/lld_1569206597988/_build_env/Library/share/cmake-3.15/Modules/CheckSymbolExists.cmake:57 (__CHECK_SYMBOL_EXISTS_IMPL) D:/bld/lld_1569206597988/_h_env/Library/lib/cmake/llvm/HandleLLVMOptions.cmake:943 (check_symbol_exists) CMakeLists.txt:56 (include) ``` Reviewed By: sbc100 Differential Revision: https://reviews.llvm.org/D68158
2021-03-15[test] Add ability to get error messages from CMake for errc substitutionMarkus Böck1-0/+3
Visual Studios implementation of the C++ Standard Library does not use strerror to produce a message for std::error_code unlike other standard libraries such as libstdc++ or libc++ that might be used. This patch adds a cmake script that through running a C++ program gets the error messages for the POSIX error codes and passes them onto lit through an optional config parameter. If the config parameter is not set, or getting the messages failed, due to say a cross compiling configuration without an emulator, it will fall back to using pythons strerror functions. Differential Revision: https://reviews.llvm.org/D98278
2021-03-15[CMake] Require python 3.6 if enabling LLVM test targetsChristopher Tetreault1-1/+2
The lit test suite uses python 3.6 features. Rather than a strange python syntax error upon running the lit tests, we will require the correct version in CMake. Reviewed By: serge-sans-paille, yln Differential Revision: https://reviews.llvm.org/D95635
2021-01-29Revert "[CMake] Actually require python 3.6 or greater"Christopher Tetreault1-1/+1
There are builders that do not have python 3.6. Revert until this situation can be rectified This reverts commit 0703b0753c40dad30f1683403f6600bd2cb42055.
2021-01-29[CMake] Actually require python 3.6 or greaterChristopher Tetreault1-1/+1
Previously, CMake would find any version of Python3. However, the project claims to require 3.6 or greater, and 3.6 features are being used. Reviewed By: yln Differential Revision: https://reviews.llvm.org/D95635
2020-12-17Remove Python2 fallback and only advertise Python3 in the docserge-sans-paille1-14/+1
Differential Revision: https://www.youtube.com/watch?v=RsL0cipURA0
2020-10-21Remove .svn from exclude list as we moved to gitSylvestre Ledru1-1/+0
Reviewed By: emaste Differential Revision: https://reviews.llvm.org/D89859