Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/conf Simplify fix for PR toolchain/57146



details:   https://anonhg.NetBSD.org/src/rev/a92537c13cfc
branches:  trunk
changeset: 378235:a92537c13cfc
user:      rin <rin%NetBSD.org@localhost>
date:      Fri Jul 28 02:41:30 2023 +0000

description:
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.

diffstat:

 sys/arch/aarch64/conf/Makefile.aarch64 |  12 +++---------
 sys/arch/arm/conf/Makefile.arm         |  12 +++---------
 sys/conf/Makefile.kern.inc             |  22 ++++++++++++++++------
 3 files changed, 22 insertions(+), 24 deletions(-)

diffs (91 lines):

diff -r 936085f862f1 -r a92537c13cfc sys/arch/aarch64/conf/Makefile.aarch64
--- a/sys/arch/aarch64/conf/Makefile.aarch64    Fri Jul 28 02:28:33 2023 +0000
+++ b/sys/arch/aarch64/conf/Makefile.aarch64    Fri Jul 28 02:41:30 2023 +0000
@@ -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
diff -r 936085f862f1 -r a92537c13cfc sys/arch/arm/conf/Makefile.arm
--- a/sys/arch/arm/conf/Makefile.arm    Fri Jul 28 02:28:33 2023 +0000
+++ b/sys/arch/arm/conf/Makefile.arm    Fri Jul 28 02:41:30 2023 +0000
@@ -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
diff -r 936085f862f1 -r a92537c13cfc sys/conf/Makefile.kern.inc
--- a/sys/conf/Makefile.kern.inc        Fri Jul 28 02:28:33 2023 +0000
+++ b/sys/conf/Makefile.kern.inc        Fri Jul 28 02:41:30 2023 +0000
@@ -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 && \



Home | Main Index | Thread Index | Old Index