Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src adjust the size of db_symtab space automatically.
details: https://anonhg.NetBSD.org/src/rev/b98e586d4a3f
branches: trunk
changeset: 778201:b98e586d4a3f
user: bsh <bsh%NetBSD.org@localhost>
date: Mon Mar 19 05:38:26 2012 +0000
description:
adjust the size of db_symtab space automatically.
proposed on tech-toolchain@, and got no objections.
diffstat:
external/gpl3/binutils/usr.sbin/dbsym/dbsym.8 | 12 ++++++-
external/gpl3/binutils/usr.sbin/dbsym/dbsym.c | 16 ++++++++-
sys/arch/arm/conf/Makefile.arm | 5 +-
sys/conf/Makefile.kern.inc | 43 +++++++++++++++++++++++++-
4 files changed, 66 insertions(+), 10 deletions(-)
diffs (197 lines):
diff -r 6b9d6c9a8317 -r b98e586d4a3f external/gpl3/binutils/usr.sbin/dbsym/dbsym.8
--- a/external/gpl3/binutils/usr.sbin/dbsym/dbsym.8 Mon Mar 19 03:33:54 2012 +0000
+++ b/external/gpl3/binutils/usr.sbin/dbsym/dbsym.8 Mon Mar 19 05:38:26 2012 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: dbsym.8,v 1.1 2009/08/18 20:22:20 skrll Exp $
+.\" $NetBSD: dbsym.8,v 1.2 2012/03/19 05:38:26 bsh Exp $
.\"
.Dd November 9, 2001
.Dt DBSYM 8
@@ -8,7 +8,7 @@
.Nd copy kernel symbol table into db_symtab space
.Sh SYNOPSIS
.Nm
-.Op Fl v
+.Op Fl pv
.Op Fl b Ar bfdname
.Ar kernel
.Sh DESCRIPTION
@@ -39,6 +39,14 @@
will print out status information as
it is copying the symbol table.
.Pp
+If the
+.Fl p
+flag is given,
+.Nm
+will report the size of the kernel symbol table and the size of the
+db_symtab space.
+Two values are printed out in a line separated by a space.
+.Pp
Note that debugging symbols are not useful to the
.Xr ddb 4
kernel debugger, so to minimize the size of the kernel, one should
diff -r 6b9d6c9a8317 -r b98e586d4a3f external/gpl3/binutils/usr.sbin/dbsym/dbsym.c
--- a/external/gpl3/binutils/usr.sbin/dbsym/dbsym.c Mon Mar 19 03:33:54 2012 +0000
+++ b/external/gpl3/binutils/usr.sbin/dbsym/dbsym.c Mon Mar 19 05:38:26 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dbsym.c,v 1.1 2009/08/18 20:22:20 skrll Exp $ */
+/* $NetBSD: dbsym.c,v 1.2 2012/03/19 05:38:26 bsh Exp $ */
/*
* Copyright (c) 2001 Simon Burge (for Wasabi Systems)
@@ -39,7 +39,7 @@
__COPYRIGHT("@(#) Copyright (c) 1996 Christopher G. Demetriou.\
Copyright 2001 Simon Burge.\
All rights reserved.");
-__RCSID("$NetBSD: dbsym.c,v 1.1 2009/08/18 20:22:20 skrll Exp $");
+__RCSID("$NetBSD: dbsym.c,v 1.2 2012/03/19 05:38:26 bsh Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -75,6 +75,7 @@
int load_symtab(bfd *, int fd, char **, u_int32_t *);
int verbose;
+int printsize;
int
main(int argc, char **argv)
@@ -90,7 +91,7 @@
setprogname(argv[0]);
bfdname = NULL;
- while ((ch = getopt(argc, argv, "b:v")) != -1)
+ while ((ch = getopt(argc, argv, "b:pv")) != -1)
switch (ch) {
case 'b':
bfdname = optarg;
@@ -98,6 +99,9 @@
case 'v':
verbose = 1;
break;
+ case 'p':
+ printsize = 1;
+ break;
case '?':
default:
usage();
@@ -150,6 +154,11 @@
symtab_space = bfd_get_32(abfd,
&mappedkfile[db_symtab_symbols[X_DB_SYMTABSIZE].offset]);
+ if (printsize) {
+ printf("%d %d\n", symtabsize, symtab_space);
+ goto done;
+ }
+
if (symtabsize > symtab_space)
errx(1, "symbol table (%u bytes) too big for buffer (%u bytes)\n"
"Increase options SYMTAB_SPACE in your kernel config",
@@ -168,6 +177,7 @@
bfd_put_32(abfd, symtabsize,
&mappedkfile[db_symtab_symbols[X_DB_SYMTABSIZE].offset]);
+done:
munmap(mappedkfile, ksb.st_size);
close(kfd);
diff -r 6b9d6c9a8317 -r b98e586d4a3f sys/arch/arm/conf/Makefile.arm
--- a/sys/arch/arm/conf/Makefile.arm Mon Mar 19 03:33:54 2012 +0000
+++ b/sys/arch/arm/conf/Makefile.arm Mon Mar 19 05:38:26 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.arm,v 1.32 2008/04/27 03:23:13 tsutsui Exp $
+# $NetBSD: Makefile.arm,v 1.33 2012/03/19 05:38:26 bsh Exp $
# Makefile for NetBSD
#
@@ -63,7 +63,8 @@
# Strip ARM mapping symbols from the kernel image, as they interfere
# with ddb. Do it differently if 'makeoptions DEBUG="-g"' was specified.
.if !defined(DEBUG) || empty(DEBUG:M-g*)
-SYSTEM_LD_TAIL?= @${OBJCOPY} --strip-symbol='$$a' \
+SYSTEM_LD_TAIL?= @${SYSTEM_LD_TAIL_DBSYM} ; \
+ ${OBJCOPY} --strip-symbol='$$a' \
--strip-symbol='$$t' \
--strip-symbol='$$d' $@ ;\
${SIZE} $@; chmod 755 $@
diff -r 6b9d6c9a8317 -r b98e586d4a3f sys/conf/Makefile.kern.inc
--- a/sys/conf/Makefile.kern.inc Mon Mar 19 03:33:54 2012 +0000
+++ b/sys/conf/Makefile.kern.inc Mon Mar 19 05:38:26 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.kern.inc,v 1.152 2012/02/12 16:34:11 matt Exp $
+# $NetBSD: Makefile.kern.inc,v 1.153 2012/03/19 05:38:26 bsh Exp $
#
# This file contains common `MI' targets and definitions and it is included
# at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
@@ -233,9 +233,43 @@
${_MKSHECHO}\
${LD} -Map $@.map --cref ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' '$${EXTRA_OBJ}' vers.o; \
${LD} -Map $@.map --cref ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o
-SYSTEM_LD_TAIL?=@${TOOL_SED} '/const char sccs/!d;s/.*@(.)//;s/\\.*//' vers.c; \
+
+AUTO_SYMTAB_SPACE?= yes
+
+.if empty(AUTO_SYMTAB_SPACE:M[Yy][Ee][Ss]) || defined(_SYMTAB_SPACE_ADJUSTED)
+SYSTEM_LD_TAIL_DBSYM?= true
+.else
+SYSTEM_LD_TAIL_DBSYM?= \
+ if grep '^\#define.*SYMTAB_SPACE' opt_ksyms.h > /dev/null; then \
+ _modify_opt_ksyms_h () { \
+ ${TOOL_SED} \
+ -e 's/^\(\#define.*SYMTAB_SPACE[ ]*\)[0-9]*/\1'$$1/ \
+ -e 's/\(.equiv[ ]*_KERNEL_OPT_SYMTAB_SPACE,0x\)[0-9a-f]*/\1'$$(printf %x $$1)/ \
+ opt_ksyms.h > opt_ksyms.h.ADJ && \
+ mv opt_ksyms.h.ADJ opt_ksyms.h && \
+ ${MAKE} ${MFLAGS} _SYMTAB_SPACE_ADJUSTED=1 $@; \
+ }; \
+ _adj_symtab_space () { \
+ set -- $$(${DBSYM} -p $@); \
+ echo Symtab size: $$1, space: $$2; \
+ if [ "$$1" -gt "$$2" ]; then \
+ echo Adjusting symtab space; \
+ rm -f $@; \
+ _modify_opt_ksyms_h $$1; \
+ fi; \
+ }; \
+ _adj_symtab_space; \
+ 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 &/}
@@ -259,21 +293,24 @@
LINKFLAGS+= ${LINKFLAGS_DEBUG}
EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.gdb@}
CTFFLAGS+= -g
+.if !defined(_SYMTAB_SPACE_ADJUSTED)
SYSTEM_LD_TAIL+=; \
if grep '^\#define.*SYMTAB_SPACE' opt_ksyms.h > /dev/null; then \
echo "${DBSYM} $@.gdb"; \
${DBSYM} $@.gdb || (rm -f $@ ; exit 1) || exit 1; \
fi
-
+.endif
.elifndef PROF
LINKFLAGS+= ${LINKFLAGS_NORMAL}
.endif
+.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}
Home |
Main Index |
Thread Index |
Old Index