From 2e840fb2ab202e44090b089330805a8b4aca1a26 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 6 Nov 2022 16:50:28 +0200 Subject: [PATCH] tests: Fix CC and CFLAGS default processing for fuzzing "make LIBFUZZER=y" was supposed to set CC and CFLAGS to working values by default if not overridden by something external. That did not seem to work since the defaults from the other build system components ended up setting these variables before the checks here. Fix this by replacing the known default values for non-fuzzing builds. Signed-off-by: Jouni Malinen --- tests/fuzzing/rules.include | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/fuzzing/rules.include b/tests/fuzzing/rules.include index e2cf577af..04f0a3e0c 100644 --- a/tests/fuzzing/rules.include +++ b/tests/fuzzing/rules.include @@ -5,10 +5,17 @@ FUZZ_CFLAGS = ifdef LIBFUZZER CC ?= clang +ifeq ($(CC),cc) +CC = clang +endif #FUZZ_FLAGS ?= -fsanitize=fuzzer,address,signed-integer-overflow,unsigned-integer-overflow FUZZ_FLAGS ?= -fsanitize=fuzzer,address ifndef CFLAGS FUZZ_CFLAGS += $(FUZZ_FLAGS) +else +ifeq ($(CFLAGS),-MMD -O2 -Wall -g) +FUZZ_CFLAGS += $(FUZZ_FLAGS) +endif endif endif