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)
This commit is contained in:
joerg 1997-10-05 13:35:05 +00:00
parent 83ba3307bb
commit f6f80c4875
3 changed files with 33 additions and 4 deletions

View File

@ -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

View File

@ -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)

View File

@ -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