Subject: crunchgen "special obj/objpaths/keepsymbols"
To: None <tech-userlevel@netbsd.org>
From: Jachym Holecek <freza@dspfpga.com>
List: tech-userlevel
Date: 10/18/2006 17:59:02
Hello,

I'd like to make multiple

  SPECIAL prog {objs,objpaths,keepsymbols} ...

lines in crunchgen configuration file (where "prog" is fixed) work as
expected. Currently, only the last one takes effect, any previous are
ignored. For example:

  SPECIAL sshd 		keepsymbols 	deny_severity allow_severity

works fine as opposed to

  SPECIAL sshd 		keepsymbols 	deny_severity
  SPECIAL sshd 		keepsymbols 	allow_severity

which only works for "allow_severity" ("deny_severity" is forgotten).

Does the patch below look OK to commit?

	-- Jachym

Index: usr.bin/crunch/crunchgen/crunchgen.1
===================================================================
RCS file: /cvsroot/src/usr.bin/crunch/crunchgen/crunchgen.1,v
retrieving revision 1.25
diff -d -p -u -r1.25 crunchgen.1
--- usr.bin/crunch/crunchgen/crunchgen.1	25 Sep 2004 21:47:53 -0000	1.25
+++ usr.bin/crunch/crunchgen/crunchgen.1	18 Oct 2006 15:48:57 -0000
@@ -207,6 +207,10 @@ Don't hide the specified symbols for
 .Ar progname .
 Normally all externally visible symbols for
 a program is hidden to avoid interference.
+Multiple
+.Em keepsymbols
+lines can be specified for given
+.Ar progname .
 .It Nm special Ar progname Nm srcdir Ar pathname
 Set the source directory for
 .Ar progname .
@@ -235,6 +239,10 @@ Set the list of object files for program
 This is normally calculated by constructing a temporary makefile that includes
 .Dq Nm srcdir / Pa Makefile
 and outputs the value of $(OBJS).
+Multiple
+.Em objs
+lines can be specified for given
+.Ar progname .
 .It Nm special Ar progname Nm objpaths Ar full-pathname-to-object-file ...
 Sets the pathnames of the object files for program
 .Ar progname .
@@ -243,6 +251,10 @@ This is normally calculated by prependin
 pathname to each file in the
 .Nm objs
 list.
+Multiple
+.Em objpaths
+lines can be specified for given
+.Ar progname .
 .El
 .Pp
 Only the
Index: usr.bin/crunch/crunchgen/crunchgen.c
===================================================================
RCS file: /cvsroot/src/usr.bin/crunch/crunchgen/crunchgen.c,v
retrieving revision 1.72
diff -d -p -u -r1.72 crunchgen.c
--- usr.bin/crunch/crunchgen/crunchgen.c	26 Aug 2006 18:17:42 -0000	1.72
+++ usr.bin/crunch/crunchgen/crunchgen.c	18 Oct 2006 15:48:59 -0000
@@ -490,7 +490,6 @@ add_special(int argc, char **argv)
 
     if (!strcmp(argv[2], "objs")) {
 	oneobj = 0;
-	p->objs = NULL;
 	for (i = 3; i < argc; i++)
 	    add_string(&p->objs, argv[i]);
 	return;
@@ -498,14 +497,12 @@ add_special(int argc, char **argv)
 
     if (!strcmp(argv[2], "objpaths")) {
 	oneobj = 0;
-	p->objpaths = NULL;
 	for (i = 3; i < argc; i++)
 	    add_string(&p->objpaths, argv[i]);
 	return;
     }
 
     if (!strcmp(argv[2], "keepsymbols")) {
-	p->keepsymbols = NULL;
 	for (i = 3; i < argc; i++)
 	    add_string(&p->keepsymbols, argv[i]);
 	return;