Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/share/mk Introduce MKLIBCSANITIZER in the share/mk rules
details: https://anonhg.NetBSD.org/src/rev/449c8d7058b4
branches: trunk
changeset: 363406:449c8d7058b4
user: kamil <kamil%NetBSD.org@localhost>
date: Wed Jul 25 23:34:25 2018 +0000
description:
Introduce MKLIBCSANITIZER in the share/mk rules
Add flags that are required to build a program and a dynamically loaded
library.
Propagade LIBCSANITIZERFLAGS to CFLAGS and CXXFLAGS.
LDFLAGS is not changed on purpose, as a libcsanitizer is inside libc
and no external dependencies are needed.
Register NOLIBCSANITIZER, as certain distribution parts will need to be
skipped.
diffstat:
share/mk/bsd.lib.mk | 4 ++--
share/mk/bsd.own.mk | 14 ++++++++++----
share/mk/bsd.prog.mk | 6 +++---
share/mk/bsd.sys.mk | 8 +++++++-
4 files changed, 22 insertions(+), 10 deletions(-)
diffs (95 lines):
diff -r f600cadcb427 -r 449c8d7058b4 share/mk/bsd.lib.mk
--- a/share/mk/bsd.lib.mk Wed Jul 25 23:30:22 2018 +0000
+++ b/share/mk/bsd.lib.mk Wed Jul 25 23:34:25 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.lib.mk,v 1.376 2018/06/25 17:58:36 kamil Exp $
+# $NetBSD: bsd.lib.mk,v 1.377 2018/07/25 23:34:25 kamil Exp $
# @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94
.include <bsd.init.mk>
@@ -157,7 +157,7 @@
PICFLAGS ?= -fPIC
.if ${MKPICLIB} != "no"
-CSHLIBFLAGS+= ${PICFLAGS} ${SANITIZERFLAGS}
+CSHLIBFLAGS+= ${PICFLAGS} ${SANITIZERFLAGS} ${LIBCSANITIZERFLAGS}
.endif
.if defined(CSHLIBFLAGS) && !empty(CSHLIBFLAGS)
diff -r f600cadcb427 -r 449c8d7058b4 share/mk/bsd.own.mk
--- a/share/mk/bsd.own.mk Wed Jul 25 23:30:22 2018 +0000
+++ b/share/mk/bsd.own.mk Wed Jul 25 23:34:25 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.own.mk,v 1.1071 2018/07/18 02:18:45 christos Exp $
+# $NetBSD: bsd.own.mk,v 1.1072 2018/07/25 23:34:25 kamil Exp $
# This needs to be before bsd.init.mk
.if defined(BSD_MK_COMPAT_FILE)
@@ -933,9 +933,9 @@
# including bsd.own.mk.
#
.for var in \
- NOCRYPTO NODOC NOHTML NOINFO NOLINKLIB NOLINT NOMAN NONLS NOOBJ NOPIC \
- NOPICINSTALL NOPROFILE NOSHARE NOSTATICLIB NODEBUGLIB NOSANITIZER \
- NORELRO
+ NOCRYPTO NODOC NOHTML NOINFO NOLIBCSANITIZER NOLINKLIB NOLINT NOMAN \
+ NONLS NOOBJ NOPIC NOPICINSTALL NOPROFILE NOSHARE NOSTATICLIB \
+ NODEBUGLIB NOSANITIZER NORELRO
.if defined(${var})
MK${var:S/^NO//}:= no
.endif
@@ -1093,6 +1093,12 @@
USE_SANITIZER?= address
#
+# Sanitizers implemented in libc, only "undefined" is supported
+#
+MKLIBCSANITIZER?= no
+USE_LIBCSANITIZER?= undefined
+
+#
# Exceptions to the above:
#
diff -r f600cadcb427 -r 449c8d7058b4 share/mk/bsd.prog.mk
--- a/share/mk/bsd.prog.mk Wed Jul 25 23:30:22 2018 +0000
+++ b/share/mk/bsd.prog.mk Wed Jul 25 23:34:25 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.prog.mk,v 1.316 2018/07/12 10:46:41 maxv Exp $
+# $NetBSD: bsd.prog.mk,v 1.317 2018/07/25 23:34:25 kamil Exp $
# @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94
.ifndef HOSTPROG
@@ -9,8 +9,8 @@
##### Sanitizer specific flags.
-CFLAGS+= ${SANITIZERFLAGS}
-CXXFLAGS+= ${SANITIZERFLAGS}
+CFLAGS+= ${SANITIZERFLAGS} ${LIBCSANITIZERFLAGS}
+CXXFLAGS+= ${SANITIZERFLAGS} ${LIBCSANITIZERFLAGS}
LDFLAGS+= ${SANITIZERFLAGS}
# Rename the local function definitions to not conflict with libc/rt/pthread/m.
diff -r f600cadcb427 -r 449c8d7058b4 share/mk/bsd.sys.mk
--- a/share/mk/bsd.sys.mk Wed Jul 25 23:30:22 2018 +0000
+++ b/share/mk/bsd.sys.mk Wed Jul 25 23:34:25 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.sys.mk,v 1.284 2018/06/24 19:35:12 kamil Exp $
+# $NetBSD: bsd.sys.mk,v 1.285 2018/07/25 23:34:25 kamil Exp $
#
# Build definitions used for NetBSD source tree builds.
@@ -146,6 +146,12 @@
SANITIZERFLAGS= # empty
.endif
+.if ${MKLIBCSANITIZER:Uno} == "yes"
+LIBCSANITIZERFLAGS+= -fsanitize=${USE_LIBCSANITIZER}
+LIBCSANITIZERFLAGS+= -fno-sanitize=vptr # Unsupported in micro-UBSan
+.else
+LIBCSANITIZERFLAGS= # empty
+.endif
CWARNFLAGS+= ${CWARNFLAGS.${ACTIVE_CC}}
Home |
Main Index |
Thread Index |
Old Index