From 2a31cd215d9757a8fd6483c58fa965fc7d8aa91b Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Tue, 7 Dec 2021 13:08:02 -0500 Subject: [PATCH] Apply ASAN/UBSAN Makefile check only for build target COMPILER_TYPE is not set during cleandir and perhaps other non-build targets, and a build with ASAN or UBSAN enabled failed with an error reporting that runtime libraries could not be built. PR: 260099 Reviewed by: dim Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32805 --- lib/Makefile | 2 +- share/mk/bsd.sanitizer.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Makefile b/lib/Makefile index 2cba5feaee19..bd28b974c673 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -185,7 +185,7 @@ SUBDIR.${MK_STATS}+= libstats ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "i386" || \ ${MACHINE_CPUARCH} == "powerpc") _libclang_rt= libclang_rt -.elif ${MK_ASAN} != "no" || ${MK_UBSAN} != "no" +.elif (${MK_ASAN} != "no" || ${MK_UBSAN} != "no") && make(all) .error "Requested build with sanitizers but cannot build runtime libraries!" .endif diff --git a/share/mk/bsd.sanitizer.mk b/share/mk/bsd.sanitizer.mk index 567b1da2afde..6b79bc467404 100644 --- a/share/mk/bsd.sanitizer.mk +++ b/share/mk/bsd.sanitizer.mk @@ -23,7 +23,7 @@ _use_sanitizers= yes .endif # ${MK_UBSAN} == "yes" .if !defined(BOOTSTRAPPING) && ${_use_sanitizers} != "no" && \ - ${COMPILER_TYPE} != "clang" + ${COMPILER_TYPE} != "clang" && make(all) .error "Sanitizer instrumentation currently only supported with clang" .endif