cmake: Update CONFIG_ASAN support
This had bitrotten a bit, and didn't build as shipped. Current libasan implementations want -fsanitize=address passed as a linker argument too. We have grown a "lld" linker variant that needs the same cmake treatment as the "ld" binutils one, but never got it. But the various flags had been cut/pasted around to different places, with slightly different forms. That's really sort of a mess, as sanitizer support was only ever support with host toolchains for native_posix (and AFAICT no one anywhere has made this work on cross compilers in an embedded environment). And the separate "gcc" vs. "llvm" layers were silly, as there has only ever been one API for this feature (from LLVM, then picked up compatibly by gcc). Pull this stuff out and just do it in one place in the posix arch for simplicity. Also recent sanitizers are trying to add instrumentation padding around data that we use linker trickery to pack tightly (c.f. SYS_INIT, STRUCT_SECTION_ITERABLE) and we need a way ("__noasan") to turn that off. Actually for gcc, it was enough to just make the records const (already true for most of them, except a native_posix init struct), but clang apparently isn't smart enough. Finally, add an ASAN_RECOVER kconfig that enables the use of "halt_on_error=0" in $ASAN_OPTIONS, which continues execution past the first error. Signed-off-by: Andy Ross <andyross@google.com>
This commit is contained in:
parent
d6297988be
commit
74cc534758
13 changed files with 61 additions and 43 deletions
|
@ -177,13 +177,8 @@ set_compiler_property(PROPERTY no_common -fno-common)
|
|||
# GCC compiler flags for imacros. The specific header must be appended by user.
|
||||
set_compiler_property(PROPERTY imacros -imacros)
|
||||
|
||||
# GCC compiler flags for sanitizing.
|
||||
set_compiler_property(PROPERTY sanitize_address -fsanitize=address)
|
||||
|
||||
set_compiler_property(PROPERTY gprof -pg)
|
||||
|
||||
set_compiler_property(PROPERTY sanitize_undefined -fsanitize=undefined)
|
||||
|
||||
# GCC compiler flag for turning off thread-safe initialization of local statics
|
||||
set_property(TARGET compiler-cpp PROPERTY no_threadsafe_statics "-fno-threadsafe-statics")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue