diff options
author | H. Peter Anvin <hpa@linux.intel.com> | 2017-10-11 16:47:59 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2017-10-11 16:47:59 -0700 |
commit | 53259e8aafee04b0e984fc3a4ccaaf2279cadfca (patch) | |
tree | d02c73be5ed3d4fddc1e1033372869be0af66618 /configure.ac | |
parent | 89215e9e371b825f589cb9ebd220a5d97c8f2dc0 (diff) | |
download | nasm-53259e8aafee04b0e984fc3a4ccaaf2279cadfca.tar.gz |
configure.ac: more debugging options
Make -O0 imply -fno-omit-frame-pointer
Add options to compile/link with AddressSanitizer and
UndefinedSanitizer.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac index 37f51afd..d6b61b49 100644 --- a/configure.ac +++ b/configure.ac @@ -29,14 +29,19 @@ dnl to either -O3 (normal) or -O0 (for debugging) PA_ARG_DISABLED([optimization], [compile without optimization (-O0) to help debugging], [pa_optimize=-O0], [pa_optimize=-O3]) -AS_IF([test x"$pa_init_cflags" = x], - [CFLAGS=`echo "$CFLAGS" | sed -e "s/-O2/$pa_optimize/"`]) dnl Compile and link with dwarf debug PA_ARG_ENABLED([gdb], [disable optimization and compile with extra debug information for GDB debugger], - [CFLAGS=`echo "$CFLAGS" | sed -e "s/\(-O2\|-O3\)/-O0/"` - PA_ADD_CLDFLAGS([-ggdb3])]) + [pa_optimize='-O0' + PA_ADD_CFLAGS([-ggdb3]) + ]) + +AS_IF([test x"$pa_init_cflags" = x], + [CFLAGS=`echo "$CFLAGS" | sed -e "s/-O2/$pa_optimize/"`]) + +AS_IF([test x"$pa_optimize" = "x-O0"], + [PA_ADD_CFLAGS([-fno-omit-frame-pointer])]) dnl Check for library extension PA_LIBEXT @@ -179,7 +184,7 @@ PA_FUNC_ATTRIBUTE(pure) PA_FUNC_ATTRIBUTE_ERROR dnl -dnl support function sections +dnl support function sections (if available) dnl PA_ARG_ENABLED([sections], [compile with function/data section support], @@ -187,6 +192,7 @@ PA_ARG_ENABLED([sections], PA_ADD_CLDFLAGS([-fdata-sections]) PA_ADD_CLDFLAGS([-Wl,--gc-sections])], []) + dnl dnl support LTO dnl @@ -201,6 +207,15 @@ PA_ARG_ENABLED([lto], AC_CHECK_PROGS(CC_RANLIB, [${ccbase}-ranlib], [$ac_cv_prog_RANLIB]) RANLIB="$CC_RANLIB"], []) +dnl +dnl support sanitizers (if available) +dnl +PA_ARG_ENABLED([sanitizer], + [compile with sanitizers enabled], + [PA_ADD_CFLAGS([-fno-omit-frame-pointer]) + PA_ADD_CLDFLAGS([-fsanitize=address]) + PA_ADD_CLDFLAGS([-fsanitize=undefined])]) + dnl If we have gcc, add appropriate code cleanliness options PA_ADD_CFLAGS([-W]) PA_ADD_CFLAGS([-Wall]) |