Mon Mar 9 00:03:00 2020 UTC ()
Build RUMP with -fno-delete-null-pointer-checks on all compilers

no-delete-null-pointer-checks is required in Clang/LLVM at least for
NULL + 0 operations that trigger LLVM UBSan and could be miscompiled.


(kamil)
diff -r1.125 -r1.126 src/sys/rump/Makefile.rump

cvs diff -r1.125 -r1.126 src/sys/rump/Makefile.rump (expand / switch to unified diff)

--- src/sys/rump/Makefile.rump 2020/02/20 22:52:10 1.125
+++ src/sys/rump/Makefile.rump 2020/03/09 00:03:00 1.126
@@ -1,38 +1,40 @@ @@ -1,38 +1,40 @@
1# $NetBSD: Makefile.rump,v 1.125 2020/02/20 22:52:10 joerg Exp $ 1# $NetBSD: Makefile.rump,v 1.126 2020/03/09 00:03:00 kamil Exp $
2# 2#
3 3
4.if !defined(_RUMP_MK) 4.if !defined(_RUMP_MK)
5_RUMP_MK= #defined 5_RUMP_MK= #defined
6 6
7WARNS?= 3 # XXX: src/sys won't compile with -Wsign-compare yet 7WARNS?= 3 # XXX: src/sys won't compile with -Wsign-compare yet
8NOLINT= # kernel code 8NOLINT= # kernel code
9 9
10.include <bsd.own.mk> 10.include <bsd.own.mk>
11 11
12# Use NetBSD kernel ABI by default on x86 archs. Performance-related 12# Use NetBSD kernel ABI by default on x86 archs. Performance-related
13# compile-time options may override this at a later date. 13# compile-time options may override this at a later date.
14.if (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64") 14.if (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64")
15_RUMP_NATIVEABI= yes 15_RUMP_NATIVEABI= yes
16.else 16.else
17_RUMP_NATIVEABI= no 17_RUMP_NATIVEABI= no
18CPPFLAGS:= -I${RUMPTOP}/include ${CPPFLAGS} 18CPPFLAGS:= -I${RUMPTOP}/include ${CPPFLAGS}
19CPPFLAGS+= -D_RUMPKERNEL -I${RUMPTOP}/librump/rumpkern 19CPPFLAGS+= -D_RUMPKERNEL -I${RUMPTOP}/librump/rumpkern
20.endif 20.endif
21 21
22# We are compiling the kernel code with no-delete-null-pointer-checks, 22# We are compiling the kernel code with no-delete-null-pointer-checks,
23# and compiling without it, causes issues at least on sh3 by adding 23# and compiling without it, causes issues at least on sh3 by adding
24# aborts after kern_assert on NULL pointer checks. 24# aborts after kern_assert on NULL pointer checks.
25CFLAGS+= ${${ACTIVE_CC} == "gcc":? -fno-delete-null-pointer-checks :} 25# no-delete-null-pointer-checks is required in Clang/LLVM at least for
 26# NULL + 0 operations that trigger LLVM UBSan and could be miscompiled.
 27CFLAGS+= -fno-delete-null-pointer-checks
26 28
27# Define baseline cpu for mips ports, required for 29# Define baseline cpu for mips ports, required for
28# rumpcomp_sync_icache() hypercall. 30# rumpcomp_sync_icache() hypercall.
29.if !empty(MACHINE_ARCH:Mmips*) 31.if !empty(MACHINE_ARCH:Mmips*)
30.if !empty(MACHINE_ARCH:Mmips64*) 32.if !empty(MACHINE_ARCH:Mmips64*)
31CPPFLAGS+= -DMIPS64=1 33CPPFLAGS+= -DMIPS64=1
32.else 34.else
33CPPFLAGS+= -DMIPS1=1 35CPPFLAGS+= -DMIPS1=1
34.endif 36.endif
35.endif 37.endif
36 38
37# which NetBSD compat to build 39# which NetBSD compat to build
38RUMP_NBCOMPAT?=default 40RUMP_NBCOMPAT?=default