aboutsummaryrefslogtreecommitdiffstats
path: root/share/mk/bsd.opts.mk
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2020-11-10 19:15:13 +0000
committerBrooks Davis <brooks@FreeBSD.org>2020-11-10 19:15:13 +0000
commite268fd0a029e620a0cc85c9437ae5dc35a00c699 (patch)
tree46ba7bf0f2d8c42e2827359200519c2ac2474af2 /share/mk/bsd.opts.mk
parent9ebe945bd791f25fe5f4774205cbf07eabca348b (diff)
Support initializing stack variables on function entry
There are two options: - WITH_INIT_ALL_ZERO: Zero all variables on the stack. - WITH_INIT_ALL_PATTERN: Initialize variables with well-defined patterns. The exact pattern are a compiler implementation detail and vary by type. They are somewhat documented in the LLVM commit message: https://reviews.llvm.org/rL349442 I've used WITH_INIT_ALL_* to match Microsoft's InitAll feature rather than naming them after the LLVM specific compiler flags. In a range of consumer products, options like these are used in both debug and production builds with debugs builds using patterns (intended to provoke crashes on use of uninitialized values) and production using zeros (deemed more likely to lead to harmless misbehavior or NULL-pointer dereferences). Reviewed by: emaste Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27131
Diffstat (limited to 'share/mk/bsd.opts.mk')
-rw-r--r--share/mk/bsd.opts.mk6
1 files changed, 6 insertions, 0 deletions
diff --git a/share/mk/bsd.opts.mk b/share/mk/bsd.opts.mk
index c9121c359af9..98e949731e60 100644
--- a/share/mk/bsd.opts.mk
+++ b/share/mk/bsd.opts.mk
@@ -71,6 +71,8 @@ __DEFAULT_NO_OPTIONS = \
BIND_NOW \
CCACHE_BUILD \
CTF \
+ INIT_ALL_PATTERN \
+ INIT_ALL_ZERO \
INSTALL_AS_USER \
PIE \
RETPOLINE \
@@ -85,6 +87,10 @@ __DEFAULT_DEPENDENT_OPTIONS = \
.include <bsd.mkopt.mk>
+.if ${MK_INIT_ALL_PATTERN} == "yes" && ${MK_INIT_ALL_ZERO} == "yes"
+.error WITH_INIT_ALL_PATTERN and WITH_INIT_ALL_ZERO are mutually exclusive.
+.endif
+
#
# Supported NO_* options (if defined, MK_* will be forced to "no",
# regardless of user's setting).