diff options
author | luigi <luigi@FreeBSD.org> | 2002-03-30 16:48:30 +0000 |
---|---|---|
committer | luigi <luigi@FreeBSD.org> | 2002-03-30 16:48:30 +0000 |
commit | de9ccb62a4fa765bda08d7b0bec05e853c87fe22 (patch) | |
tree | cb080bfd397550f13954c4a25eba0a7e2ad1b868 | |
parent | e1a6bcf77d8492a7a09e3a1c5f59c69f8c4ac59a (diff) | |
download | FreeBSD-src-de9ccb62a4fa765bda08d7b0bec05e853c87fe22.zip FreeBSD-src-de9ccb62a4fa765bda08d7b0bec05e853c87fe22.tar.gz |
Add a "special progname lib xxx ..." command to crunchgen
so the .lo files can be partially linked against libraries
which redefine symbols in the standard libs, or which reference
symbols in the objects.
Submitted by: Sam Leffler
MFC After: 3 days
-rw-r--r-- | usr.sbin/crunch/crunchgen/crunchgen.1 | 6 | ||||
-rw-r--r-- | usr.sbin/crunch/crunchgen/crunchgen.c | 19 |
2 files changed, 23 insertions, 2 deletions
diff --git a/usr.sbin/crunch/crunchgen/crunchgen.1 b/usr.sbin/crunch/crunchgen/crunchgen.1 index d925d98..7fe0cad 100644 --- a/usr.sbin/crunch/crunchgen/crunchgen.1 +++ b/usr.sbin/crunch/crunchgen/crunchgen.1 @@ -290,6 +290,12 @@ but some might like to use other conventions or prepend the program's name to the variable, e.g.\& .Va SSHD_OBJS . +.It Ic special Ar progname Ic lib Ar library-name ... +Specifies libraries to be linked with object files to produce +.Ar progname.lo . +This can be useful with libraries which redefine routines in +the standard libraries, or poorly written libraries which +reference symbols in the object files. .It Ic special Ar progname Ic keep Ar symbol-name ... Add specified list of symbols to the keep list for program .Ar progname . diff --git a/usr.sbin/crunch/crunchgen/crunchgen.c b/usr.sbin/crunch/crunchgen/crunchgen.c index 3105883..8383b66 100644 --- a/usr.sbin/crunch/crunchgen/crunchgen.c +++ b/usr.sbin/crunch/crunchgen/crunchgen.c @@ -73,6 +73,7 @@ typedef struct prog { strlst_t *buildopts; strlst_t *keeplist; strlst_t *links; + strlst_t *libs; int goterror; } prog_t; @@ -406,6 +407,7 @@ void add_prog(char *progname) p2->realsrcdir = NULL; p2->objdir = NULL; p2->links = NULL; + p2->libs = NULL; p2->objs = NULL; p2->keeplist = NULL; p2->buildopts = NULL; @@ -506,6 +508,9 @@ void add_special(int argc, char **argv) p->buildopts = NULL; for (i = 3; i < argc; i++) add_string(&p->buildopts, argv[i]); + } else if (!strcmp(argv[2], "lib")) { + for (i = 3; i < argc; i++) + add_string(&p->libs, argv[i]); } else { warnx("%s:%d: bad parameter name `%s', skipping line", curfilename, linenum, argv[2]); @@ -1010,16 +1015,26 @@ void prog_makefile_rules(FILE *outmk, prog_t *p) } fprintf(outmk, "\n"); } + if (p->libs) { + fprintf(outmk, "%s_LIBS=", p->ident); + output_strlst(outmk, p->libs); + } fprintf(outmk, "%s_stub.c:\n", p->name); fprintf(outmk, "\techo \"" "int _crunched_%s_stub(int argc, char **argv, char **envp)" "{return main(argc,argv,envp);}\" >%s_stub.c\n", p->ident, p->name); - fprintf(outmk, "%s.lo: %s_stub.o $(%s_OBJPATHS)\n", + fprintf(outmk, "%s.lo: %s_stub.o $(%s_OBJPATHS)", p->name, p->name, p->ident); - fprintf(outmk, "\tld -dc -r -o %s.lo %s_stub.o $(%s_OBJPATHS)\n", + if (p->libs) + fprintf(outmk, " $(%s_LIBS)", p->ident); + fprintf(outmk, "\n"); + fprintf(outmk, "\tld -dc -r -o %s.lo %s_stub.o $(%s_OBJPATHS)", p->name, p->name, p->ident); + if (p->libs) + fprintf(outmk, " $(%s_LIBS)", p->ident); + fprintf(outmk, "\n"); fprintf(outmk, "\tcrunchide -k _crunched_%s_stub ", p->ident); for (lst = p->keeplist; lst != NULL; lst = lst->next) fprintf(outmk, "-k _%s ", lst->str); |