Module Name: src Committed By: rin Date: Fri Jul 28 02:41:31 UTC 2023
Modified Files: src/sys/arch/aarch64/conf: Makefile.aarch64 src/sys/arch/arm/conf: Makefile.arm src/sys/conf: Makefile.kern.inc Log Message: Simplify fix for PR toolchain/57146 Introduce ARCH_STRIP_SYMBOLS variable to centralize logic for debug symbols from MD Makefile's to Makefile.kern.inc. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/aarch64/conf/Makefile.aarch64 cvs rdiff -u -r1.56 -r1.57 src/sys/arch/arm/conf/Makefile.arm cvs rdiff -u -r1.298 -r1.299 src/sys/conf/Makefile.kern.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/aarch64/conf/Makefile.aarch64 diff -u src/sys/arch/aarch64/conf/Makefile.aarch64:1.24 src/sys/arch/aarch64/conf/Makefile.aarch64:1.25 --- src/sys/arch/aarch64/conf/Makefile.aarch64:1.24 Wed Jul 26 03:39:55 2023 +++ src/sys/arch/aarch64/conf/Makefile.aarch64 Fri Jul 28 02:41:30 2023 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.aarch64,v 1.24 2023/07/26 03:39:55 rin Exp $ +# $NetBSD: Makefile.aarch64,v 1.25 2023/07/28 02:41:30 rin Exp $ # Makefile for NetBSD # @@ -95,15 +95,9 @@ LOADADDRESS?= 0xffffc00000000000 LINKFLAGS_NORMAL= -X # Strip AArch64 mapping symbols from the kernel image, as they interfere -# with ddb, but don't strip them in netbsd.gdb. -AA64_STRIP_SYMBOLS= --strip-symbol='[$$][dx]' \ +# with ddb, but don't strip them in netbsd.gdb. See Makefile.kern.inc. +ARCH_STRIP_SYMBOLS= --strip-symbol='[$$][dx]' \ --strip-symbol='[$$][dx]\.*' -.if (defined(DEBUG) && !empty(DEBUG:M-g*)) || (!defined(DEBUG) && \ - (${MKDEBUGKERNEL:Uno} == "yes" || ${MKDEBUG:Uno} == "yes")) -OBJCOPY_STRIPFLAGS= -g -w ${AA64_STRIP_SYMBOLS} -.else -SYSTEM_LD_TAIL= @${OBJCOPY} -w ${AA64_STRIP_SYMBOLS} $@ -.endif ## ## (6) port specific target dependencies Index: src/sys/arch/arm/conf/Makefile.arm diff -u src/sys/arch/arm/conf/Makefile.arm:1.56 src/sys/arch/arm/conf/Makefile.arm:1.57 --- src/sys/arch/arm/conf/Makefile.arm:1.56 Wed Jul 26 03:39:55 2023 +++ src/sys/arch/arm/conf/Makefile.arm Fri Jul 28 02:41:30 2023 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.arm,v 1.56 2023/07/26 03:39:55 rin Exp $ +# $NetBSD: Makefile.arm,v 1.57 2023/07/28 02:41:30 rin Exp $ # Makefile for NetBSD # @@ -106,15 +106,9 @@ locore.o: ${ARM}/arm32/locore.S assym.h LOADADDRESS?= 0xF0000000 LINKFLAGS_NORMAL= -X # Strip ARM mapping symbols from the kernel image, as they interfere -# with ddb, but don't strip them in netbsd.gdb. -ARM_STRIP_SYMBOLS= --strip-symbol='[$$][atd]' \ +# with ddb, but don't strip them in netbsd.gdb. See Makefile.kern.inc. +ARCH_STRIP_SYMBOLS= --strip-symbol='[$$][atd]' \ --strip-symbol='[$$][atd]\.*' -.if (defined(DEBUG) && !empty(DEBUG:M-g*)) || (!defined(DEBUG) && \ - (${MKDEBUGKERNEL:Uno} == "yes" || ${MKDEBUG:Uno} == "yes")) -OBJCOPY_STRIPFLAGS= -g -w ${ARM_STRIP_SYMBOLS} -.else -SYSTEM_LD_TAIL= @${OBJCOPY} -w ${ARM_STRIP_SYMBOLS} $@ -.endif ## ## (6) port specific target dependencies Index: src/sys/conf/Makefile.kern.inc diff -u src/sys/conf/Makefile.kern.inc:1.298 src/sys/conf/Makefile.kern.inc:1.299 --- src/sys/conf/Makefile.kern.inc:1.298 Wed Jul 26 03:39:55 2023 +++ src/sys/conf/Makefile.kern.inc Fri Jul 28 02:41:31 2023 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.kern.inc,v 1.298 2023/07/26 03:39:55 rin Exp $ +# $NetBSD: Makefile.kern.inc,v 1.299 2023/07/28 02:41:31 rin Exp $ # # This file contains common `MI' targets and definitions and it is included # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}. @@ -245,12 +245,22 @@ LINKFLAGS?= ${LINKFORMAT} ${LINKSCRIPT} LINKFLAGS_DEBUG?= -X KERNEL_CONFIG?= ${KERNEL_BUILD:T} -SYSTEM_LD_TAIL?= @${_MKSHECHO} -SYSTEM_LD_TAIL+= && ${TOOL_SED} '/const char sccs/!d;s/.*@(.)//;s/" "//;s/\\.*//' vers.c && \ - ${SIZE} $@ && ${SYSTEM_CTFMERGE} && chmod 755 $@ -SYSTEM_LD_TAIL+= && runit() { echo $$@; $$@; } +SYSTEM_LD_TAIL?= @${_MKSHECHO} +OBJCOPY_STRIPFLAGS?= -g -OBJCOPY_STRIPFLAGS?= -g +# Strip some architecture-defined symbols from kernel image, while +# keep them in netbsd.gdb. +.if defined(ARCH_STRIP_SYMBOLS) +.if empty(DEBUG:M-g*) +SYSTEM_LD_TAIL+= && ${OBJCOPY} -w ${ARCH_STRIP_SYMBOLS} $@ +.endif +OBJCOPY_STRIPFLAGS+= -w ${ARCH_STRIP_SYMBOLS} +.endif + +SYSTEM_LD_TAIL+= && ${TOOL_SED} \ + '/const char sccs/!d;s/.*@(.)//;s/" "//;s/\\.*//' vers.c && \ + ${SIZE} $@ && ${SYSTEM_CTFMERGE} && chmod 755 $@ && \ + runit() { echo $$@; $$@; } SYSTEM_LD_TAIL_DEBUG?=&& \ runit mv -f $@ $@.gdb && \