From: Roy Marples Date: Mon, 4 Nov 2019 19:56:51 +0000 (+0000) Subject: build: Check compiler actually supports address sanitisation. X-Git-Tag: v8.1.2~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0654ec3d63beec42135fee764f43949248a60bc8;p=thirdparty%2Fdhcpcd.git build: Check compiler actually supports address sanitisation. --- diff --git a/configure b/configure index 146aedec..bbc71db8 100755 --- a/configure +++ b/configure @@ -373,12 +373,24 @@ if [ -z "$DEBUG" -a -d .git ]; then DEBUG=yes fi if [ -n "$DEBUG" -a "$DEBUG" != no -a "$DEBUG" != false ]; then + printf "Testing compiler supports address sanitisation ..." + cat <_test.c +int main(void) { + return 0; +} +EOF + if $CC -fsanitize=address _test.c -o _test 2>&3; then + echo "yes" + echo "# Compiler supports address sanitisation" >>$CONFIG_MK + echo "CFLAGS+= -fsanitize=address" >>$CONFIG_MK + echo "LDFLAGS+= -fsanitize=address" >>$CONFIG_MK + else + echo "no" + fi + rm -rf _test.c _test + echo "Adding debugging CFLAGS" cat <>$CONFIG_MK -# Enforce address sanitization -CFLAGS+= -fsanitize=address -LDFLAGS+= -fsanitize=address - CFLAGS+= -g -Wall -Wextra CFLAGS+= -Wmissing-prototypes -Wmissing-declarations CFLAGS+= -Wmissing-format-attribute -Wnested-externs