aboutsummaryrefslogtreecommitdiff
path: root/libc/cmake
diff options
context:
space:
mode:
authorJoseph Huber <jhuber6@vols.utk.edu>2023-11-02 15:03:17 -0500
committerGitHub <noreply@github.com>2023-11-02 15:03:17 -0500
commit158d7b8c23990771f8f8688ae43b037440ae9528 (patch)
tree74da059c3df742c2a30ff09edb8ce4d4d899efe2 /libc/cmake
parent0e6c679c1a5c0d3f101335c904583b5d62cb51d3 (diff)
downloadllvm-158d7b8c23990771f8f8688ae43b037440ae9528.zip
llvm-158d7b8c23990771f8f8688ae43b037440ae9528.tar.gz
llvm-158d7b8c23990771f8f8688ae43b037440ae9528.tar.bz2
[libc] Allow hermetic timing if the `clock` function is built (#71092)
Summary: This patch fixes some code duplication on the GPU. The GPU build wanted to enable timing for hermetic tests so it built some special case handling into the test suite. Now that `clock` is supported on the target we can simply link against the external interface. Because we include `clock.h` for the CLOCKS_PER_SEC macro we remap the C entrypoint to the internal one if it ends up called. This should allow hermetic tests to run with timing if it is supported.
Diffstat (limited to 'libc/cmake')
-rw-r--r--libc/cmake/modules/LLVMLibCTestRules.cmake6
1 files changed, 6 insertions, 0 deletions
diff --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index fc66c12..f7ca6a2 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -636,6 +636,12 @@ function(add_libc_hermetic_test test_name)
libc.src.string.memset
libc.src.__support.StringUtil.error_to_string
)
+
+ if(TARGET libc.src.time.clock)
+ # We will link in the 'clock' implementation if it exists for test timing.
+ list(APPEND fq_deps_list libc.src.time.clock)
+ endif()
+
list(REMOVE_DUPLICATES fq_deps_list)
# TODO: Instead of gathering internal object files from entrypoints,