From e3709cfe6a2a1f7d345db2870be175c9cf2a8979 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Wed, 8 Jun 2022 17:02:24 -0400 Subject: [PATCH] Add SPLIT_KERNEL_DEBUG knob Prior to 9b6edf364eb0 WITHOUT_KERNEL_SYMBOLS split kernel debug data into standalone debug files at build time, but did not install those files. As of 9b6edf364eb0 it stopped splitting the debug data, leaving it in the kernel and modules (the default kernel configs include DEBUG=-g). Revert 9b6edf364eb0 and introduce a new build-time SPLIT_KERNEL_DEBUG knob, as some people rely on the pre-9b6edf364eb0 WITHOUT_KERNEL_SYMBOLS behaviour and that was imp's original intent. PR: 264433 Reviewed by: eugen, imp MFC after: 3 weeks Relnotes: yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35437 --- sys/conf/kern.opts.mk | 5 +++++ sys/conf/kmod.mk | 4 ++-- tools/build/options/WITHOUT_KERNEL_SYMBOLS | 5 ++--- tools/build/options/WITHOUT_SPLIT_KERNEL_DEBUG | 3 +++ 4 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 tools/build/options/WITHOUT_SPLIT_KERNEL_DEBUG diff --git a/sys/conf/kern.opts.mk b/sys/conf/kern.opts.mk index 077009baebf0..b47b71cdce22 100644 --- a/sys/conf/kern.opts.mk +++ b/sys/conf/kern.opts.mk @@ -42,6 +42,7 @@ __DEFAULT_YES_OPTIONS = \ IPFILTER \ IPSEC_SUPPORT \ ISCSI \ + SPLIT_KERNEL_DEBUG \ KERNEL_SYMBOLS \ NETGRAPH \ OFED \ @@ -178,6 +179,10 @@ MK_${var}_SUPPORT:= yes .endif .endfor +.if ${MK_SPLIT_KERNEL_DEBUG} == "no" +MK_KERNEL_SYMBOLS:= no +.endif + # Some modules only compile successfully if option FDT is set, due to #ifdef FDT # wrapped around declarations. Module makefiles can optionally compile such # things using .if !empty(OPT_FDT) diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk index 2ab8fb576472..63041480eca9 100644 --- a/sys/conf/kmod.mk +++ b/sys/conf/kmod.mk @@ -217,7 +217,7 @@ OBJS+= ${SRCS:N*.h:R:S/$/.o/g} PROG= ${KMOD}.ko .endif -.if !defined(DEBUG_FLAGS) || ${MK_KERNEL_SYMBOLS} == "no" +.if !defined(DEBUG_FLAGS) || ${MK_SPLIT_KERNEL_DEBUG} == "no" FULLPROG= ${PROG} .else FULLPROG= ${PROG}.full @@ -321,7 +321,7 @@ ${_ILINKS}: CLEANFILES+= ${PROG} ${KMOD}.kld ${OBJS} -.if defined(DEBUG_FLAGS) && ${MK_KERNEL_SYMBOLS} != "no" +.if defined(DEBUG_FLAGS) && ${MK_SPLIT_KERNEL_DEBUG} != "no" CLEANFILES+= ${FULLPROG} ${PROG}.debug .endif diff --git a/tools/build/options/WITHOUT_KERNEL_SYMBOLS b/tools/build/options/WITHOUT_KERNEL_SYMBOLS index 7837744cf399..c56359d9fa6b 100644 --- a/tools/build/options/WITHOUT_KERNEL_SYMBOLS +++ b/tools/build/options/WITHOUT_KERNEL_SYMBOLS @@ -1,4 +1,3 @@ .\" $FreeBSD$ -Do not build or install standalone kernel debug symbol files. -Debug data (if enabled by the kernel configuration file) -will be included in the kernel and modules. +Do not install standalone kernel debug symbol files. +This option has no effect at build time. diff --git a/tools/build/options/WITHOUT_SPLIT_KERNEL_DEBUG b/tools/build/options/WITHOUT_SPLIT_KERNEL_DEBUG new file mode 100644 index 000000000000..a23bcd5ffdb6 --- /dev/null +++ b/tools/build/options/WITHOUT_SPLIT_KERNEL_DEBUG @@ -0,0 +1,3 @@ +Do not build standalone kernel debug files. +Debug data (if enabled by the kernel configuration file) +will be included in the kernel and modules.