sim: make possible keep ubsan and bypass feature

sometimes ubsan work with asan trigger a mistake report, make it
possible to export library with ubsan, and bypass runtime feature.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
This commit is contained in:
buxiasen 2024-07-04 14:11:43 +08:00 committed by archer
parent 8cd207e1b1
commit c641148bc4
2 changed files with 11 additions and 0 deletions

View File

@ -83,6 +83,13 @@ config SIM_UBSAN
Compile-time instrumentation is used to detect various undefined behaviours Compile-time instrumentation is used to detect various undefined behaviours
at runtime. at runtime.
config SIM_UBSAN_DUMMY
bool "Bypass Undefined Behaviour Sanitizer"
default n
depends on SIM_UBSAN
---help---
Keep SIM_UBSAN compile time but disable runtime actions.
choice choice
prompt "X64_64 ABI" prompt "X64_64 ABI"
default SIM_X8664_SYSTEMV if HOST_LINUX default SIM_X8664_SYSTEMV if HOST_LINUX

View File

@ -142,8 +142,12 @@ const char *__lsan_default_options(void)
#ifdef CONFIG_SIM_UBSAN #ifdef CONFIG_SIM_UBSAN
const char *__ubsan_default_options(void) const char *__ubsan_default_options(void)
{ {
#ifdef CONFIG_SIM_UBSAN_DUMMY
return "";
#else
return "print_stacktrace=1" return "print_stacktrace=1"
" fast_unwind_on_malloc=0"; " fast_unwind_on_malloc=0";
#endif
} }
#endif #endif