git: f0f93607eea3 - stable/14 - conf: Do not set -fno-sanitize-memory-param-retval for old compilers

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Thu, 18 Jan 2024 15:52:38 UTC
The branch stable/14 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=f0f93607eea35925145a98fef0608343a4f1ca56

commit f0f93607eea35925145a98fef0608343a4f1ca56
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-01-11 16:42:47 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-01-18 15:52:25 +0000

    conf: Do not set -fno-sanitize-memory-param-retval for old compilers
    
    The option was introduced in LLVM 16.
    
    Fixes:  b6c653c97463 ("kmsan: Set -fno-sanitize-memory-param-retval for now")
    MFC after:      1 week
    Sponsored by:   Klara, Inc.
    Sponsored by:   Juniper Networks, Inc.
    
    (cherry picked from commit d682a91726d72eaf7ba8dddeb4d9ce161ab8b93a)
---
 sys/conf/kern.pre.mk | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk
index 158175eb6899..6bf647f5c3ea 100644
--- a/sys/conf/kern.pre.mk
+++ b/sys/conf/kern.pre.mk
@@ -125,8 +125,10 @@ KMSAN_ENABLED!= grep KMSAN opt_global.h || true ; echo
 # Disable -fno-sanitize-memory-param-retval until interceptors have been
 # updated to work properly with it.
 SAN_CFLAGS+=	-DSAN_NEEDS_INTERCEPTORS -DSAN_INTERCEPTOR_PREFIX=kmsan \
-		-fsanitize=kernel-memory \
-		-fno-sanitize-memory-param-retval
+		-fsanitize=kernel-memory
+.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 160000
+SAN_CFLAGS+=	-fno-sanitize-memory-param-retval
+.endif
 .endif
 
 KUBSAN_ENABLED!=	grep KUBSAN opt_global.h || true ; echo