mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
Kernel: Only build kcov object files, if feature is enabled
This commit is contained in:
parent
106d4636a4
commit
ca89116a46
Notes:
sideshowbarker
2024-07-17 08:35:21 +09:00
Author: https://github.com/HerrSpace Commit: https://github.com/SerenityOS/serenity/commit/ca89116a46 Pull-request: https://github.com/SerenityOS/serenity/pull/23911 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/Hendiadyoin1 Reviewed-by: https://github.com/LucasChollet
2 changed files with 25 additions and 17 deletions
|
@ -30,7 +30,9 @@
|
|||
#include <Kernel/Devices/Generic/SelfTTYDevice.h>
|
||||
#include <Kernel/Devices/Generic/ZeroDevice.h>
|
||||
#include <Kernel/Devices/HID/Management.h>
|
||||
#include <Kernel/Devices/KCOVDevice.h>
|
||||
#ifdef ENABLE_KERNEL_COVERAGE_COLLECTION
|
||||
# include <Kernel/Devices/KCOVDevice.h>
|
||||
#endif
|
||||
#include <Kernel/Devices/PCISerialDevice.h>
|
||||
#include <Kernel/Devices/SerialDevice.h>
|
||||
#include <Kernel/Devices/Storage/StorageManagement.h>
|
||||
|
|
|
@ -66,8 +66,6 @@ set(KERNEL_SOURCES
|
|||
Devices/CharacterDevice.cpp
|
||||
Devices/Device.cpp
|
||||
Devices/DeviceManagement.cpp
|
||||
Devices/KCOVDevice.cpp
|
||||
Devices/KCOVInstance.cpp
|
||||
Devices/PCISerialDevice.cpp
|
||||
Devices/SerialDevice.cpp
|
||||
Devices/HID/AllMiceDevice.cpp
|
||||
|
@ -136,7 +134,6 @@ set(KERNEL_SOURCES
|
|||
Devices/Storage/StorageDevice.cpp
|
||||
Devices/Storage/StorageManagement.cpp
|
||||
Devices/Storage/StorageDevicePartition.cpp
|
||||
SanCov.cpp
|
||||
FileSystem/AnonymousFile.cpp
|
||||
FileSystem/BlockBasedFileSystem.cpp
|
||||
FileSystem/Custody.cpp
|
||||
|
@ -630,18 +627,6 @@ set(PARTITION_SOURCES
|
|||
../Userland/Libraries/LibPartition/PartitionTable.cpp
|
||||
)
|
||||
|
||||
set(SOURCES
|
||||
${KERNEL_SOURCES}
|
||||
${GENERATED_SOURCES}
|
||||
${AK_SOURCES}
|
||||
${DT_SOURCES}
|
||||
${EDID_SOURCES}
|
||||
${ELF_SOURCES}
|
||||
${VT_SOURCES}
|
||||
${CRYPTO_SOURCES}
|
||||
${PARTITION_SOURCES}
|
||||
)
|
||||
|
||||
add_compile_options(-fsigned-char)
|
||||
add_compile_options(-Wno-unknown-warning-option -Wvla -Wnull-dereference)
|
||||
add_compile_options(-fno-rtti -ffreestanding -fbuiltin)
|
||||
|
@ -723,6 +708,13 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-pie")
|
|||
# secure to run in production builds. Useful for coverage guided fuzzing.
|
||||
if (ENABLE_KERNEL_COVERAGE_COLLECTION)
|
||||
add_definitions(-DENABLE_KERNEL_COVERAGE_COLLECTION)
|
||||
set(KERNEL_SOURCES
|
||||
${KERNEL_SOURCES}
|
||||
Devices/KCOVDevice.cpp
|
||||
Devices/KCOVInstance.cpp
|
||||
SanCov.cpp
|
||||
)
|
||||
|
||||
add_compile_options(-fsanitize-coverage=trace-pc)
|
||||
set(KCOV_EXCLUDED_SOURCES
|
||||
# Make sure we don't instrument any code called from __sanitizer_cov_trace_pc
|
||||
|
@ -746,7 +738,9 @@ if (ENABLE_KERNEL_COVERAGE_COLLECTION)
|
|||
../Kernel/Syscall/SyscallHandler.cpp
|
||||
)
|
||||
set_source_files_properties(${KCOV_EXCLUDED_SOURCES} PROPERTIES COMPILE_FLAGS "-fno-sanitize-coverage=trace-pc")
|
||||
elseif (ENABLE_USERSPACE_COVERAGE_COLLECTION)
|
||||
endif()
|
||||
|
||||
if (ENABLE_USERSPACE_COVERAGE_COLLECTION)
|
||||
# Disable checking open() pledges and the veil for coverage data when building userspace with coverage
|
||||
# so that binaries can write out coverage data even with pledges/veil
|
||||
add_compile_definitions(SKIP_PATH_VALIDATION_FOR_COVERAGE_INSTRUMENTATION)
|
||||
|
@ -777,6 +771,18 @@ if ("${SERENITY_ARCH}" STREQUAL "aarch64")
|
|||
add_compile_options(-mstrict-align -Wno-cast-align)
|
||||
endif()
|
||||
|
||||
set(SOURCES
|
||||
${KERNEL_SOURCES}
|
||||
${GENERATED_SOURCES}
|
||||
${AK_SOURCES}
|
||||
${DT_SOURCES}
|
||||
${EDID_SOURCES}
|
||||
${ELF_SOURCES}
|
||||
${VT_SOURCES}
|
||||
${CRYPTO_SOURCES}
|
||||
${PARTITION_SOURCES}
|
||||
)
|
||||
|
||||
add_compile_definitions(KERNEL)
|
||||
add_link_options(LINKER:-z,notext)
|
||||
|
||||
|
|
Loading…
Reference in a new issue