llvm: add a build knob for enabling assertions

For head/, this will remain eternally default-on to maintain the status quo.
For stable/ branches, it should be flipped to default-off to maintain the
status quo.

There's value in being able to flip it one way or the other easily on head
or stable branches, whether you want to gain some performance back on head/
(for machines there's little chance you'll actually hit an assertion) or
potentially diagnose a problem with the version of llvm on an older branch.

Currently, stable branches get the CFLAGS+= -ndebug line uncommented; going
forward, they will instead have the default of LLVM_ASSERTIONS flipped.

Reviewed by:	dim, emaste, re (gjb)
MFC after:	1 week
MFC note:	flip the default of LLVM_ASSERTIONS
Differential Revision:	https://reviews.freebsd.org/D24264
This commit is contained in:
Kyle Evans 2020-04-06 01:27:17 +00:00
parent 9c2065607f
commit 147d7b567f
4 changed files with 8 additions and 1 deletions

View File

@ -22,7 +22,9 @@ CFLAGS+= -D__STDC_CONSTANT_MACROS
CFLAGS+= -D__STDC_FORMAT_MACROS
CFLAGS+= -D__STDC_LIMIT_MACROS
CFLAGS+= -DHAVE_VCS_VERSION_INC
#CFLAGS+= -DNDEBUG
.if ${MK_LLVM_ASSERTIONS} == "no"
CFLAGS+= -DNDEBUG
.endif
TARGET_ARCH?= ${MACHINE_ARCH}
BUILD_ARCH?= ${MACHINE_ARCH}

View File

@ -132,6 +132,7 @@ __DEFAULT_YES_OPTIONS = \
LLD \
LLD_BOOTSTRAP \
LLD_IS_LD \
LLVM_ASSERTIONS \
LLVM_COV \
LLVM_TARGET_ALL \
LOADER_GELI \

View File

@ -0,0 +1,2 @@
.\" $FreeBSD$
Set to disable debugging assertions in LLVM.

View File

@ -0,0 +1,2 @@
.\" $FreeBSD$
Set to enable debugging assertions in LLVM.