Module Name: src
Committed By: skrll
Date: Fri Aug 9 09:08:47 UTC 2013
Modified Files:
src/sys/conf: Makefile.kern.inc
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 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/conf/Makefile.kern.inc
diff -u src/sys/conf/Makefile.kern.inc:1.160 src/sys/conf/Makefile.kern.inc:1.161
--- src/sys/conf/Makefile.kern.inc:1.160 Wed Jul 17 14:05:43 2013
+++ src/sys/conf/Makefile.kern.inc Fri Aug 9 09:08:47 2013
@@ -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 @@ SYSTEM_LD_TAIL_DBSYM?= \
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 @@ LINKFLAGS?= ${LINKFORMAT} ${LINKTEXT} ${
${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 $@ [email protected]; mv -f $@ [email protected]; \
echo ${STRIP} ${STRIPFLAGS} -o $@ [email protected]; \
${STRIP} ${STRIPFLAGS} -o $@ [email protected]
+.endif
LINKFLAGS_NORMAL?= -S
STRIPFLAGS?= -g
@@ -304,16 +309,20 @@ SYSTEM_LD_TAIL+=; \
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