Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --enable-asan & --enable-ubsan. By default disabled. #352

Open
wants to merge 1 commit into
base: 2.4
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ if test x$enable_debug = xyes; then
user_CXXFLAGS="$CXXFLAGS" # ac_save_CXXFLAGS is not set yet
fi

# sanitizer
AC_ARG_ENABLE(asan, [ --enable-asan address sanitizer])
AC_ARG_ENABLE(ubsan, [ --enable-ubsan undefined behaviour sanitizer])

# do we want the bzflag client?
AC_ARG_ENABLE(client, [ --disable-client server-only build])

Expand Down Expand Up @@ -767,6 +771,16 @@ else
AC_DEFINE(NDEBUG, 1, [Debugging disabled])
fi

if test "x$enable_asan" = xyes; then
CONF_CFLAGS="$CONF_CFLAGS -fsanitize=address"
CONF_CXXFLAGS="$CONF_CXXFLAGS -fsanitize=address"
fi

if test "x$enable_ubsan" = xyes; then
CONF_CFLAGS="$CONF_CFLAGS -fsanitize=undefined -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow"
CONF_CXXFLAGS="$CONF_CXXFLAGS -fsanitize=undefined -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow"
fi

dnl check for -search_paths_first linker flag when making dynamic libraries
search_paths_first_flag="-Wl,-search_paths_first -mdynamic-no-pic"
AC_MSG_CHECKING([if the compiler understands $search_paths_first_flag])
Expand Down
Loading