mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Sanitizer: Support address sanitizer for x86_64 platform (#3212)
* Sanitizer: Support address sanitizer for x86_64 platform * Sanitizer: Not mac os need -static-libasan * Sanitizer: Add script for docker test. * Sanitizer: Refine build script. * Santizer: Fix ossrs/srs:dev-gcc7-cache cannot find libasan bug * Sanitizer: Support sanitizer when use ossrs/srs:dev-cache and ubuntuxx-cache * Sanitizer: Add sanitizer-static config Co-authored-by: winlin <winlin@vip.126.com>
This commit is contained in:
parent
e10fa6dc91
commit
961f701929
8 changed files with 76 additions and 9 deletions
19
trunk/configure
vendored
19
trunk/configure
vendored
|
@ -112,6 +112,16 @@ fi
|
|||
if [[ $SRS_EXTRA_FLAGS != '' ]]; then
|
||||
CXXFLAGS="${CXXFLAGS} $SRS_EXTRA_FLAGS";
|
||||
fi
|
||||
|
||||
# For Sanitizer
|
||||
# @doc: https://github.com/google/sanitizers/wiki/AddressSanitizer
|
||||
if [[ $SRS_SANITIZER == YES && $OS_IS_X86_64 == YES ]]; then
|
||||
CXXFLAGS="${CXXFLAGS} -fsanitize=address -fno-omit-frame-pointer";
|
||||
if [[ $SRS_SANITIZER_STATIC == YES ]]; then
|
||||
CXXFLAGS="${CXXFLAGS} -static-libasan";
|
||||
fi
|
||||
fi
|
||||
|
||||
# Start to generate the Makefile.
|
||||
cat << END >> ${SRS_OBJS}/${SRS_MAKEFILE}
|
||||
GCC = ${SRS_TOOL_CC}
|
||||
|
@ -198,6 +208,15 @@ if [[ $SRS_BACKTRACE == YES ]]; then
|
|||
SrsLinkOptions="${SrsLinkOptions} -rdynamic";
|
||||
fi
|
||||
|
||||
# For address sanitizer
|
||||
# @doc: https://github.com/google/sanitizers/wiki/AddressSanitizer
|
||||
if [[ $SRS_SANITIZER == YES && $OS_IS_X86_64 == YES ]]; then
|
||||
SrsLinkOptions="${SrsLinkOptions} -fsanitize=address -fno-omit-frame-pointer";
|
||||
if [[ $SRS_SANITIZER_STATIC == YES ]]; then
|
||||
SrsLinkOptions="${SrsLinkOptions} -static-libasan";
|
||||
fi
|
||||
fi
|
||||
|
||||
#####################################################################################
|
||||
# Modules, compile each module, then link to binary
|
||||
#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue