summaryrefslogtreecommitdiff
path: root/runtimes
AgeCommit message (Collapse)Author
2025-11-19[Runtimes] Default build must use its own output dirs (#168266)Michael Kruse
Post-commit fix of #164794 reported at https://github.com/llvm/llvm-project/pull/164794#issuecomment-3536253493 `LLVM_LIBRARY_OUTPUT_INTDIR` and `LLVM_RUNTIME_OUTPUT_INTDIR` is used by `AddLLVM.cmake` as output directories. Unless we are in a bootstrapping-build, It must not point to directories found by `find_package(LLVM)` which may be read-only directories. MLIR for instance sets thesese variables to its own build output directory, so should the runtimes.
2025-11-18[runtimes] Remove pstl from the list of supported runtimes (#168414)Louis Dionne
The pstl top-level directory was removed, but we forgot to remove pstl from the list of valid subdirectories.
2025-11-12[runtimes][GTest] LLVM-independent unittests (#164794)Michael Kruse
The LLVM-customized GTest has a dependency on LLVM to support `llvm::raw_ostream` and hence has to link to LLVMSupport. The runtimes use the LLVMSupport from the bootstrapping LLVM build. The problem is that the boostrapping compiler and the runtimes target can diverge in their ABI, even in the runtimes default build. For instance, Clang is built using gcc which uses libstdc++, but the runtimes is built by Clang which can be configured to use libcxx by default. Altough it does not use gcc, this issue has caused [flang-aarch64-libcxx](https://lab.llvm.org/buildbot/#/builders/89)) to break, and is still (again?) broken. This patch makes the runtimes' GTest independent from LLVMSupport so we do not link any runtimes component with LLVM components. Runtime projects that use GTest unittests: * flang-rt * libc * compiler-rt: Adds `gtest-all.cpp` with [GTEST_NO_LLVM_SUPPORT=1](https://github.com/llvm/llvm-project/blob/f801b6f67ea896d6e4d2de38bce9a79689ceb254/compiler-rt/CMakeLists.txt#L723) to each unittest without using `llvm_gtest`. Not touched by this PR. * openmp: Handled by #159416. Not touched for now by this PR to avoid conflict. The current state of this PR tries to reuse https://github.com/llvm/llvm-project/blob/main/third-party/unittest/CMakeLists.txt as much as possible, altough personally I would prefer to make it use "modern CMake" style. third-party/unittest/CMakeLists.txt will detect whether it is used in runtimes build and adjaust accordingly. It creates a different target for LLVM (`llvm_gtest`, NFCI) and another one for the runtimes (`runtimes_gtest`). It is not possible to reuse `llvm_gtest` for both since `llvm_gtest` is imported using `find_package(LLVM)` if configured using LLVM_INSTALL_GTEST. An alias `default_gtest` is used to select between the two. `default_gtest` could also be used for openmp which also supports standalone and [LLVM_ENABLE_PROJECTS](https://github.com/llvm/llvm-project/pull/152189) build mode.
2025-11-07[Runtimes][CMake] Add CMake option to enable execute-only code generation on ↵Csanád Hajdú
AArch64 (#143698) Based on the discussion in https://discourse.llvm.org/t/rfc-execute-only-code-support-for-runtime-libraries-on-aarch64/86180 a single, global configuration option should be used to enable execute-only code generation for the runtime libraries. The new option `RUNTIMES_EXECUTE_ONLY_CODE` adds the `-mexecute-only` flag to `CMAKE_C_FLAGS` and `CMAKE_CXX_FLAGS`, which simplifies the library-level configuration needed for the runtime libraries. Project-specific changes are still needed to handle assembly sources, e.g. in compiler-rt and libunwind.
2025-11-03[libc] Fix Linux kernel headers being included on all OS'sJoseph Huber
Summary: The changes in https://github.com/llvm/llvm-project/commit/43bd7e3bb903af5076a9552f4f64cfc5d58f76ce altered how we handled including headers, this included the system on the GPU target which poisoned the include path that was curated to not include any system headers. Change this to only apply is the target OS is Linux.
2025-11-01[Runtimes][libc] Include kernel headers when using RUNTIMES_USE_LIBCAiden Grossman
When setting RUNTIMES_USE_LIBC=libc we pass -nostdlibinc if the compiler supports it. This causes compilation failures when trying to build libc++ as libc will try and reference kernel headers in its own headers that it now cannot find. Explicitly reference the kernel headers so the compiler can find them. Reviewers: vonosmas, petrhosek, #reviewers-libcxx, michaelrj-google Reviewed By: michaelrj-google Pull Request: https://github.com/llvm/llvm-project/pull/165114
2025-09-22[runtimes] Add a missing LLVM_LIBDIR_SUFFIX (#159758)Tulio Magno Quites Machado Filho
Ensure that LLVM_LIBRARY_DIR uses LLVM_LIBDIR_SUFFIX. This fixes issues when the OS prefers to install libraries under lib64, for example. Co-authored-by: Joseph Huber <huberjn@outlook.com>
2025-09-19[LLVM] Simplify GPU runtimes flag handling (#159802)Joseph Huber
Summary: The AMDGPU hack can be removed, and we no longer need to skip 90% of the `HandleLLVMOptions` if we work around NVPTX earlier. Simplifies the interface by removing duplicated logic and keeps the GPU targets from being weirdly divergent on some flags.
2025-08-19[orc-rt] Remove unused LLVM_RT_TOOLS_BINARY_DIR cmake variable. (#154254)Lang Hames
This was accidentally left in ee7a6a45bdb.
2025-08-19[ORC-RT] Initial check-in for a new, top-level ORC runtime project. (#113499)Lang Hames
Includes CMake files and placeholder header, library, test tool, regression test and unit test. The aim for this project is to create a replacement for the existing ORC Runtime that currently resides in `llvm-project/compiler-rt/lib/orc`. The new project will provide a superset of the original features, and the old runtime will be removed once the new runtime is sufficiently developed. See discussion at https://discourse.llvm.org/t/rfc-move-orc-executor-support-into-top-level-project/81049
2025-08-12[runtimes] Append `-nostd*++` flags only for Clang (#151930)Michał Górny
Append `-nostdlib++` and `-nostdinc++` flags to `CMAKE_REQUIRED_FLAGS` only if we are actually building with Clang. These flags are also passed to the C compiler, which is not allowed in GCC. Since CMake implicitly performs some tests using the C compiler, this can lead to incorrect check results. This should be safe, since FWIU we only need them when bootstrapping Clang. Even though we know that Clang supports these flags, we still need to explicitly check if they work, as in some scenarios adding `-nostdlib++` actually breaks the build. See PR #108357 for examples of that. Fixes #90332 Signed-off-by: Michał Górny <mgorny@gentoo.org>
2025-07-31[SYCL] Add libsycl, a SYCL RT library implementation project (#144372)Kseniya Tikhomirova
This patch introduces libsycl, a SYCL runtime library implementation, as a top-level LLVM runtime project. SYCL spec: https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html Commit contains the basic folder layout and CMake infrastructure to build a dummy SYCL library. This is part of the SYCL support upstreaming effort. The relevant RFCs can be found here: https://discourse.llvm.org/t/rfc-add-full-support-for-the-sycl-programming-model/74080 https://discourse.llvm.org/t/rfc-sycl-runtime-upstreaming/74479 Upcoming PRs: - UR offloading library fetch & build - partial implementation of sycl::platform: requires offloading layer, requires classes for backend loading & enumeration. --------- Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com> Co-authored-by: Alexey Bader <alexey.bader@intel.com>
2025-07-26[OpenMP] Fix runtimes default build (#149871)Michael Kruse
The default build of openmp (`cmake -S <llvm-project>/runtimes -DLLVM_ENABLE_RUNTIMES=openmp`) current fails with ``` CMake Error at /home/meinersbur/src/llvm/flangrt/_src/cmake/Modules/GetClangResourceDir.cmake:17 (string): string sub-command REGEX, mode MATCH needs at least 5 arguments total to command. Call Stack (most recent call first): /home/meinersbur/src/llvm/flangrt/_src/openmp/CMakeLists.txt:126 (get_clang_resource_dir) ``` The reason is that because it is not a bootstrapping-build, the clang resource dir that it intends to write files such as `omp-tools.h` into, is unavailable. Using the Clang resource dir for writing files is conceptually broken, as that dir might be located in `/usr/lib/clang/<version>/`. Writing to it is only intended in bootstrapping builds where Clang is built alongside openmp. This patch unifies the identification of being in a bootstrapping built. The same `LLVM_TREE_AVAILABLE` definition is going to be used in #137828. No reason for each runtime to define its own.
2025-07-09[libcxxabi][libunwind] Support for using LLVM libc (#134893)Petr Hosek
This generalizes the support added in #99287 renaming the option to RUNTIMES_USE_LIBC and integrating the module into libc++abi and libunwind as well.
2025-06-18[runtimes] Allow use of external llvm-lit on standalone builds (#144347)Lucas Duarte Prates
When creating a standalone build of the runtimes sub-project, the current CMake implementation looks for a lit executable that might potentially exist in the build tree and unconditionally overrides the value of `LLVM_EXTERNAL_LIT`. Due to this, any value passed via `-DLLVM_EXTERNAL_LIT` when configuring the CMake project is ignored. This change adds the `ALLOW_EXTERNAL` argument to the `get_llvm_lit_path` call in the runtimes' CMakeLists.txt, allowing any value previously set to be considered.
2025-06-05[libclc] Support LLVM_ENABLE_RUNTIMES when building (#141574)Fraser Cormack
This commit deprecates the use of LLVM_ENABLE_PROJECTS in favour of LLVM_ENABLE_RUNTIMES when building libclc. Alternatively, using -DLLVM_RUNTIME_TARGETS=<triple> combined with -DRUNTIMES_<triple>_LLVM_ENABLE_RUNTIMES=libclc also gets pretty far but fails due to zlib problems building the LLVM utility 'prepare_builtins'. I'm not sure what's going on there but I don't think it's required at this stage. More work would be required to support that option. This does nothing to change how the host tools are found in order to be used to actually build the libclc libraries. Note that under such a configuration the final libclc builtin libraries are placed in `<build>/runtimes/runtimes-bins/libclc/`, which differs from a non-runtimes build. The installation location remains the same. Fixes #124013.
2025-03-22Revert "[compiler-rt] Disable LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON on AIX. ↵Daniel Chen
(#131200)" (#132574) … This reverts commit 8e773d8a10cc996fbbe834f59ed9f7044c3539e0.
2025-03-19[compiler-rt] Disable LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON on AIX. (#131200)Daniel Chen
LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON is not supported on AIX. Set it to OFF with a WARNING message on AIX.
2025-03-13[libc] Make RPC server handling header only (#131205)Joseph Huber
Summary: This patch moves the RPC server handling to be a header only utility stored in the `shared/` directory. This is intended to be shared within LLVM for the loaders and `offload/` handling. Generally, this makes it easier to share code without weird cross-project binaries being plucked out of the build system. It also allows us to soon move the loader interface out of the `libc` project so that we don't need to bootstrap those and can build them in LLVM.
2025-02-27[libc++] Diagnose when nullptrs are passed to string APIs (#122790)Nikolas Klauser
This allows catching misuses of APIs that take a pointer to a null-terminated string.
2025-02-16[Flang] LLVM_ENABLE_RUNTIMES=flang-rt (#110217)Michael Kruse
Extract Flang's runtime library to use the LLVM_ENABLE_RUNTIME mechanism. It will only become active when `LLVM_ENABLE_RUNTIMES=flang-rt` is used, which also changes the `FLANG_INCLUDE_RUNTIME` to `OFF` so the old runtime build rules do not conflict. This also means that unless `LLVM_ENABLE_RUNTIMES=flang-rt` is passed, nothing changes with the current build process. Motivation: * Consistency with LLVM's other runtime libraries (compiler-rt, libc, libcxx, openmp offload, ...) * Allows compiling the runtime for multiple targets at once using the LLVM_RUNTIME_TARGETS configuration options * Installs the runtime into the compiler's per-target resource directory so it can be automatically found even when cross-compiling Also see RFC discussion at https://discourse.llvm.org/t/rfc-use-llvm-enable-runtimes-for-flangs-runtime/80826
2024-11-30[Reland][Runtimes] Merge 'compile_commands.json' files from runtimes build ↵Joseph Huber
(#116303) Summary: When building a project in a runtime mode, the compilation database is a separate CMake invocation. So its `compile_commands.json` file will be placed elsewhere in the `runtimes/runtime-bins` directory. This is somewhat annoying for ongoing development when a runtimes build is necessary. This patch adds some CMake magic to merge the two files. Fixed issue w/ standalone runtimes build by checking if the LLVM src and CMake src are the same.
2024-11-28Revert "[Runtimes] Merge 'compile_commands.json' files from runtimes build ↵Louis Dionne
(#116303)" This reverts commit 054f914741421ca9dd1eaa58ea74a20f8695bae6, which was found to break the runtimes build.
2024-11-27[Runtimes] Merge 'compile_commands.json' files from runtimes build (#116303)Joseph Huber
Summary: When building a project in a runtime mode, the compilation database is a separate CMake invocation. So its `compile_commands.json` file will be placed elsewhere in the `runtimes/runtime-bins` directory. This is somewhat annoying for ongoing development when a runtimes build is necessary. This patch adds some CMake magic to merge the two files.
2024-11-27[Offload] Use libc 'hand-in-hand' module to find RPC header (#117928)Joseph Huber
Summary: We should now use the official™ way to include the files from `libc/shared`. This required some code to make sure that it's not included twice if multiple people use it as well as a sanity check on the directory.
2024-11-25Reapply "[runtimes] Allow building against an installed LLVM tree"Alexander Richardson
This relands #86209 which was reverted because ./bin/llvm no longer accepted test paths in the source tree instead of the build tree. This was happening because `add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/llvm-lit` was called before all tsst suites were registered, and therefore it was missing the source->build dir mappings. Original commit message: I am currently trying to test the LLVM runtimes (including compiler-rt) against an installed LLVM tree rather than a build tree (since that is no longer available). Currently, the runtimes build of compiler-rt assumes that LLVM_BINARY_DIR is writable since it uses configure_file() to write there during the CMake configure stage. Instead, generate this file inside CMAKE_CURRENT_BINARY_DIR, which will match LLVM_BINARY_DIR when invoked from llvm/runtimes/CMakeLists.txt. I also needed to make a minor change to the hwasan tests: hwasan_symbolize was previously found in the LLVM_BINARY_DIR, but since it is generated as part of the compiler-rt build it is now inside the CMake build directory instead. I fixed this by passing the output directory to lit as config.compiler_rt_bindir and using llvm_config.add_tool_substitutions(). For testing that we no longer write to the LLVM install directory as part of testing or configuration, I created a read-only bind mount and configured the runtimes builds as follows: ``` $ sudo mount --bind --read-only ~/llvm-install /tmp/upstream-llvm-readonly $ cmake -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_C_COMPILER=/tmp/upstream-llvm-readonly/bin/clang \ -DCMAKE_CXX_COMPILER=/tmp/upstream-llvm-readonly/bin/clang++ \ -DLLVM_INCLUDE_TESTS=TRUE -DLLVM_ENABLE_ASSERTIONS=TRUE \ -DCOMPILER_RT_INCLUDE_TESTS=TRUE -DCOMPILER_RT_DEBUG=OFF \ -DLLVM_ENABLE_RUNTIMES=compiler-rt \ -DCMAKE_DISABLE_FIND_PACKAGE_LLVM=TRUE \ -DCMAKE_DISABLE_FIND_PACKAGE_Clang=TRUE \ -G Ninja -S ~/upstream-llvm-project/runtimes \ -B ~/upstream-llvm-project/runtimes/cmake-build-debug-llvm-git ``` Pull Request: https://github.com/llvm/llvm-project/pull/114307
2024-11-13[libc++] Make variables in templates inline (#115785)Nikolas Klauser
The variables are all `constexpr`, which implies `inline`. Since they aren't `constexpr` in C++03 they're also not `inline` there. Because of that we define them out-of-line currently. Instead we can use the C++17 extension of `inline` variables, which results in the same weak definitions of the variables but without having all the boilerplate.
2024-11-06[libc++] Refactor the configuration macros to being always defined (#112094)Nikolas Klauser
This is a follow-up to #89178. This updates the `<__config_site>` macros.
2024-11-04[cmake] Remove obsolete files, docs and CMake variables related to the ↵Louis Dionne
standalone build (#112741) The runtimes used to support a build mode called the "Standalone build", which isn't supported anymore (and hasn't been for a few years). However, various places in the code still contained stuff whose only purpose was to support that build mode, and some outdated documentation. This patch cleans that up (although I probably missed some). - Remove HandleOutOfTreeLLVM.cmake which isn't referenced anymore - Remove the LLVM_PATH CMake variable which isn't used anymore - Update some outdated documentation referencing standalone builds
2024-10-28Revert "[runtimes] Allow building against an installed LLVM tree" (#113920)Nikolas Klauser
Reverts llvm/llvm-project#86209 This patch breaks running tests locally, which is extremely disruptive to libc++ development.
2024-10-25Revert "[runtimes] Probe for -nostdlib++ and -nostdinc++ with the C ↵Vitaly Buka
compiler" (#113653) Reverts llvm/llvm-project#108357 Breaks https://lab.llvm.org/buildbot/#/builders/164/builds/3908 and similar bots
2024-10-24[runtimes] Allow building against an installed LLVM treeAlexander Richardson
I am currently trying to test the LLVM runtimes (including compiler-rt) against an installed LLVM tree rather than a build tree (since that is no longer available). Currently, the runtimes build of compiler-rt assumes that LLVM_BINARY_DIR is writable since it uses configure_file() to write there during the CMake configure stage. Instead, generate this file inside CMAKE_CURRENT_BINARY_DIR, which will match LLVM_BINARY_DIR when invoked from llvm/runtimes/CMakeLists.txt. I also needed to make a minor change to the hwasan tests: hwasan_symbolize was previously found in the LLVM_BINARY_DIR, but since it is generated as part of the compiler-rt build it is now inside the CMake build directory instead. I fixed this by passing the output directory to lit as config.compiler_rt_bindir and using llvm_config.add_tool_substitutions(). For testing that we no longer write to the LLVM install directory as part of testing or configuration, I created a read-only bind mount and configured the runtimes builds as follows: ``` $ sudo mount --bind --read-only ~/llvm-install /tmp/upstream-llvm-readonly $ cmake -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_C_COMPILER=/tmp/upstream-llvm-readonly/bin/clang \ -DCMAKE_CXX_COMPILER=/tmp/upstream-llvm-readonly/bin/clang++ \ -DLLVM_INCLUDE_TESTS=TRUE -DLLVM_ENABLE_ASSERTIONS=TRUE \ -DCOMPILER_RT_INCLUDE_TESTS=TRUE -DCOMPILER_RT_DEBUG=OFF \ -DLLVM_ENABLE_RUNTIMES=compiler-rt \ -DLLVM_BINARY_DIR=/tmp/upstream-llvm-readonly \ -G Ninja -S ~/upstream-llvm-project/runtimes \ -B ~/upstream-llvm-project/runtimes/cmake-build-debug-llvm-git ``` Reviewed By: ldionne Pull Request: https://github.com/llvm/llvm-project/pull/86209
2024-10-24[runtimes] Probe for -nostdlib++ and -nostdinc++ with the C compiler (#108357)Martin Storsjö
While these flags semantically are relevant only for C++, we do add them to CMAKE_REQUIRED_FLAGS if they are detected. All flags in that variable are used both when testing compilation of C and C++ (and for detecting libraries, which uses the C compiler driver). Therefore, to be sure we safely can add the flags to CMAKE_REQUIRED_FLAGS, test for the option with the C language. This should fix compilation with GCC; newer versions of GCC do support the -nostdlib++ option, but it's only supported by the C++ compiler driver, not the C driver. (However, many builds of GCC also do accept the option with the C driver, if GCC was compiled with Ada support enabled, see [1]. That's why this issue isn't noticed in all configurations with GCC.) Clang does support these options in both C and C++ driver modes. This should fix #90332. [1] https://github.com/llvm/llvm-project/issues/90332#issuecomment-2325099254
2024-10-21[libcxx][libc] Hand in Hand PoC with from_chars (#91651)Michael Jones
Implements std::from_chars for float and double. The implementation uses LLVM-libc to do the real parsing. Since this is the first time libc++ uses LLVM-libc there is a bit of additional infrastructure code. The patch is based on the [RFC] Project Hand In Hand (LLVM-libc/libc++ code sharing) https://discourse.llvm.org/t/rfc-project-hand-in-hand-llvm-libc-libc-code-sharing/77701
2024-10-04[libc++] Activate -Warray-zero when building (#110812)serge-sans-paille
2024-07-05[CMake] Use Clang to infer the target triple (#89425)Petr Hosek
When using Clang as a compiler, use Clang to normalize the triple that's used to construct path for runtime library build and install paths. This ensures that paths are consistent and avoids the issue where the build uses a different triple spelling. Differential Revision: https://reviews.llvm.org/D140925
2024-06-25[libc++] Get the GCC build mostly clean of warnings (#96604)Nikolas Klauser
The GCC build has gotten to the point where it's often hard to find the actual error in the build log. We should look into enabling these warnings again in the future, but it looks like a lot of them are bogous.
2024-05-25Revise IDE folder structure (#89755)Michael Kruse
Update the folder titles for targets in the monorepository that have not seen taken care of for some time. These are the folders that targets are organized in Visual Studio and XCode (`set_property(TARGET <target> PROPERTY FOLDER "<title>")`) when using the respective CMake's IDE generator. * Ensure that every target is in a folder * Use a folder hierarchy with each LLVM subproject as a top-level folder * Use consistent folder names between subprojects * When using target-creating functions from AddLLVM.cmake, automatically deduce the folder. This reduces the number of `set_property`/`set_target_property`, but are still necessary when `add_custom_target`, `add_executable`, `add_library`, etc. are used. A LLVM_SUBPROJECT_TITLE definition is used for that in each subproject's root CMakeLists.txt.
2024-04-22[Offload] Move `/openmp/libomptarget` to `/offload` (#75125)Johannes Doerfert
In a nutshell, this moves our libomptarget code to populate the offload subproject. With this commit, users need to enable the new LLVM/Offload subproject as a runtime in their cmake configuration. No further changes are expected for downstream code. Tests and other components still depend on OpenMP and have also not been renamed. The results below are for a build in which OpenMP and Offload are enabled runtimes. In addition to the pure `git mv`, we needed to adjust some CMake files. Nothing is intended to change semantics. ``` ninja check-offload ``` Works with the X86 and AMDGPU offload tests ``` ninja check-openmp ``` Still works but doesn't build offload tests anymore. ``` ls install/lib ``` Shows all expected libraries, incl. - `libomptarget.devicertl.a` - `libomptarget-nvptx-sm_90.bc` - `libomptarget.rtl.amdgpu.so` -> `libomptarget.rtl.amdgpu.so.18git` - `libomptarget.so` -> `libomptarget.so.18git` Fixes: https://github.com/llvm/llvm-project/issues/75124 --------- Co-authored-by: Saiyedul Islam <Saiyedul.Islam@amd.com>
2024-03-11[cmake] Exposes LLVM version number in the runtimes. (#84641)Mark de Wever
This allows sharing the LLVM version number in libc++.
2024-03-04[LLVM][NFC] Ignore including the GNUInstallDirs on the GPU (#83910)Joseph Huber
Summary: I've begun treating GPU runtimes builds as cross-compiling with the LLVM infrastructure. However, we include a lot of random stuff that the GPU build isn't prepared to handle. This currently emits a warning, and while it's not striclty necessary, is annoying. This patch suppresses it by not including the standard GNU install directory resources when used from the GPU.
2024-01-26[libc++] Use GitHub-provided runners for the windows CI (#79326)Nikolas Klauser
Co-authored-by: Martin Storsjö <martin@martin.st>
2023-11-28[CMake] Always define runtimes-test-depends (#73629)Petr Hosek
This allows the parent build to depend on this target unconditionally even when the tests are disabled.
2023-11-28Revert "[llvm] Disable HandleLLVMOptions in runtimes mode (#73031)"Hans Wennborg
This appears to have caused a variety of breakages, see comments on the PR. > Summary: > There are a few default options that LLVM adds that can be problematic > for runtimes builds. These options are generally intended to handle > building LLVM itself, but are also added when building in a runtimes > mode. One such issue I've run into is that in `libc` we deliberately use > `--target` to use a different device toolchain, which doesn't support > some linker arguments passed via `-Wl`. This is observed in > https://github.com/llvm/llvm-project/pull/73030 when attempting to use > these options. > > This patch completely removes these default arguments. > > The consensus is that any issues created by this patch should ultimately > be solved on a per-runtime basis. This reverts commit ee922e6ebfb6aab722f6b0f7cfc0c20af636a250.
2023-11-27[llvm] Disable HandleLLVMOptions in runtimes mode (#73031)Joseph Huber
Summary: There are a few default options that LLVM adds that can be problematic for runtimes builds. These options are generally intended to handle building LLVM itself, but are also added when building in a runtimes mode. One such issue I've run into is that in `libc` we deliberately use `--target` to use a different device toolchain, which doesn't support some linker arguments passed via `-Wl`. This is observed in https://github.com/llvm/llvm-project/pull/73030 when attempting to use these options. This patch completely removes these default arguments. The consensus is that any issues created by this patch should ultimately be solved on a per-runtime basis.
2023-11-27Revert "[llvm] Disable HandleLLVMOptions in runtimes mode (#73031)"Joseph Huber
This reverts commit 79b03306af5c11d354fa90db8bfd7818cd811ef5. I am seeing very confusing errors with the `libomptarget` test suite when using dlopen / other flags. Reverting to investigate why this is.
2023-11-27[llvm] Disable HandleLLVMOptions in runtimes mode (#73031)Joseph Huber
Summary: There are a few default options that LLVM adds that can be problematic for runtimes builds. These options are generally intended to handle building LLVM itself, but are also added when building in a runtimes mode. One such issue I've run into is that in `libc` we deliberately use `--target` to use a different device toolchain, which doesn't support some linker arguments passed via `-Wl`. This is observed in https://github.com/llvm/llvm-project/pull/73030 when attempting to use these options. This patch completely removes these default arguments. The consensus is that any issues created by this patch should ultimately be solved on a per-runtime basis.
2023-10-19[libc++][Android] Support libc++ testing on Android (#69274)Ryan Prichard
I could probably break this commit into more pieces. --- This patch adds libc++ support for Android L (Android 5.0+) and up, tested using the Android team's current compiler, a recent version of the AOSP sysroot, and the x86[-64] Android Emulator. CMake and Lit Configuration: Add runtimes/cmake/android/Arch-${ARCH}.cmake files that configure CMake to cross-compile to Android without using CMake's built-in NDK support (which only works with an actual packaged NDK). Add libcxx/cmake/caches/AndroidNDK.cmake that builds and tests libc++ (and libc++abi) for Android. This file configures libc++ to match what the NDK distributes, e.g.: - libc++_shared.so (includes libc++abi objects, there is no libc++abi.so). libunwind is linked statically but not exported. - libc++_static.a (does not include libc++abi) and libc++abi.a - `std::__ndk1` namespace - All the libraries are built with `__ANDROID_API__=21`, even when they are linked to something targeting a higher API level. (However, when the Android LLVM team builds these components, they do not use these CMake cache files. Instead they use Python scripts to configure the builds. See https://android.googlesource.com/toolchain/llvm_android/.) Add llvm-libc++[abi].android-ndk.cfg.in files that test the Android NDK's libc++_shared.so. These files can target old or new Android devices. The Android LLVM team uses these test files to test libc++ for both arm/arm64 and x86/x86_64 architectures. The Android testing mode works by setting %{executor} to adb_run.py, which uses `adb push` and `adb shell` to run tests remotely. adb_run.py always runs tests as the "shell" user even on an old emulator where "adb unroot" doesn't work. The script has workarounds for old Android devices. The script uses a Unix domain socket on the host (--job-limit-socket) to restrict concurrent adb invocations. Compiling the tests is a major part of libc++ testing run-time, so it's desirable to exploit all the host cores without overburdening the test devices, which can have far fewer cores. BuildKite CI: Add a builder to run-buildbot, `android-ndk-*`, that uses Android Clang and an Android sysroot to build libc++, then starts an Android emulator container to run tests. Run the emulator and an adb server in a separate Docker container (libcxx-ci-android-emulator), and create a separate Docker image for each emulator OS system image. Set ADB_SERVER_SOCKET to connect to the container's adb server. Running the only adb server inside the container makes cleanup more reliable between test runs, e.g. the adb client doesn't create a `~/.android` directory and the adb server can be restarted along with the emulator using docker stop/run. (N.B. The emulator insists on connecting to an adb server and will start one itself if it can't connect to one.) The suffix to the android-ndk-* job is a label that concisely specifies an Android SDK emulator image. e.g.: - "system-images;android-21;default;x86" ==> 21-def-x86 - "system-images;android-33;google_apis;x86_64" ==> 33-goog-x86_64 Fixes: https://github.com/llvm/llvm-project/issues/69270 Differential Revision: https://reviews.llvm.org/D139147
2023-10-04[runtimes] Fix parsing of LIB{CXX,CXXABI,UNWIND}_TEST_PARAMS (#67691)Alexander Richardson
Since 78d649a417b48cb8a2ba2e755f0e7c8fb8b1bb83 the recommended way to pass an executor is to use the _TEST_PARAMS variable, which means we now pass more complicated value (including ones that may contain multiple `=`) as part of this variable. However, the `REGEX REPLACE` being used has greedy matches so everything up to the last = becomes part of the variable name which results in invalid syntax in the generated lit config file. This was noticed due to builder failures for those using the CrossWinToARMLinux.cmake cache file. --------- Co-authored-by: Vladimir Vereschaka <vvereschaka@accesssoftek.com>
2023-10-02Revert "[Flang] [FlangRT] Introduce FlangRT project as solution to Flang's ↵David Spickett
runtime LLVM integration" This reverts commit 6403287eff71a3d6f6c862346d6ed3f0f000eb70. This is failing on all but 1 of Linaro's flang builders. CMake Error at /home/tcwg-buildbot/worker/clang-aarch64-full-2stage/llvm/flang-rt/unittests/CMakeLists.txt:37 (message): Target llvm_gtest not found.