Skip to content

Commit

Permalink
configure: allow to run with UB sanitizer
Browse files Browse the repository at this point in the history
Signed-off-by: Antoine Poinsot <[email protected]>
  • Loading branch information
darosior authored and cdecker committed Oct 21, 2020
1 parent c149a88 commit b359469
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ ifneq ($(ASAN),0)
SANITIZER_FLAGS += -fsanitize=address
endif

ifneq ($(UBSAN),0)
SANITIZER_FLAGS += -fsanitize=undefined
endif

ifneq ($(FUZZING), 0)
SANITIZER_FLAGS += -fsanitize=fuzzer-no-link
endif
Expand Down
6 changes: 6 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ set_defaults()
COMPAT=${COMPAT:-1}
STATIC=${STATIC:-0}
ASAN=${ASAN:-0}
UBSAN=${UBSAN:-0}
PYTEST=${PYTEST-$(default_pytest)}
COPTFLAGS=${COPTFLAGS-$(default_coptflags "$DEVELOPER")}
CONFIGURATOR_CC=${CONFIGURATOR_CC-$CC}
Expand Down Expand Up @@ -156,6 +157,8 @@ usage()
echo " Static link sqlite3, gmp and zlib libraries"
usage_with_default "--enable/disable-address-sanitizer" "$ASAN" "enable" "disable"
echo " Compile with address-sanitizer"
usage_with_default "--enable/disable-ub-sanitizer" "$UBSAN" "enable" "disable"
echo " Compile with undefined behaviour sanitizer"
usage_with_default "--enable/disable-fuzzing" "$FUZZING" "enable" "disable"
exit 1
}
Expand Down Expand Up @@ -208,6 +211,8 @@ for opt in "$@"; do
--disable-static) STATIC=0;;
--enable-address-sanitizer) ASAN=1;;
--disable-address-sanitizer) ASAN=0;;
--enable-ub-sanitizer) UBSAN=1;;
--disable-ub-sanitize) UBSAN=0;;
--enable-fuzzing) FUZZING=1;;
--disable-fuzzing) FUZZING=0;;
--help|-h) usage;;
Expand Down Expand Up @@ -413,6 +418,7 @@ add_var COMPAT "$COMPAT" $CONFIG_HEADER
add_var PYTEST "$PYTEST"
add_var STATIC "$STATIC"
add_var ASAN "$ASAN"
add_var UBSAN "$UBSAN"
add_var TEST_NETWORK "$TEST_NETWORK"
add_var HAVE_PYTHON3_MAKO "$HAVE_PYTHON3_MAKO"
add_var SHA256SUM "$SHA256SUM"
Expand Down

0 comments on commit b359469

Please sign in to comment.