Subject: improving build warnings about SYMTAB_SPACE
To: None <tech-toolchain@netbsd.org>
From: Darrin B.Jewell <dbj@netbsd.org>
List: tech-toolchain
Date: 11/17/2005 20:49:00
--=-=-=
Platforms that use dbsym and SYMTAB_SPACE often encounter user
confusion because the symbol table space overflow is a non-fatal
build error that is frequently not noticed until run time, sometimes
long after a system has been up.
The attached patch provides the following changes:
. Have dbsym explicitly suggest increasing SYMTAB_SPACE when
an overflow occurs.
. Make this error a fatal build time error
. Move the support for dbsym into the MI Makefile.kern.inc,
conditional upon the SYMTAB_SPACE option being defined in
the kernel config file.
If there are no objections to these changes, I will proceed
to commit them in a few days.
Thanks,
Darrin
--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=makedbsym.diff
Content-Description: move kernel dbsym pass into mi makefile
Index: src/gnu/usr.sbin/dbsym/dbsym.c
===================================================================
RCS file: /cvsroot/src/gnu/usr.sbin/dbsym/dbsym.c,v
retrieving revision 1.8
diff -u -u -r1.8 dbsym.c
--- src/gnu/usr.sbin/dbsym/dbsym.c 1 Jun 2005 15:12:18 -0000 1.8
+++ src/gnu/usr.sbin/dbsym/dbsym.c 18 Nov 2005 01:36:04 -0000
@@ -151,7 +151,8 @@
&mappedkfile[db_symtab_symbols[X_DB_SYMTABSIZE].offset]);
if (symtabsize > symtab_space)
- errx(1, "symbol table (%u bytes) too big for buffer (%u bytes)",
+ errx(1, "symbol table (%u bytes) too big for buffer (%u bytes)\n"
+ "Increase options SYMTAB_SPACE in your kernel config",
symtabsize, symtab_space);
if (verbose)
Index: src/sys/conf/Makefile.kern.inc
===================================================================
RCS file: /cvsroot/src/sys/conf/Makefile.kern.inc,v
retrieving revision 1.69
diff -u -u -r1.69 Makefile.kern.inc
--- src/sys/conf/Makefile.kern.inc 2 Nov 2005 14:29:52 -0000 1.69
+++ src/sys/conf/Makefile.kern.inc 18 Nov 2005 01:36:04 -0000
@@ -208,6 +208,12 @@
LINKFLAGS+= ${LINKFLAGS_NORMAL}
.endif
+SYSTEM_LD_TAIL+=; \
+ if grep -q '^\#define.*SYMTAB_SPACE' opt_ddbparam.h; then \
+ echo "${DBSYM} $@"; \
+ ${DBSYM} $@; \
+ fi
+
SYSTEM_LD_HEAD+=${SYSTEM_LD_HEAD_EXTRA}
SYSTEM_LD_TAIL+=${SYSTEM_LD_TAIL_EXTRA}
Index: src/sys/arch/arc/conf/Makefile.arc.inc
===================================================================
RCS file: /cvsroot/src/sys/arch/arc/conf/Makefile.arc.inc,v
retrieving revision 1.13
diff -u -u -r1.13 Makefile.arc.inc
--- src/sys/arch/arc/conf/Makefile.arc.inc 7 May 2005 14:15:05 -0000 1.13
+++ src/sys/arch/arc/conf/Makefile.arc.inc 18 Nov 2005 01:36:04 -0000
@@ -2,7 +2,3 @@
CFLAGS+= -mips2
AFLAGS+= -mips2
-
-SYSTEM_LD_TAIL_EXTRA=; \
- echo "${DBSYM} $@ || true"; \
- ${DBSYM} $@ || true
Index: src/sys/arch/cats/conf/Makefile.cats.inc
===================================================================
RCS file: /cvsroot/src/sys/arch/cats/conf/Makefile.cats.inc,v
retrieving revision 1.16
diff -u -u -r1.16 Makefile.cats.inc
--- src/sys/arch/cats/conf/Makefile.cats.inc 13 Sep 2004 09:39:40 -0000 1.16
+++ src/sys/arch/cats/conf/Makefile.cats.inc 18 Nov 2005 01:36:05 -0000
@@ -22,8 +22,6 @@
cat ${ARM}/conf/kern.ldscript.tail ) > ldscript
SYSTEM_LD_TAIL_EXTRA+=; \
- echo "${DBSYM} $@ || true"; \
- ${DBSYM} $@ || true; \
echo \
"${OBJCOPY} -O a.out-arm-netbsd -R .ident -R .arm.atpcs -R .comment $@ $@.aout"; \
${OBJCOPY} -O a.out-arm-netbsd -R .ident -R .arm.atpcs -R .comment $@ $@.aout
Index: src/sys/arch/dreamcast/conf/Makefile.dreamcast.inc
===================================================================
RCS file: /cvsroot/src/sys/arch/dreamcast/conf/Makefile.dreamcast.inc,v
retrieving revision 1.8
diff -u -u -r1.8 Makefile.dreamcast.inc
--- src/sys/arch/dreamcast/conf/Makefile.dreamcast.inc 30 Oct 2002 12:22:55 -0000 1.8
+++ src/sys/arch/dreamcast/conf/Makefile.dreamcast.inc 18 Nov 2005 01:36:05 -0000
@@ -6,7 +6,3 @@
.if ${OBJECT_FMT} == "ELF"
LINKFORMAT= -N
.endif
-
-SYSTEM_LD_TAIL_EXTRA=; \
- echo "${DBSYM} $@ || true"; \
- ${DBSYM} $@ || true
Index: src/sys/arch/evbarm/conf/Makefile.evbarm.inc
===================================================================
RCS file: /cvsroot/src/sys/arch/evbarm/conf/Makefile.evbarm.inc,v
retrieving revision 1.16
diff -u -u -r1.16 Makefile.evbarm.inc
--- src/sys/arch/evbarm/conf/Makefile.evbarm.inc 3 Jan 2003 02:16:26 -0000 1.16
+++ src/sys/arch/evbarm/conf/Makefile.evbarm.inc 18 Nov 2005 01:36:05 -0000
@@ -1,9 +1,5 @@
# $NetBSD: Makefile.evbarm.inc,v 1.16 2003/01/03 02:16:26 thorpej Exp $
-SYSTEM_LD_TAIL_EXTRA=; \
- echo "${DBSYM} $@ || true"; \
- ${DBSYM} $@ || true
-
.if defined(BOARDMKFRAG) # Must be a full pathname.
.include "${BOARDMKFRAG}"
.endif
Index: src/sys/arch/evbmips/conf/Makefile.evbmips.inc
===================================================================
RCS file: /cvsroot/src/sys/arch/evbmips/conf/Makefile.evbmips.inc,v
retrieving revision 1.1
diff -u -u -r1.1 Makefile.evbmips.inc
--- src/sys/arch/evbmips/conf/Makefile.evbmips.inc 7 Mar 2002 14:43:57 -0000 1.1
+++ src/sys/arch/evbmips/conf/Makefile.evbmips.inc 18 Nov 2005 01:36:05 -0000
@@ -1,8 +1,6 @@
# $NetBSD: Makefile.evbmips.inc,v 1.1 2002/03/07 14:43:57 simonb Exp $
SYSTEM_LD_TAIL_EXTRA=; \
- echo "${DBSYM} $@ || true"; \
- ${DBSYM} $@ || true; \
echo ${STRIP} -O srec -o $@.srec $@; \
${STRIP} -O srec -o $@.srec $@
EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.srec@}
Index: src/sys/arch/evbppc/conf/Makefile.ev64260.inc
===================================================================
RCS file: /cvsroot/src/sys/arch/evbppc/conf/Makefile.ev64260.inc,v
retrieving revision 1.3
diff -u -u -r1.3 Makefile.ev64260.inc
--- src/sys/arch/evbppc/conf/Makefile.ev64260.inc 17 Mar 2005 16:45:50 -0000 1.3
+++ src/sys/arch/evbppc/conf/Makefile.ev64260.inc 18 Nov 2005 01:36:05 -0000
@@ -7,12 +7,6 @@
SYSTEM_FIRST_OBJ= ${BOARDTYPE}_locore.o
SYSTEM_FIRST_SFILE= ${THISPPC}/${BOARDTYPE}/${BOARDTYPE}_locore.S
-.ifdef DBSYM
-SYSTEM_LD_TAIL_EXTRA+=; \
- echo "${DBSYM} $@ || true"; \
- ${DBSYM} $@ || true
-.endif
-
SYSTEM_LD_TAIL_EXTRA+=; \
echo ${MKIMG} netbsd netbsd.img ; \
OBJDUMP=${OBJDUMP}; OBJCOPY=${OBJCOPY}; export OBJDUMP OBJCOPY; \
Index: src/sys/arch/evbppc/conf/Makefile.explora.inc
===================================================================
RCS file: /cvsroot/src/sys/arch/evbppc/conf/Makefile.explora.inc,v
retrieving revision 1.3
diff -u -u -r1.3 Makefile.explora.inc
--- src/sys/arch/evbppc/conf/Makefile.explora.inc 16 Jan 2005 23:40:34 -0000 1.3
+++ src/sys/arch/evbppc/conf/Makefile.explora.inc 18 Nov 2005 01:36:05 -0000
@@ -6,12 +6,6 @@
SYSTEM_FIRST_OBJ= explora_start.o
SYSTEM_FIRST_SFILE= ${THISPPC}/explora/explora_start.S
-.ifdef DBSYM
-SYSTEM_LD_TAIL_EXTRA+=; \
- echo "${DBSYM} $@ || true"; \
- ${DBSYM} $@ || true
-.endif
-
SYSTEM_LD_TAIL_EXTRA+=; \
echo ${OBJCOPY} --adjust-vma 0x81000000 netbsd netbsd.img ; \
${OBJCOPY} --adjust-vma 0x81000000 netbsd netbsd.img
Index: src/sys/arch/evbppc/conf/Makefile.obs200.inc
===================================================================
RCS file: /cvsroot/src/sys/arch/evbppc/conf/Makefile.obs200.inc,v
retrieving revision 1.2
diff -u -u -r1.2 Makefile.obs200.inc
--- src/sys/arch/evbppc/conf/Makefile.obs200.inc 29 Mar 2005 17:58:15 -0000 1.2
+++ src/sys/arch/evbppc/conf/Makefile.obs200.inc 18 Nov 2005 01:36:05 -0000
@@ -9,12 +9,6 @@
SYSTEM_FIRST_OBJ= obs200_locore.o
SYSTEM_FIRST_SFILE= ${THISPPC}/obs405/obs200_locore.S
-.ifdef DBSYM
-SYSTEM_LD_TAIL_EXTRA+=; \
- echo "${DBSYM} $@ || true"; \
- ${DBSYM} $@ || true
-.endif
-
SYSTEM_LD_TAIL_EXTRA+=; \
echo ${MKIMG} netbsd netbsd.img ; \
OBJDUMP=${OBJDUMP}; OBJCOPY=${OBJCOPY}; export OBJDUMP OBJCOPY; \
Index: src/sys/arch/evbppc/conf/Makefile.obs405.inc
===================================================================
RCS file: /cvsroot/src/sys/arch/evbppc/conf/Makefile.obs405.inc,v
retrieving revision 1.2
diff -u -u -r1.2 Makefile.obs405.inc
--- src/sys/arch/evbppc/conf/Makefile.obs405.inc 17 Mar 2005 16:45:50 -0000 1.2
+++ src/sys/arch/evbppc/conf/Makefile.obs405.inc 18 Nov 2005 01:36:05 -0000
@@ -9,12 +9,6 @@
SYSTEM_FIRST_OBJ= locore.o
SYSTEM_FIRST_SFILE= ${POWERPC}/${PPCDIR}/openbios/locore.S
-.ifdef DBSYM
-SYSTEM_LD_TAIL_EXTRA+=; \
- echo "${DBSYM} $@ || true"; \
- ${DBSYM} $@ || true
-.endif
-
SYSTEM_LD_TAIL_EXTRA+=; \
echo ${MKIMG} netbsd netbsd.img ; \
OBJDUMP=${OBJDUMP}; OBJCOPY=${OBJCOPY}; export OBJDUMP OBJCOPY; \
Index: src/sys/arch/evbppc/conf/Makefile.walnut.inc
===================================================================
RCS file: /cvsroot/src/sys/arch/evbppc/conf/Makefile.walnut.inc,v
retrieving revision 1.3
diff -u -u -r1.3 Makefile.walnut.inc
--- src/sys/arch/evbppc/conf/Makefile.walnut.inc 17 Mar 2005 16:45:50 -0000 1.3
+++ src/sys/arch/evbppc/conf/Makefile.walnut.inc 18 Nov 2005 01:36:05 -0000
@@ -8,12 +8,6 @@
SYSTEM_FIRST_OBJ= walnut_start.o
SYSTEM_FIRST_SFILE= ${THISPPC}/walnut/walnut_start.S
-.ifdef DBSYM
-SYSTEM_LD_TAIL_EXTRA+=; \
- echo "${DBSYM} $@ || true"; \
- ${DBSYM} $@ || true
-.endif
-
SYSTEM_LD_TAIL_EXTRA+=; \
echo ${MKIMG} netbsd netbsd.img ; \
OBJDUMP=${OBJDUMP}; OBJCOPY=${OBJCOPY}; export OBJDUMP OBJCOPY; \
Index: src/sys/arch/macppc/conf/Makefile.macppc
===================================================================
RCS file: /cvsroot/src/sys/arch/macppc/conf/Makefile.macppc,v
retrieving revision 1.23
diff -u -u -r1.23 Makefile.macppc
--- src/sys/arch/macppc/conf/Makefile.macppc 19 Oct 2005 09:01:27 -0000 1.23
+++ src/sys/arch/macppc/conf/Makefile.macppc 18 Nov 2005 01:36:05 -0000
@@ -75,12 +75,6 @@
LINKFORMAT= -N
ENTRYPOINT= __start
-.if defined(NEED_SYMTAB)
-SYSTEM_LD_TAIL_EXTRA=; \
- echo ${DBSYM} $@; \
- ${DBSYM} $@
-.endif
-
.if defined(NEED_SREC)
SYSTEM_LD_TAIL_EXTRA+=; \
${OBJCOPY} -v -O srec $@ $@.srec
Index: src/sys/arch/netwinder/conf/Makefile.netwinder.inc
===================================================================
RCS file: /cvsroot/src/sys/arch/netwinder/conf/Makefile.netwinder.inc,v
retrieving revision 1.7
diff -u -u -r1.7 Makefile.netwinder.inc
--- src/sys/arch/netwinder/conf/Makefile.netwinder.inc 3 Jan 2003 02:34:49 -0000 1.7
+++ src/sys/arch/netwinder/conf/Makefile.netwinder.inc 18 Nov 2005 01:36:05 -0000
@@ -2,10 +2,6 @@
CPPFLAGS+= -D${MACHINE}
-SYSTEM_LD_TAIL_EXTRA=; \
- echo "${DBSYM} $@ || true"; \
- ${DBSYM} $@ || true
-
SYSTEM_FIRST_OBJ= nwmmu.o
SYSTEM_FIRST_SFILE= ${THISARM}/${MACHINE}/nwmmu.S
Index: src/sys/arch/pmppc/conf/INSTALL
===================================================================
RCS file: /cvsroot/src/sys/arch/pmppc/conf/INSTALL,v
retrieving revision 1.19
diff -u -u -r1.19 INSTALL
--- src/sys/arch/pmppc/conf/INSTALL 19 Aug 2005 05:19:54 -0000 1.19
+++ src/sys/arch/pmppc/conf/INSTALL 18 Nov 2005 01:36:05 -0000
@@ -44,7 +44,6 @@
#options DDB_HISTORY_SIZE=512 # enable history editing in DDB
#options TRAP_PANICWAIT
#options SYMTAB_SPACE=200000 # size for embedded symbol table
-no makeoptions NEED_SYMTAB
#makeoptions DEBUG="-g" # compile full symbol table
Index: src/sys/arch/pmppc/conf/std.pmppc
===================================================================
RCS file: /cvsroot/src/sys/arch/pmppc/conf/std.pmppc,v
retrieving revision 1.6
diff -u -u -r1.6 std.pmppc
--- src/sys/arch/pmppc/conf/std.pmppc 17 Sep 2005 09:44:08 -0000 1.6
+++ src/sys/arch/pmppc/conf/std.pmppc 18 Nov 2005 01:36:05 -0000
@@ -16,5 +16,4 @@
makeoptions TEXTADDR=0x40000
-makeoptions NEED_SYMTAB=1
makeoptions NEED_BINARY=1
Index: src/sys/arch/powerpc/conf/Makefile.powerpc
===================================================================
RCS file: /cvsroot/src/sys/arch/powerpc/conf/Makefile.powerpc,v
retrieving revision 1.35
diff -u -u -r1.35 Makefile.powerpc
--- src/sys/arch/powerpc/conf/Makefile.powerpc 2 Jun 2005 14:35:08 -0000 1.35
+++ src/sys/arch/powerpc/conf/Makefile.powerpc 18 Nov 2005 01:36:05 -0000
@@ -75,12 +75,6 @@
LINKFORMAT= -N
ENTRYPOINT= __start
-.if defined(NEED_SYMTAB)
-SYSTEM_LD_TAIL_EXTRA=; \
- echo ${DBSYM} $@; \
- ${DBSYM} $@
-.endif
-
.if defined(NEED_SREC)
SYSTEM_LD_TAIL_EXTRA+=; \
${OBJCOPY} -v -O srec $@ $@.srec
Index: src/sys/arch/sbmips/conf/Makefile.sbmips.inc
===================================================================
RCS file: src/sys/arch/sbmips/conf/Makefile.sbmips.inc
diff -N src/sys/arch/sbmips/conf/Makefile.sbmips.inc
--- src/sys/arch/sbmips/conf/Makefile.sbmips.inc 6 Mar 2002 02:13:38 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,5 +0,0 @@
-# $NetBSD: Makefile.sbmips.inc,v 1.1 2002/03/06 02:13:38 simonb Exp $
-
-SYSTEM_LD_TAIL_EXTRA=; \
- echo "${DBSYM} $@ || true"; \
- ${DBSYM} $@ || true;
Index: src/sys/arch/shark/conf/Makefile.shark.inc
===================================================================
RCS file: /cvsroot/src/sys/arch/shark/conf/Makefile.shark.inc,v
retrieving revision 1.5
diff -u -u -r1.5 Makefile.shark.inc
--- src/sys/arch/shark/conf/Makefile.shark.inc 13 Sep 2004 09:39:40 -0000 1.5
+++ src/sys/arch/shark/conf/Makefile.shark.inc 18 Nov 2005 01:36:05 -0000
@@ -17,8 +17,6 @@
cat ${ARM}/conf/kern.ldscript.tail ) > ldscript
SYSTEM_LD_TAIL_EXTRA+=; \
- echo "${DBSYM} $@ || true"; \
- ${DBSYM} $@ || true; \
echo \
"${OBJCOPY} -O a.out-arm-netbsd -R .ident -R .arm.atpcs -R .comment $@ $@.aout"; \
${OBJCOPY} -O a.out-arm-netbsd -R .ident -R .arm.atpcs -R .comment $@ $@.aout
--=-=-=--