[libc-commits] [libc] [libc] Make hermetic test syscall deps linux-only (PR #210715)

via libc-commits libc-commits at lists.llvm.org
Mon Jul 20 07:08:25 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Pavel Labath (labath)

<details>
<summary>Changes</summary>

They are only used on linux, so this matches that.

They are also only used in full build mode, but hermetic tests only work in full build mode, so we don't need to check that here. The darwin check is a noop as (AAIU) we don't support full_build on darwin, but I've kept it for symmetry.

---
Full diff: https://github.com/llvm/llvm-project/pull/210715.diff


1 Files Affected:

- (modified) libc/cmake/modules/LLVMLibCTestRules.cmake (+17-12) 


``````````diff
diff --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index fdc7764c65177..73803b809b991 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -780,20 +780,25 @@ function(add_libc_hermetic test_name)
       libc.src.string.memset
       libc.src.strings.bcmp
       libc.src.strings.bzero
-      # Syscalls used by death tests.
-      libc.src.poll.poll
-      libc.src.signal.kill
-      libc.src.stdio.fflush
-      libc.src.stdio.stderr
-      libc.src.stdio.stdout
-      libc.src.stdlib.exit
-      libc.src.string.strsignal
-      libc.src.sys.wait.waitpid
-      libc.src.unistd.close
-      libc.src.unistd.fork
-      libc.src.unistd.pipe
   )
 
+  # Syscalls used by death tests. See also libc/test/UnitTest/CMakeLists.txt.
+  if(${LIBC_TARGET_OS} STREQUAL "linux" OR ${LIBC_TARGET_OS} STREQUAL "darwin")
+    list(APPEND fq_deps_list
+        libc.src.poll.poll
+        libc.src.signal.kill
+        libc.src.stdio.fflush
+        libc.src.stdio.stderr
+        libc.src.stdio.stdout
+        libc.src.stdlib.exit
+        libc.src.string.strsignal
+        libc.src.sys.wait.waitpid
+        libc.src.unistd.close
+        libc.src.unistd.fork
+        libc.src.unistd.pipe
+    )
+  endif()
+
   if(libc.src.compiler.__stack_chk_fail IN_LIST TARGET_LLVMLIBC_ENTRYPOINTS)
     # __stack_chk_fail should always be included if supported to allow building
     # libc with the stack protector enabled.

``````````

</details>


https://github.com/llvm/llvm-project/pull/210715


More information about the libc-commits mailing list