Source-Changes-HG archive

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

[src/trunk]: src/sys/conf Fix debug kernel builds when the automatic symbol t...



details:   https://anonhg.NetBSD.org/src/rev/ed68455a845b
branches:  trunk
changeset: 789154:ed68455a845b
user:      skrll <skrll%NetBSD.org@localhost>
date:      Fri Aug 09 09:08:47 2013 +0000

description:
Fix debug kernel builds when the automatic symbol table resizing kicks in.
Previously, the TAIL/HEAD link steps were being executed twice and the
(relinked/stripped) kernel would overwrite the debug version.

XXX this is all ugly.

diffstat:

 sys/conf/Makefile.kern.inc |  31 ++++++++++++++++++++-----------
 1 files changed, 20 insertions(+), 11 deletions(-)

diffs (72 lines):

diff -r 34b8795ecbd7 -r ed68455a845b sys/conf/Makefile.kern.inc
--- a/sys/conf/Makefile.kern.inc        Fri Aug 09 07:12:42 2013 +0000
+++ b/sys/conf/Makefile.kern.inc        Fri Aug 09 09:08:47 2013 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.kern.inc,v 1.160 2013/07/17 14:05:43 matt Exp $
+#      $NetBSD: Makefile.kern.inc,v 1.161 2013/08/09 09:08:47 skrll Exp $
 #
 # This file contains common `MI' targets and definitions and it is included
 # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
@@ -262,15 +262,6 @@
        fi
 .endif
 
-.if defined(_SYMTAB_SPACE_ADJUSTED)
-SYSTEM_LD_TAIL?=true
-.else
-SYSTEM_LD_TAIL?=@${SYSTEM_LD_TAIL_DBSYM} ; \
-               ${TOOL_SED} '/const char sccs/!d;s/.*@(.)//;s/\\.*//' vers.c; \
-               ${SIZE} $@; chmod 755 $@; \
-               ${SYSTEM_CTFMERGE}
-.endif
-
 TEXTADDR?=     ${LOADADDRESS}                  # backwards compatibility
 LINKTEXT?=     ${TEXTADDR:C/.+/-Ttext &/}
 LINKDATA?=     ${DATAADDR:C/.+/-Tdata &/}
@@ -280,10 +271,24 @@
                ${EXTRA_LINKFLAGS}
 
 LINKFLAGS_DEBUG?=      -X
+
+#
+# If we're relinking due to _SYMTAB_SPACE_ADJUSTED then don't perform
+# SYSTEM_LD_TAIL{,_DEBUG}. They'll be done in the parent invocation.
+#
+.if defined(_SYMTAB_SPACE_ADJUSTED)
+SYSTEM_LD_TAIL?=true
+SYSTEM_LD_TAIL_DEBUG?=true
+.else
+SYSTEM_LD_TAIL?=@${SYSTEM_LD_TAIL_DBSYM} ; \
+               ${TOOL_SED} '/const char sccs/!d;s/.*@(.)//;s/\\.*//' vers.c; \
+               ${SIZE} $@; chmod 755 $@; \
+               ${SYSTEM_CTFMERGE}
 SYSTEM_LD_TAIL_DEBUG?=; \
                echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
                echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
                ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
+.endif
 LINKFLAGS_NORMAL?=     -S
 STRIPFLAGS?=   -g
 
@@ -304,16 +309,20 @@
 LINKFLAGS+=    ${LINKFLAGS_NORMAL}
 .endif
 
+#
+# More steps to skip if we're relinking due to _SYMTAB_SPACE_ADJUSTED (see
+# above)
+#
 .if !defined(_SYMTAB_SPACE_ADJUSTED)
 SYSTEM_LD_TAIL+=; \
        if grep '^\#define.*SYMTAB_SPACE' opt_ksyms.h > /dev/null; then \
                echo "${DBSYM} $@"; \
                ${DBSYM} $@ || (rm -f $@ ; exit 1) || exit 1; \
        fi
-.endif
 
 SYSTEM_LD_HEAD+=${SYSTEM_LD_HEAD_EXTRA}
 SYSTEM_LD_TAIL+=${SYSTEM_LD_TAIL_EXTRA}
+.endif
 
 ##
 ## (6) port independent targets and dependencies: assym.h, vers.o



Home | Main Index | Thread Index | Old Index