feat(build): support KASAN in the build system v2 (cmakev2)

Mirror Kernel Address Sanitizer support into cmakev2 so that
CONFIG_COMPILER_KASAN instruments application code the same way build system v1
does.
This commit is contained in:
Sudeep Mohanty
2026-08-03 17:31:17 +02:00
parent cc799dbcc7
commit 9c778c954c
6 changed files with 166 additions and 31 deletions
+12
View File
@@ -861,6 +861,18 @@ endfunction()
List of linker script files added to the link command (with ``-T``) for the
component.
.. cmakev2:component_property:: NO_KASAN
When set to a true value, the component is compiled without Kernel Address
Sanitizer instrumentation (``-fno-sanitize=kernel-address``) while
``CONFIG_COMPILER_KASAN`` is enabled. Set it on a component that runs before
the sanitizer shadow is initialised, executes with the flash cache disabled,
or is otherwise too low-level to instrument.
The low-level ESP-IDF components are excluded already; the built-in set is
defined in ``tools/cmake/kasan.cmake`` and shared with the CMake-based build
system v1, which honours this property as well.
#]]
#[[api