mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-01 14:14:56 +00:00
Add INIT_ALL build option
This option replaces WITH_INIT_ALL_PATTERN and WITH_INIT_ALL_ZERO with INIT_ALL=pattern and INIT_ALL=zero respectively. As these are relatively rarely used options no backwards compatibility is implemented. Reviewed by: emaste Relnotes: yes Differential Revision: https://reviews.freebsd.org/D41675
This commit is contained in:
parent
09e32b2fdd
commit
2befa269b8
4
UPDATING
4
UPDATING
|
@ -27,6 +27,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 15.x IS SLOW:
|
|||
world, or to merely disable the most expensive debugging functionality
|
||||
at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".)
|
||||
|
||||
20230901:
|
||||
The WITH_INIT_ALL_PATTERN and WITH_INIT_ALL_ZERO build option have
|
||||
been replaced by INIT_ALL=pattern and INIT_ALL=zero respectively.
|
||||
|
||||
20230824:
|
||||
FreeBSD 15.0-CURRENT.
|
||||
|
||||
|
|
|
@ -101,23 +101,16 @@ LDFLAGS+= -Wl,-zretpolineplt
|
|||
LDFLAGS.bfd+= -Wl,-znoexecstack
|
||||
|
||||
# Initialize stack variables on function entry
|
||||
.if ${MK_INIT_ALL_ZERO} == "yes"
|
||||
.if ${OPT_INIT_ALL} != "none"
|
||||
.if ${COMPILER_FEATURES:Minit-all}
|
||||
CFLAGS+= -ftrivial-auto-var-init=zero
|
||||
CXXFLAGS+= -ftrivial-auto-var-init=zero
|
||||
.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} < 160000
|
||||
CFLAGS+= -ftrivial-auto-var-init=${OPT_INIT_ALL}
|
||||
CXXFLAGS+= -ftrivial-auto-var-init=${OPT_INIT_ALL}
|
||||
.if ${OPT_INIT_ALL} == "zero" && ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} < 160000
|
||||
CFLAGS+= -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
|
||||
CXXFLAGS+= -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
|
||||
.endif
|
||||
.else
|
||||
.warning InitAll (zeros) requested but not supported by compiler
|
||||
.endif
|
||||
.elif ${MK_INIT_ALL_PATTERN} == "yes"
|
||||
.if ${COMPILER_FEATURES:Minit-all}
|
||||
CFLAGS+= -ftrivial-auto-var-init=pattern
|
||||
CXXFLAGS+= -ftrivial-auto-var-init=pattern
|
||||
.else
|
||||
.warning InitAll (pattern) requested but not supported by compiler
|
||||
.warning INIT_ALL (${OPT_INIT_ALL}) requested but not supported by compiler
|
||||
.endif
|
||||
.endif
|
||||
|
||||
|
|
|
@ -75,8 +75,6 @@ __DEFAULT_NO_OPTIONS = \
|
|||
BIND_NOW \
|
||||
CCACHE_BUILD \
|
||||
CTF \
|
||||
INIT_ALL_PATTERN \
|
||||
INIT_ALL_ZERO \
|
||||
INSTALL_AS_USER \
|
||||
MANSPLITPKG \
|
||||
PROFILE \
|
||||
|
@ -103,14 +101,16 @@ __DEFAULT_NO_OPTIONS+= PIE
|
|||
__DEFAULT_YES_OPTIONS+=PIE
|
||||
.endif
|
||||
|
||||
__SINGLE_OPTIONS = \
|
||||
INIT_ALL
|
||||
|
||||
__INIT_ALL_OPTIONS= none pattern zero
|
||||
__INIT_ALL_DEFAULT= none
|
||||
|
||||
.-include <local.opts.mk>
|
||||
|
||||
.include <bsd.mkopt.mk>
|
||||
|
||||
.if ${MK_INIT_ALL_PATTERN} == "yes" && ${MK_INIT_ALL_ZERO} == "yes"
|
||||
.warning 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).
|
||||
|
|
|
@ -71,23 +71,16 @@ LDFLAGS+= -Wl,-zretpolineplt
|
|||
LDFLAGS.bfd+= -Wl,-znoexecstack
|
||||
|
||||
# Initialize stack variables on function entry
|
||||
.if ${MK_INIT_ALL_ZERO} == "yes"
|
||||
.if ${OPT_INIT_ALL} != "none"
|
||||
.if ${COMPILER_FEATURES:Minit-all}
|
||||
CFLAGS+= -ftrivial-auto-var-init=zero
|
||||
CXXFLAGS+= -ftrivial-auto-var-init=zero
|
||||
.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} < 160000
|
||||
CFLAGS+= -ftrivial-auto-var-init=${OPT_INIT_ALL}
|
||||
CXXFLAGS+= -ftrivial-auto-var-init=${OPT_INIT_ALL}
|
||||
.if ${OPT_INIT_ALL} == "zero" && ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} < 160000
|
||||
CFLAGS+= -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
|
||||
CXXFLAGS+= -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
|
||||
.endif
|
||||
.else
|
||||
.warning InitAll (zeros) requested but not supported by compiler
|
||||
.endif
|
||||
.elif ${MK_INIT_ALL_PATTERN} == "yes"
|
||||
.if ${COMPILER_FEATURES:Minit-all}
|
||||
CFLAGS+= -ftrivial-auto-var-init=pattern
|
||||
CXXFLAGS+= -ftrivial-auto-var-init=pattern
|
||||
.else
|
||||
.warning InitAll (pattern) requested but not supported by compiler
|
||||
.warning INIT_ALL (${OPT_INIT_ALL}) requested but not supported by compiler
|
||||
.endif
|
||||
.endif
|
||||
|
||||
|
|
|
@ -242,20 +242,14 @@ CFLAGS+= -mretpoline
|
|||
#
|
||||
# Initialize stack variables on function entry
|
||||
#
|
||||
.if ${MK_INIT_ALL_ZERO} == "yes"
|
||||
.if ${OPT_INIT_ALL} != "none"
|
||||
.if ${COMPILER_FEATURES:Minit-all}
|
||||
CFLAGS+= -ftrivial-auto-var-init=zero
|
||||
.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} < 160000
|
||||
CFLAGS+= -ftrivial-auto-var-init=${OPT_INIT_ALL}
|
||||
.if ${OPT_INIT_ALL} == "zero" && ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} < 160000
|
||||
CFLAGS+= -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
|
||||
.endif
|
||||
.else
|
||||
.warning InitAll (zeros) requested but not supported by compiler
|
||||
.endif
|
||||
.elif ${MK_INIT_ALL_PATTERN} == "yes"
|
||||
.if ${COMPILER_FEATURES:Minit-all}
|
||||
CFLAGS+= -ftrivial-auto-var-init=pattern
|
||||
.else
|
||||
.warning InitAll (pattern) requested but not support by compiler
|
||||
.warning INIT_ALL (${OPT_INIT_ALL}) requested but not supported by compiler
|
||||
.endif
|
||||
.endif
|
||||
|
||||
|
|
|
@ -57,8 +57,6 @@ __DEFAULT_YES_OPTIONS = \
|
|||
__DEFAULT_NO_OPTIONS = \
|
||||
BHYVE_SNAPSHOT \
|
||||
EXTRA_TCP_STACKS \
|
||||
INIT_ALL_PATTERN \
|
||||
INIT_ALL_ZERO \
|
||||
KERNEL_RETPOLINE \
|
||||
RATELIMIT \
|
||||
REPRODUCIBLE_BUILD \
|
||||
|
@ -72,12 +70,6 @@ __DEFAULT_NO_OPTIONS = \
|
|||
# Kernel config files are unaffected, though some targets can be
|
||||
# affected by KERNEL_SYMBOLS, FORMAT_EXTENSIONS, CTF and SSP.
|
||||
|
||||
# Things that don't work based on the CPU
|
||||
.if ${MACHINE} == "amd64"
|
||||
# PR251083 conflict between INIT_ALL_ZERO and ifunc memset
|
||||
BROKEN_OPTIONS+= INIT_ALL_ZERO
|
||||
.endif
|
||||
|
||||
# Broken on 32-bit arm, kernel module compile errors
|
||||
.if ${MACHINE_CPUARCH} == "arm"
|
||||
BROKEN_OPTIONS+= OFED
|
||||
|
@ -99,6 +91,16 @@ __DEFAULT_NO_OPTIONS += FDT
|
|||
__DEFAULT_YES_OPTIONS += FDT
|
||||
.endif
|
||||
|
||||
__SINGLE_OPTIONS = \
|
||||
INIT_ALL
|
||||
|
||||
__INIT_ALL_OPTIONS= none pattern zero
|
||||
__INIT_ALL_DEFAULT= none
|
||||
.if ${MACHINE} == "amd64"
|
||||
# PR251083 conflict between INIT_ALL_ZERO and ifunc memset
|
||||
BROKEN_SINGLE_OPTIONS+= INIT_ALL zero none
|
||||
.endif
|
||||
|
||||
# expanded inline from bsd.mkopt.mk to avoid share/mk dependency
|
||||
|
||||
# Those that default to yes
|
||||
|
|
21
tools/build/options/INIT_ALL
Normal file
21
tools/build/options/INIT_ALL
Normal file
|
@ -0,0 +1,21 @@
|
|||
Control default initialization of stack variables in C and C++ code.
|
||||
Options other than
|
||||
.Li none
|
||||
require the Clang compiler or GCC 12.0 or later.
|
||||
The default value is
|
||||
.Li none .
|
||||
Valid values are:
|
||||
.Bl -tag -width indent
|
||||
.It Li none
|
||||
Do not initialize stack variables (standard C/C++ behavior).
|
||||
.It Li pattern
|
||||
Build the base system or kernel with stack variables initialized to
|
||||
.Pq compiler defined
|
||||
debugging patterns on function entry.
|
||||
.It Li zero
|
||||
Build the base system or kernel with stack variables initialized
|
||||
to zero on function entry.
|
||||
This value is converted to
|
||||
.Li none
|
||||
for amd64 kernel builds due to incompatability with ifunc memset.
|
||||
.El
|
|
@ -1,4 +0,0 @@
|
|||
Build the base system or kernel with stack variables initialized to
|
||||
.Pq compiler defined
|
||||
debugging patterns on function entry.
|
||||
This option requires the clang compiler.
|
|
@ -1,3 +0,0 @@
|
|||
Build the base system or kernel with stack variables initialized
|
||||
to zero on function entry.
|
||||
This option requires that the clang compiler be used.
|
Loading…
Reference in a new issue