Unify ASan options in make builds

Use a common set of options when building with Asan without CMake.
This commit is contained in:
Gilles Peskine 2019-10-21 17:11:33 +02:00 committed by Simon Butcher
parent 6b5e60c26c
commit 3ccb7f18e0

View file

@ -137,6 +137,9 @@ pre_initialize_variables () {
export MAKEFLAGS="-j" export MAKEFLAGS="-j"
fi fi
# CFLAGS and LDFLAGS for Asan builds that don't use CMake
ASAN_CFLAGS='-Werror -Wall -Wextra -fsanitize=address'
# Gather the list of available components. These are the functions # Gather the list of available components. These are the functions
# defined in this script whose name starts with "component_". # defined in this script whose name starts with "component_".
# Parse the script with sed, because in sh there is no way to list # Parse the script with sed, because in sh there is no way to list
@ -1387,7 +1390,7 @@ component_test_m32_o0 () {
# Build once with -O0, to compile out the i386 specific inline assembly # Build once with -O0, to compile out the i386 specific inline assembly
msg "build: i386, make, gcc -O0 (ASan build)" # ~ 30s msg "build: i386, make, gcc -O0 (ASan build)" # ~ 30s
scripts/config.pl full scripts/config.pl full
make CC=gcc PTHREAD=1 CFLAGS='-O0 -Werror -Wall -Wextra -m32 -fsanitize=address' LDFLAGS='-m32' make CC=gcc PTHREAD=1 CFLAGS="$ASAN_CFLAGS -m32 -O0" LDFLAGS="-m32 $ASAN_CFLAGS"
msg "test: i386, make, gcc -O0 (ASan build)" msg "test: i386, make, gcc -O0 (ASan build)"
make test make test
@ -1403,7 +1406,7 @@ component_test_m32_o1 () {
# Build again with -O1, to compile in the i386 specific inline assembly # Build again with -O1, to compile in the i386 specific inline assembly
msg "build: i386, make, gcc -O1 (ASan build)" # ~ 30s msg "build: i386, make, gcc -O1 (ASan build)" # ~ 30s
scripts/config.pl full scripts/config.pl full
make CC=gcc PTHREAD=1 CFLAGS='-O1 -Werror -Wall -Wextra -m32 -fsanitize=address' LDFLAGS='-m32' make CC=gcc PTHREAD=1 CFLAGS="$ASAN_CFLAGS -m32 -O1" LDFLAGS="-m32 $ASAN_CFLAGS"
msg "test: i386, make, gcc -O1 (ASan build)" msg "test: i386, make, gcc -O1 (ASan build)"
make test make test