diff options
| author | Roy Marples <roy@marples.name> | 2019-11-04 19:56:51 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2019-11-04 19:56:51 +0000 |
| commit | a9b87bc9660f2516a3e4a2febfda24036c4b6e79 (patch) | |
| tree | 26bce2e395ec608e3f2cc24d48ca047dfb3c5365 /configure | |
| parent | 8c94248fe45c03f0e03f418f5d4bf2dea68cb41f (diff) | |
| download | dhcpcd-a9b87bc9660f2516a3e4a2febfda24036c4b6e79.tar.xz | |
build: Check compiler actually supports address sanitisation.
Diffstat (limited to 'configure')
| -rwxr-xr-x | configure | 20 |
1 files changed, 16 insertions, 4 deletions
@@ -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 <<EOF >_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 <<EOF >>$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 |
