summaryrefslogtreecommitdiffstats
path: root/usr.sbin/crunch
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>1997-10-05 13:35:05 +0000
committerjoerg <joerg@FreeBSD.org>1997-10-05 13:35:05 +0000
commitf94dc5b1f1af373260ac996d6416fd27c9fe8f4b (patch)
tree7ada973823e0eeac3518a0246b606d9e7d7462fd /usr.sbin/crunch
parent2c3516e03226f1fce6fde611990de90beca8a969 (diff)
downloadFreeBSD-src-f94dc5b1f1af373260ac996d6416fd27c9fe8f4b.zip
FreeBSD-src-f94dc5b1f1af373260ac996d6416fd27c9fe8f4b.tar.gz
Add a new special called `keep' to the list of special options. It
provides for a means to specify an argument for crunchide's -k option. (This is required by ntpdate.) Submitted by: peter@rhiannon.clari.net.au (Peter Hawkins)
Diffstat (limited to 'usr.sbin/crunch')
-rw-r--r--usr.sbin/crunch/crunchgen/crunchgen.112
-rw-r--r--usr.sbin/crunch/crunchgen/crunchgen.c16
-rw-r--r--usr.sbin/crunch/examples/really-big.conf9
3 files changed, 33 insertions, 4 deletions
diff --git a/usr.sbin/crunch/crunchgen/crunchgen.1 b/usr.sbin/crunch/crunchgen/crunchgen.1
index 9db0ef1..47243b7 100644
--- a/usr.sbin/crunch/crunchgen/crunchgen.1
+++ b/usr.sbin/crunch/crunchgen/crunchgen.1
@@ -23,7 +23,7 @@
.\" Computer Science Department
.\" University of Maryland at College Park
.\"
-.Dd June 14, 1994
+.Dd September 29, 1997
.Dt CRUNCHGEN 1
.Os BSD 4
.Sh NAME
@@ -178,6 +178,16 @@ This is normally calculated by prepending the
pathname to each file in the
.Nm objs
list.
+.It Nm special Ar progname Nm keep Ar symbol-name ...
+Add specified list of symbols to the keep list for program
+.Ar progname .
+An underscore is prepended to each symbol and it becomes the argument to a
+.Fl k
+option for the
+.Xr crunchide 1
+phase. This option is to be used as a last resort as its use can cause a
+symbol conflict, however in certain instances it may be the only way to
+have a symbol resolve.
.El
.Pp
diff --git a/usr.sbin/crunch/crunchgen/crunchgen.c b/usr.sbin/crunch/crunchgen/crunchgen.c
index aef8fc8..ae0a78f 100644
--- a/usr.sbin/crunch/crunchgen/crunchgen.c
+++ b/usr.sbin/crunch/crunchgen/crunchgen.c
@@ -63,6 +63,7 @@ typedef struct prog {
char *name, *ident;
char *srcdir, *objdir;
strlst_t *objs, *objpaths;
+ strlst_t *keeplist;
strlst_t *links;
int goterror;
} prog_t;
@@ -321,7 +322,7 @@ void add_prog(char *progname)
else p1->next = p2;
p2->ident = p2->srcdir = p2->objdir = NULL;
- p2->links = p2->objs = NULL;
+ p2->links = p2->objs = p2->keeplist = NULL;
p2->goterror = 0;
if (list_mode)
printf("%s\n",progname);
@@ -394,6 +395,11 @@ void add_special(int argc, char **argv)
for(i=3;i<argc;i++)
add_string(&p->objpaths, argv[i]);
}
+ else if(!strcmp(argv[2], "keep")) {
+ p->keeplist = NULL;
+ for(i=3;i<argc;i++)
+ add_string(&p->keeplist, argv[i]);
+ }
else {
warnx("%s:%d: bad parameter name `%s', skipping line",
curfilename, linenum, argv[2]);
@@ -758,6 +764,8 @@ void top_makefile_rules(FILE *outmk)
void prog_makefile_rules(FILE *outmk, prog_t *p)
{
+ strlst_t *lst;
+
fprintf(outmk, "\n# -------- %s\n\n", p->name);
if(p->srcdir && p->objs) {
@@ -784,8 +792,10 @@ void prog_makefile_rules(FILE *outmk, prog_t *p)
p->name, p->name, p->ident);
fprintf(outmk, "\tld -dc -r -o %s.lo %s_stub.o $(%s_OBJPATHS)\n",
p->name, p->name, p->ident);
- fprintf(outmk, "\tcrunchide -k __crunched_%s_stub %s.lo\n",
- p->ident, p->name);
+ fprintf(outmk, "\tcrunchide -k __crunched_%s_stub ", p->ident);
+ for(lst = p->keeplist; lst != NULL; lst = lst->next)
+ fprintf(outmk, "-k _%s ", lst->str);
+ fprintf(outmk, "%s.lo\n", p->name);
}
void output_strlst(FILE *outf, strlst_t *lst)
diff --git a/usr.sbin/crunch/examples/really-big.conf b/usr.sbin/crunch/examples/really-big.conf
index ce5083f..17c7c64 100644
--- a/usr.sbin/crunch/examples/really-big.conf
+++ b/usr.sbin/crunch/examples/really-big.conf
@@ -89,6 +89,15 @@ srcdirs /usr/src/usr.sbin/timed # timed & timedc
progs timed timedc
special timed srcdir /usr/src/usr.sbin/timed/timed
+srcdirs /usr/src/usr.sbin/xntpd # NTP subsystem
+# xntpd uses a gross hack to pass some information in the global
+# variable `progname' between the actual program (ntpdate in this
+# case), and the NTP library. Add `progname' to the keep list.
+progs ntpdate
+special ntpdate srcdir /usr/src/usr.sbin/xntpd/ntpdate
+special ntpdate keep progname
+libs -L/usr/src/usr.sbin/xntpd/lib -lntp
+
srcdirs /usr/src/usr.sbin/yp # yp subsystem
progs ypbind ypwhich ypcat ypmatch ypset yppoll
OpenPOWER on IntegriCloud