cmake/scons: if sanitizers are enabled, also add -fno-omit-frame-pointer and -fno-optimize-sibling-calls.
Otherwise, if we build with sanitizers and optimizations, the sanitizer stacktraces can become quite hard to read.
(cherry-picked from commit 29089a4736
)
This commit is contained in:
parent
bf8b0220e5
commit
4c5e74b2da
2 changed files with 5 additions and 2 deletions
|
@ -232,6 +232,8 @@ endif(ENABLE_PEDANTIC_COMPILATION)
|
|||
if(SANITIZE)
|
||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -fsanitize=${SANITIZE}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=${SANITIZE}")
|
||||
# manually disable some optimizations to get better stacktraces if sanitizers are used
|
||||
set(COMPILER_FLAGS "${COMPILER_FLAGS} -fno-omit-frame-pointer -fno-optimize-sibling-calls")
|
||||
endif(SANITIZE)
|
||||
|
||||
### Set the final compiler flags.
|
||||
|
|
|
@ -481,7 +481,8 @@ for env in [test_env, client_env, env]:
|
|||
env.AppendUnique(CXXFLAGS = Split("-Wctor-dtor-privacy -Wuseless-cast -Wnoexcept"))
|
||||
if env['sanitize']:
|
||||
env.AppendUnique(CCFLAGS = ["-fsanitize=" + env["sanitize"]], LINKFLAGS = ["-fsanitize=" + env["sanitize"]])
|
||||
|
||||
env.AppendUnique(CCFLAGS = Split("-fno-omit-frame-pointer -fno-optimize-sibling-calls"))
|
||||
|
||||
# #
|
||||
# Determine optimization level
|
||||
# #
|
||||
|
@ -494,7 +495,7 @@ for env in [test_env, client_env, env]:
|
|||
else:
|
||||
env["opt"] = "-O0 "
|
||||
else:
|
||||
env["opt"] = env["opt"]+" "
|
||||
env["opt"] = env["opt"]+" "
|
||||
|
||||
# #
|
||||
# Start determining options for debug build
|
||||
|
|
Loading…
Add table
Reference in a new issue