1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 12:57:35 +00:00

Meta+Userland: Add ENABLE_USERSPACE_COVERAGE_COLLECTION CMake option

This option sets -fprofile-instr-generate -fcoverage-mapping for Clang
builds only on almost all of Userland. Loader and LibTimeZone are
exempt. This can be used for generating code coverage reports, or even
PGO in the future.
This commit is contained in:
Andrew Kaster 2022-03-04 18:02:09 -07:00 committed by Andreas Kling
parent a6b2c34746
commit 5120b39d0e
9 changed files with 39 additions and 2 deletions

View file

@ -12,3 +12,4 @@ serenity_option(ENABLE_KERNEL_COVERAGE_COLLECTION OFF CACHE BOOL "Enable KCOV a
serenity_option(ENABLE_KERNEL_LTO OFF CACHE BOOL "Build the kernel with link-time optimization")
serenity_option(ENABLE_EXTRA_KERNEL_DEBUG_SYMBOLS OFF CACHE BOOL "Enable -Og and -ggdb3 options for Kernel code for easier debugging")
serenity_option(ENABLE_MOLD_LINKER OFF CACHE BOOL "Link the SerenityOS userland with the mold linker")
serenity_option(ENABLE_USERSPACE_COVERAGE_COLLECTION OFF CACHE BOOL "Enable code coverage instrumentation for userspace binaries in clang")

View file

@ -73,6 +73,9 @@ function(serenity_libc target_name fs_name)
if (NOT ENABLE_MOLD_LINKER)
target_link_options(${target_name} PRIVATE -Wl,--no-dependent-libraries)
endif()
if (ENABLE_USERSPACE_COVERAGE_COLLECTION)
target_link_libraries(${target_name} clang_rt.profile)
endif()
endif()
target_link_directories(LibC PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
serenity_generated_sources(${target_name})