build: Default to DWARF4 in the kernel

gcc 12 defaults to emitting DWARF 5, but this is not yet supported by
our libdwarf and thus by ctfconvert.

Reviewed by:	emaste, imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43837
This commit is contained in:
Mark Johnston 2024-02-11 13:03:23 -05:00
parent 46c599340f
commit 53fba3b984

View file

@ -256,6 +256,14 @@ CFLAGS+= -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clan
.endif
.endif
#
# Some newer toolchains default to DWARF 5, which isn't supported by some build
# tools yet.
#
.if (${CFLAGS:M-g} != "" || ${CFLAGS:M-g[0-3]} != "") && ${CFLAGS:M-gdwarf*} == ""
CFLAGS+= -gdwarf-4
.endif
CFLAGS+= ${CWARNFLAGS:M*} ${CWARNFLAGS.${.IMPSRC:T}}
CFLAGS+= ${CWARNFLAGS.${COMPILER_TYPE}}
CFLAGS+= ${CFLAGS.${COMPILER_TYPE}} ${CFLAGS.${.IMPSRC:T}}