Skip to content

Commit 4f1e8f5

Browse files
vanwinkeljancarlescufi
authored andcommitted
native: debug: Set speed optimization if ASAN is used
Set speed optimization, instead of size, in case address sanitizer is enabled for native_posix. This is need as the i386 assembly code used in mbetls does not compile if address sanitizer is used together with size optimization. Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
1 parent b569419 commit 4f1e8f5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ if(CONFIG_MBEDTLS_BUILTIN)
2323
${mbedtls_sources}
2424
)
2525

26+
if(CONFIG_ARCH_POSIX AND CONFIG_ASAN AND NOT CONFIG_64BIT)
27+
# i386 assembly code used in MBEDTLS does not compile with size optimization
28+
# if address sanitizer is enabled, as such switch default optimization level
29+
# to speed
30+
set_property(SOURCE library/bignum.c APPEND PROPERTY COMPILE_OPTIONS
31+
"${OPTIMIZE_FOR_SPEED_FLAG}")
32+
endif ()
33+
2634
zephyr_library_link_libraries(mbedTLS)
2735
else()
2836
assert(CONFIG_MBEDTLS_LIBRARY "MBEDTLS was enabled, but neither BUILTIN or LIBRARY was selected.")

0 commit comments

Comments
 (0)