[llvm-branch-commits] [libcxx] Add Testing Configuration for LLVM libc (PR #165120)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sat Oct 25 15:04:56 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Aiden Grossman (boomanaiden154)
<details>
<summary>Changes</summary>
This patch adds a CMake cache, and the testing configs to build libc++
and run the tests against LLVM libc.
---
Full diff: https://github.com/llvm/llvm-project/pull/165120.diff
3 Files Affected:
- (added) libcxx/cmake/caches/Generic-llvm-libc.cmake (+65)
- (added) libcxx/test/configs/llvm-libc++-llvm-libc.cfg.in (+27)
- (added) libcxxabi/test/configs/llvm-libc++abi-llvm-libc.cfg.in (+27)
``````````diff
diff --git a/libcxx/cmake/caches/Generic-llvm-libc.cmake b/libcxx/cmake/caches/Generic-llvm-libc.cmake
new file mode 100644
index 0000000000000..88440bb7966bd
--- /dev/null
+++ b/libcxx/cmake/caches/Generic-llvm-libc.cmake
@@ -0,0 +1,65 @@
+set(LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "")
+set(LIBUNWIND_INSTALL_LIBRARY ON CACHE BOOL "")
+set(LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "")
+
+set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
+set(COMPILER_RT_CXX_LIBRARY "libcxx" CACHE STRING "")
+
+set(COMPILER_RT_USE_LLVM_UNWINDER OFF CACHE BOOL "")
+set(COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL "")
+set(COMPILER_RT_BUILD_CRT ON CACHE BOOL "")
+set(COMPILER_RT_BUILD_STANDALONE_LIBATOMIC OFF CACHE BOOL "")
+set(COMPILER_RT_HAS_FNO_BUILTIN_FLAG ON CACHE BOOL "")
+set(COMPILER_RT_BUILTINS_HIDE_SYMBOLS ON CACHE BOOL "")
+set(COMPILER_RT_HAS_VISIBILITY_HIDDEN_FLAG ON CACHE BOOL "")
+set(COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "")
+set(COMPILER_RT_BUILD_PROFILE OFF CACHE BOOL "")
+set(COMPILER_RT_BUILD_SANITIZERS ON CACHE BOOL "")
+set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "")
+set(COMPILER_RT_BUILD_ORC OFF CACHE BOOL "")
+set(COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL "")
+set(COMPILER_RT_DEBUG OFF CACHE BOOL "")
+set(COMPILER_RT_CRT_USE_EH_FRAME_REGISTRY ON CACHE BOOL "")
+
+set(LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "")
+set(LIBCXXABI_USE_LLVM_UNWINDER OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
+set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
+set(LIBCXX_INCLUDE_BENCHMARKS OFF CACHE BOOL "")
+
+set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
+set(LIBCXX_INSTALL_LIBRARY ON CACHE BOOL "")
+set(LIBCXX_CXX_ABI libcxxabi CACHE STRING "")
+
+# confirmed not available in libc
+set(LIBCXX_ENABLE_LOCALIZATION OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "")
+
+# missing at least `<sys/statvfs.h>` and `utimes`
+set(LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")
+
+# missing at least `ioctl`
+set(LIBCXX_ENABLE_RANDOM_DEVICE OFF CACHE BOOL "")
+
+# unclear what this is missing
+set(LIBCXX_ENABLE_MONOTONIC_CLOCK OFF CACHE BOOL "")
+
+# requires LIBCXX_ENABLE_MONOTONIC_CLOCK=ON
+set(LIBCXX_ENABLE_THREADS OFF CACHE BOOL "")
+set(LIBCXXABI_ENABLE_THREADS OFF CACHE BOOL "")
+
+# these are fine
+set(LIBCXX_ENABLE_UNICODE ON CACHE BOOL "")
+set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
+set(LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_RTTI OFF CACHE BOOL "")
+set(RUNTIMES_USE_LIBC "llvm-libc" CACHE STRING "")
+
+set(CMAKE_BUILD_TYPE "Release" CACHE STRING "")
+set(LLVM_ENABLE_RUNTIMES "compiler-rt;libc;libunwind;libcxxabi;libcxx" CACHE STRING "")
+set(LLVM_LIBC_FULL_BUILD ON CACHE BOOL "")
+set(LLVM_LIBC_INCLUDE_SCUDO ON CACHE BOOL "")
+set(COMPILER_RT_BUILD_GWP_ASAN OFF CACHE BOOL "")
+set(COMPILER_RT_BUILD_SCUDO_STANDALONE_WITH_LLVM_LIBC ON CACHE BOOL "")
+
+#set(CMAKE_SYSROOT "/home/gha/libc-sysroot" CACHE STRING "")
diff --git a/libcxx/test/configs/llvm-libc++-llvm-libc.cfg.in b/libcxx/test/configs/llvm-libc++-llvm-libc.cfg.in
new file mode 100644
index 0000000000000..051d131ab78cd
--- /dev/null
+++ b/libcxx/test/configs/llvm-libc++-llvm-libc.cfg.in
@@ -0,0 +1,27 @@
+# This testing configuration handles running the test suite against LLVM's libc++
+# using a static library.
+
+lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
+
+config.substitutions.append(('%{flags}',
+ '-pthread' + (' -isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else '')
+))
+config.substitutions.append(('%{compile_flags}',
+ '-nostdinc++ -I %{include-dir} -I %{target-include-dir} -I /home/gha/llvm-project/build-runtimes/libc/include -I %{libcxx-dir}/test/support'
+))
+config.substitutions.append(('%{link_flags}',
+ '-nodefaultlibs -nostartfiles -L %{lib-dir} -lc++ -lc++abi /home/gha/llvm-project/build-runtimes/libc/startup/linux/crt1.o /home/gha/llvm-project/build-runtimes/libc/lib/libc.a /home/gha/llvm-project/build-runtimes/libc/lib/libm.a -static -fno-use-cxa-atexit /home/gha/llvm-project/build-runtimes/compiler-rt/lib/linux/libclang_rt.builtins-x86_64.a'
+))
+config.substitutions.append(('%{exec}',
+ '%{executor} --execdir %{temp} -- '
+))
+
+import os, site
+site.addsitedir(os.path.join('@LIBCXX_SOURCE_DIR@', 'utils'))
+import libcxx.test.params, libcxx.test.config
+libcxx.test.config.configure(
+ libcxx.test.params.DEFAULT_PARAMETERS,
+ libcxx.test.features.DEFAULT_FEATURES,
+ config,
+ lit_config
+)
diff --git a/libcxxabi/test/configs/llvm-libc++abi-llvm-libc.cfg.in b/libcxxabi/test/configs/llvm-libc++abi-llvm-libc.cfg.in
new file mode 100644
index 0000000000000..db261875b2270
--- /dev/null
+++ b/libcxxabi/test/configs/llvm-libc++abi-llvm-libc.cfg.in
@@ -0,0 +1,27 @@
+# This testing configuration handles running the test suite against LLVM's libc++abi
+# using a static library.
+
+lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
+
+config.substitutions.append(('%{flags}',
+ '-isysroot {}'.format('@CMAKE_OSX_SYSROOT@') if '@CMAKE_OSX_SYSROOT@' else ''
+))
+config.substitutions.append(('%{compile_flags}',
+ '-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} %{maybe-include-libunwind} -I %{libcxx}/test/support -I %{libcxx}/src -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS'
+))
+config.substitutions.append(('%{link_flags}',
+ '-nodefaultlibs -nostartfiles -L %{lib} -lc++ -lc++abi -pthread /home/gha/llvm-project/build-runtimes/libc/startup/linux/crt1.o /home/gha/llvm-project/build-runtimes/libc/lib/libc.a -static -fno-use-cxa-atexit'
+))
+config.substitutions.append(('%{exec}',
+ '%{executor} --execdir %{temp} -- '
+))
+
+import os, site
+site.addsitedir(os.path.join('@LIBCXXABI_LIBCXX_PATH@', 'utils'))
+import libcxx.test.params, libcxx.test.config
+libcxx.test.config.configure(
+ libcxx.test.params.DEFAULT_PARAMETERS,
+ libcxx.test.features.DEFAULT_FEATURES,
+ config,
+ lit_config
+)
``````````
</details>
https://github.com/llvm/llvm-project/pull/165120
More information about the llvm-branch-commits
mailing list