[libc-commits] [libc] [libc] Enabling code coverage via Linux syscalls (PR #213271)
Jeff Bailey via libc-commits
libc-commits at lists.llvm.org
Tue Aug 4 00:42:08 PDT 2026
================
@@ -91,6 +91,32 @@ endif()
set(LIBC_LINK_OPTIONS_DEFAULT "" CACHE STRING "Arguments used when linking.")
set(LIBC_TEST_LINK_OPTIONS_DEFAULT "" CACHE STRING "Common link options for all the tests.")
+option(LLVM_LIBC_ENABLE_COVERAGE "Build libc with coverage instrumentation" OFF)
+if(LLVM_LIBC_ENABLE_COVERAGE)
----------------
kaladron wrote:
Consider this instead to restrict to the Linux target (and avoid long lines)
```
if(LLVM_LIBC_ENABLE_COVERAGE AND (${LIBC_TARGET_OS} STREQUAL "linux"))
list(APPEND LIBC_COMPILE_OPTIONS_DEFAULT
"-fprofile-instr-generate" "-fcoverage-mapping")
list(APPEND LIBC_TEST_COMPILE_OPTIONS_DEFAULT
"-fprofile-instr-generate" "-fcoverage-mapping")
list(APPEND LIBC_TEST_LINK_OPTIONS_DEFAULT
"-fprofile-instr-generate" "-fcoverage-mapping")
```
https://github.com/llvm/llvm-project/pull/213271
More information about the libc-commits
mailing list