CVS commit: src/usr.bin/crunch/crunchgen
Module Name:src Committed By: andvar Date: Sun Aug 1 15:52:11 UTC 2021 Modified Files: src/usr.bin/crunch/crunchgen: crunchgen.1 Log Message: fix syntax error and typo in overwritten. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/usr.bin/crunch/crunchgen/crunchgen.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/crunch/crunchgen/crunchgen.1 diff -u src/usr.bin/crunch/crunchgen/crunchgen.1:1.41 src/usr.bin/crunch/crunchgen/crunchgen.1:1.42 --- src/usr.bin/crunch/crunchgen/crunchgen.1:1.41 Thu Jan 2 23:21:14 2020 +++ src/usr.bin/crunch/crunchgen/crunchgen.1 Sun Aug 1 15:52:11 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: crunchgen.1,v 1.41 2020/01/02 23:21:14 wiz Exp $ +.\" $NetBSD: crunchgen.1,v 1.42 2021/08/01 15:52:11 andvar Exp $ .\" .\" Copyright (c) 1994 University of Maryland .\" All Rights Reserved. @@ -128,9 +128,9 @@ Status messages are suppressed. .It Fl v Ar varspec Append a variable specification to the on-the fly generated Makefiles for the individual programs. -.It Fl V ar varspec +.It Fl V Ar varspec Set the variable in the top level Makefile, and pass it in the command -line of all sub-makes, so that it cannot be overwriten. +line of all sub-makes, so that it cannot be overwritten. .El .Sh CRUNCHGEN CONFIGURATION FILE COMMANDS .Nm
CVS commit: src/usr.bin/crunch/crunchgen
Module Name:src Committed By: wiz Date: Thu Jan 2 23:21:14 UTC 2020 Modified Files: src/usr.bin/crunch/crunchgen: crunchgen.1 Log Message: New sentence, new line. Fix typo. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/usr.bin/crunch/crunchgen/crunchgen.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/crunch/crunchgen/crunchgen.1 diff -u src/usr.bin/crunch/crunchgen/crunchgen.1:1.40 src/usr.bin/crunch/crunchgen/crunchgen.1:1.41 --- src/usr.bin/crunch/crunchgen/crunchgen.1:1.40 Thu Jan 2 19:02:41 2020 +++ src/usr.bin/crunch/crunchgen/crunchgen.1 Thu Jan 2 23:21:14 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: crunchgen.1,v 1.40 2020/01/02 19:02:41 christos Exp $ +.\" $NetBSD: crunchgen.1,v 1.41 2020/01/02 23:21:14 wiz Exp $ .\" .\" Copyright (c) 1994 University of Maryland .\" All Rights Reserved. @@ -387,7 +387,7 @@ NOSSP= To set those defaults again, use: .Bd -literal -offset indent -V DBG=-Os \e --V LDSTATIC=-static -V NOPIE \e +-V LDSTATIC=-static -V NOPIE= \e -V NOMAN= \e -V NOFORT= -V NOLIBCSANITIZER= -V NOSANITIZER= -V NOSSP= .Ed @@ -405,10 +405,10 @@ NOPIE= .Ed .Pp The remaining flags just disabled setting the variables that turned off various -sanitizers, fortify, and stack protector. The mapping of those variables to -the old options is: +sanitizers, fortify, and stack protector. +The mapping of those variables to the old options is: .Bl -tag -width XX -offset indent -.It Fl F +.It Fl F .Dv NOFORT .It Fl P .Dv NOSSP
CVS commit: src/usr.bin/crunch/crunchgen
Module Name:src Committed By: christos Date: Thu Jan 2 19:02:41 UTC 2020 Modified Files: src/usr.bin/crunch/crunchgen: crunchgen.1 Log Message: Provide a migration guide from the old flags to -V. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/usr.bin/crunch/crunchgen/crunchgen.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/crunch/crunchgen/crunchgen.1 diff -u src/usr.bin/crunch/crunchgen/crunchgen.1:1.39 src/usr.bin/crunch/crunchgen/crunchgen.1:1.40 --- src/usr.bin/crunch/crunchgen/crunchgen.1:1.39 Sun Dec 29 13:26:16 2019 +++ src/usr.bin/crunch/crunchgen/crunchgen.1 Thu Jan 2 14:02:41 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: crunchgen.1,v 1.39 2019/12/29 18:26:16 christos Exp $ +.\" $NetBSD: crunchgen.1,v 1.40 2020/01/02 19:02:41 christos Exp $ .\" .\" Copyright (c) 1994 University of Maryland .\" All Rights Reserved. @@ -24,7 +24,7 @@ .\" Computer Science Department .\" University of Maryland at College Park .\" -.Dd December 23, 2019 +.Dd January 2, 2020 .Dt CRUNCHGEN 1 .Os .Sh NAME @@ -369,6 +369,54 @@ At this point the binary .Dq kcopy can be copied onto an install floppy and hard-linked to the names of the component programs. +.Sh MIGRATION GUIDE +.Nm +used to have builtin entries for some Makefile variables, namely it +set by default: +.Bd -literal -offset indent +DBG=-Os +LDSTATIC=-static +NOPIE= +NOMAN= +NOFORT= +NOLIBCSANITIZER= +NOSANITIZER= +NOSSP= +.Ed +.Pp +To set those defaults again, use: +.Bd -literal -offset indent +-V DBG=-Os \e +-V LDSTATIC=-static -V NOPIE \e +-V NOMAN= \e +-V NOFORT= -V NOLIBCSANITIZER= -V NOSANITIZER= -V NOSSP= +.Ed +.Pp +The +.Fl p +flag that set pic mode internally set: +.Bd -literal -offset indent +LDSTATIC="-static -pie" +.Ed +.Pp +and did not set: +.Bd -literal -offset indent +NOPIE= +.Ed +.Pp +The remaining flags just disabled setting the variables that turned off various +sanitizers, fortify, and stack protector. The mapping of those variables to +the old options is: +.Bl -tag -width XX -offset indent +.It Fl F +.Dv NOFORT +.It Fl P +.Dv NOSSP +.It Fl S +.Dv NOLIBCSANITIZER +.It Fl s +.Dv NOSANITIZER +.El .Sh SEE ALSO .Xr crunchide 1 , .Xr make 1
CVS commit: src/usr.bin/crunch/crunchgen
Module Name:src Committed By: christos Date: Wed Dec 18 02:16:04 UTC 2019 Modified Files: src/usr.bin/crunch/crunchgen: crunchgen.1 crunchgen.c Log Message: Also disable ssp and fortify by default. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/usr.bin/crunch/crunchgen/crunchgen.1 cvs rdiff -u -r1.92 -r1.93 src/usr.bin/crunch/crunchgen/crunchgen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/crunch/crunchgen/crunchgen.1 diff -u src/usr.bin/crunch/crunchgen/crunchgen.1:1.37 src/usr.bin/crunch/crunchgen/crunchgen.1:1.38 --- src/usr.bin/crunch/crunchgen/crunchgen.1:1.37 Thu Jul 26 04:57:26 2018 +++ src/usr.bin/crunch/crunchgen/crunchgen.1 Tue Dec 17 21:16:04 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: crunchgen.1,v 1.37 2018/07/26 08:57:26 wiz Exp $ +.\" $NetBSD: crunchgen.1,v 1.38 2019/12/18 02:16:04 christos Exp $ .\" .\" Copyright (c) 1994 University of Maryland .\" All Rights Reserved. @@ -32,7 +32,7 @@ .Nd generates build environment for a crunched binary .Sh SYNOPSIS .Nm -.Op Fl fOopqSs +.Op Fl FfOoPpqSs .Op Fl c Ar c-file-name .Op Fl D Ar src-root .Op Fl d Ar build-options @@ -101,6 +101,8 @@ Set crunched binary executable file name .Ar exec-file-name . The default name is .Dq Aq Mt conf-name . +.It Fl F +Enable fortify. .It Fl f Flush cache. Forces the recalculation of cached parameters. @@ -124,6 +126,8 @@ the program objects into a single reloca Use existing object files. Rather than rebuilding object files via reach-over makefiles, instead search for and use existing object files. +.It Fl P +Enable stack protector. .It Fl p Produce static pie (position independent executables). .It Fl q Index: src/usr.bin/crunch/crunchgen/crunchgen.c diff -u src/usr.bin/crunch/crunchgen/crunchgen.c:1.92 src/usr.bin/crunch/crunchgen/crunchgen.c:1.93 --- src/usr.bin/crunch/crunchgen/crunchgen.c:1.92 Thu Feb 14 07:22:06 2019 +++ src/usr.bin/crunch/crunchgen/crunchgen.c Tue Dec 17 21:16:04 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: crunchgen.c,v 1.92 2019/02/14 12:22:06 mrg Exp $ */ +/* $NetBSD: crunchgen.c,v 1.93 2019/12/18 02:16:04 christos Exp $ */ /* * Copyright (c) 1994 University of Maryland * All Rights Reserved. @@ -38,7 +38,7 @@ #include #if !defined(lint) -__RCSID("$NetBSD: crunchgen.c,v 1.92 2019/02/14 12:22:06 mrg Exp $"); +__RCSID("$NetBSD: crunchgen.c,v 1.93 2019/12/18 02:16:04 christos Exp $"); #endif #include @@ -104,6 +104,7 @@ static const char *pname = "crunchgen"; /* options */ static int verbose, readcache, useobjs, oneobj, pie, libcsanitizer, sanitizer; +static int ssp, fortify; static int reading_cache; static char *machine; @@ -159,10 +160,12 @@ main(int argc, char **argv) if (argc > 0) pname = argv[0]; -while ((optc = getopt(argc, argv, "m:c:d:e:fopqsD:L:Ov:")) != -1) { +while ((optc = getopt(argc, argv, "m:c:d:e:FfopPqsD:L:Ov:")) != -1) { switch(optc) { case 'f': readcache = 0; break; + case 'F': fortify = 1; break; case 'p': pie = 1; break; + case 'P': ssp = 1; break; case 'q': verbose = 0; break; case 'O': oneobj = 0; break; case 'o': useobjs = 1, oneobj = 0; break; @@ -225,7 +228,7 @@ void usage(void) { fprintf(stderr, - "%s [-fOopqSs] [-c c-file-name] [-D src-root] [-d build-options]\n" + "%s [-FfOoPpqSs] [-c c-file-name] [-D src-root] [-d build-options]\n" "\t [-e exec-file-name] [-L lib-dir] [-m makefile-name]\n" "\t [-v var-spec] conf-file\n", pname); exit(1); @@ -557,7 +560,7 @@ static void gen_output_cfile(void); static void fillin_program_objs(prog_t *p, char *path); static void top_makefile_rules(FILE *outmk); static void bottom_makefile_rules(FILE *outmk); -static void prog_makefile_rules(FILE *outmk, prog_t *p); +static void prog_makefile_rules(FILE *outmk, prog_t *p, const char *); static void output_strlst(FILE *outf, strlst_t *lst); static char *genident(char *str); static char *dir_search(char *progname); @@ -804,10 +807,36 @@ gen_specials_cache(void) static void +addno(char *str, size_t len, const char *stem) +{ + char buf[128]; + snprintf(buf, sizeof(buf), "NO%s=\n", stem); + strlcat(str, buf, len); +} + + +static void gen_output_makefile(void) { prog_t *p; FILE *outmk; +char noes[1024], *ptr; + +noes[0] = '\0'; + +if (!pie) + addno(noes, sizeof(noes), "PIE"); +if (!ssp) + addno(noes, sizeof(noes), "SSP"); +if (!fortify) + addno(noes, sizeof(noes), "FORT"); +if (!libcsanitizer) + addno(noes, sizeof(noes), "LIBCSANITIZER"); +if (!sanitizer) + addno(noes, sizeof(noes), "SANITIZER"); + +addno(noes, sizeof(noes), "MAN"); + (void)snprintf(line, sizeof(line), "generating %s", outmkname); status(line); @@ -821,10 +850,14 @@ gen_output_makefile(void) fprintf(outmk, "# %s - generated from %s by crunchgen %s\n\n", outmkname, infilename, CRUNCH_VERSION); +
CVS commit: src/usr.bin/crunch/crunchgen
Module Name:src Committed By: mrg Date: Thu Feb 14 12:22:06 UTC 2019 Modified Files: src/usr.bin/crunch/crunchgen: crunchgen.c Log Message: remove the hack to remove .eh_frame -- gcc7 is fixed it seems. To generate a diff of this commit: cvs rdiff -u -r1.91 -r1.92 src/usr.bin/crunch/crunchgen/crunchgen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/crunch/crunchgen/crunchgen.c diff -u src/usr.bin/crunch/crunchgen/crunchgen.c:1.91 src/usr.bin/crunch/crunchgen/crunchgen.c:1.92 --- src/usr.bin/crunch/crunchgen/crunchgen.c:1.91 Wed Feb 13 20:48:56 2019 +++ src/usr.bin/crunch/crunchgen/crunchgen.c Thu Feb 14 12:22:06 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: crunchgen.c,v 1.91 2019/02/13 20:48:56 mrg Exp $ */ +/* $NetBSD: crunchgen.c,v 1.92 2019/02/14 12:22:06 mrg Exp $ */ /* * Copyright (c) 1994 University of Maryland * All Rights Reserved. @@ -38,7 +38,7 @@ #include #if !defined(lint) -__RCSID("$NetBSD: crunchgen.c,v 1.91 2019/02/13 20:48:56 mrg Exp $"); +__RCSID("$NetBSD: crunchgen.c,v 1.92 2019/02/14 12:22:06 mrg Exp $"); #endif #include @@ -964,11 +964,7 @@ top_makefile_rules(FILE *outmk) fprintf(outmk, "OBJCOPY_REMOVE_FLAGS=-R .eh_frame_hdr -R .note -R .note.netbsd.pax -R .ident -R .comment -R .copyright\n\n"); -fprintf(outmk, ".if !(${MACHINE} == \"sparc\" || \\\n"); -fprintf(outmk, " ${MACHINE} == \"sparc64\" || \\\n"); -fprintf(outmk, " ${MACHINE_ARCH:C/mips(e|64e)[bl]/mips/} == \"mips\")\n"); fprintf(outmk, "OBJCOPY_REMOVE_FLAGS+=-R .eh_frame\n"); -fprintf(outmk, ".endif\n"); fprintf(outmk, ".if ${MACHINE} != \"sparc64\"\n"); fprintf(outmk, "OBJCOPY_REMOVE_FLAGS+=-R .note.netbsd.mcmodel\n"); fprintf(outmk, ".endif\n\n");
CVS commit: src/usr.bin/crunch/crunchgen
Module Name:src Committed By: mrg Date: Wed Feb 13 20:48:56 UTC 2019 Modified Files: src/usr.bin/crunch/crunchgen: crunchgen.c Log Message: while we're still figuring out the gcc7 vs .eh_frame issue, apply the don't remove eh_frame hack to mips as well. hpcmips testbed is also failing currently: [ 3.1238738] panic: init died (signal 6, exit 12) To generate a diff of this commit: cvs rdiff -u -r1.90 -r1.91 src/usr.bin/crunch/crunchgen/crunchgen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/crunch/crunchgen/crunchgen.c diff -u src/usr.bin/crunch/crunchgen/crunchgen.c:1.90 src/usr.bin/crunch/crunchgen/crunchgen.c:1.91 --- src/usr.bin/crunch/crunchgen/crunchgen.c:1.90 Tue Feb 12 10:16:58 2019 +++ src/usr.bin/crunch/crunchgen/crunchgen.c Wed Feb 13 20:48:56 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: crunchgen.c,v 1.90 2019/02/12 10:16:58 mrg Exp $ */ +/* $NetBSD: crunchgen.c,v 1.91 2019/02/13 20:48:56 mrg Exp $ */ /* * Copyright (c) 1994 University of Maryland * All Rights Reserved. @@ -38,7 +38,7 @@ #include #if !defined(lint) -__RCSID("$NetBSD: crunchgen.c,v 1.90 2019/02/12 10:16:58 mrg Exp $"); +__RCSID("$NetBSD: crunchgen.c,v 1.91 2019/02/13 20:48:56 mrg Exp $"); #endif #include @@ -964,7 +964,9 @@ top_makefile_rules(FILE *outmk) fprintf(outmk, "OBJCOPY_REMOVE_FLAGS=-R .eh_frame_hdr -R .note -R .note.netbsd.pax -R .ident -R .comment -R .copyright\n\n"); -fprintf(outmk, ".if ${MACHINE} != \"sparc\" && ${MACHINE} != \"sparc64\"\n"); +fprintf(outmk, ".if !(${MACHINE} == \"sparc\" || \\\n"); +fprintf(outmk, " ${MACHINE} == \"sparc64\" || \\\n"); +fprintf(outmk, " ${MACHINE_ARCH:C/mips(e|64e)[bl]/mips/} == \"mips\")\n"); fprintf(outmk, "OBJCOPY_REMOVE_FLAGS+=-R .eh_frame\n"); fprintf(outmk, ".endif\n"); fprintf(outmk, ".if ${MACHINE} != \"sparc64\"\n");
CVS commit: src/usr.bin/crunch/crunchgen
Module Name:src Committed By: mrg Date: Tue Feb 12 10:16:58 UTC 2019 Modified Files: src/usr.bin/crunch/crunchgen: crunchgen.c Log Message: hack alert time: on sparc and sparc64, don't remove .eh_frame section. it leads to failure as something is referenced, and objcopy ends up emitting a broken binary that can't be run -- it attempts to load at va=0, beyond having missing referenced data. also, on sparc64 also don't remove .note.netbsd.mcmodel. the former should be revised when we can avoid it. To generate a diff of this commit: cvs rdiff -u -r1.89 -r1.90 src/usr.bin/crunch/crunchgen/crunchgen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/crunch/crunchgen/crunchgen.c diff -u src/usr.bin/crunch/crunchgen/crunchgen.c:1.89 src/usr.bin/crunch/crunchgen/crunchgen.c:1.90 --- src/usr.bin/crunch/crunchgen/crunchgen.c:1.89 Thu Jul 26 08:57:32 2018 +++ src/usr.bin/crunch/crunchgen/crunchgen.c Tue Feb 12 10:16:58 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: crunchgen.c,v 1.89 2018/07/26 08:57:32 wiz Exp $ */ +/* $NetBSD: crunchgen.c,v 1.90 2019/02/12 10:16:58 mrg Exp $ */ /* * Copyright (c) 1994 University of Maryland * All Rights Reserved. @@ -38,7 +38,7 @@ #include #if !defined(lint) -__RCSID("$NetBSD: crunchgen.c,v 1.89 2018/07/26 08:57:32 wiz Exp $"); +__RCSID("$NetBSD: crunchgen.c,v 1.90 2019/02/12 10:16:58 mrg Exp $"); #endif #include @@ -961,6 +961,15 @@ top_makefile_rules(FILE *outmk) fprintf(outmk, "LDSTATIC=-static%s\n\n", pie ? " -pie" : ""); fprintf(outmk, "PROG=%s\n\n", execfname); + +fprintf(outmk, "OBJCOPY_REMOVE_FLAGS=-R .eh_frame_hdr -R .note -R .note.netbsd.pax -R .ident -R .comment -R .copyright\n\n"); + +fprintf(outmk, ".if ${MACHINE} != \"sparc\" && ${MACHINE} != \"sparc64\"\n"); +fprintf(outmk, "OBJCOPY_REMOVE_FLAGS+=-R .eh_frame\n"); +fprintf(outmk, ".endif\n"); +fprintf(outmk, ".if ${MACHINE} != \"sparc64\"\n"); +fprintf(outmk, "OBJCOPY_REMOVE_FLAGS+=-R .note.netbsd.mcmodel\n"); +fprintf(outmk, ".endif\n\n"); fprintf(outmk, "all: ${PROG}.crunched\n"); fprintf(outmk, "${PROG}.crunched: ${SUBMAKE_TARGETS} .WAIT ${PROG}.strip\n"); @@ -969,7 +978,7 @@ top_makefile_rules(FILE *outmk) fprintf(outmk, "\t@[ -f ${PROG}.unstripped -a ! ${PROG} -nt ${PROG}.unstripped ] || { \\\n"); fprintf(outmk, "\t\t${_MKSHMSG:Uecho} \" strip \" ${PROG}; \\\n"); fprintf(outmk, "\t\tcp ${PROG} ${PROG}.unstripped && \\\n"); -fprintf(outmk, "\t\t${OBJCOPY} -S -R .eh_frame -R .eh_frame_hdr -R .note -R .note.netbsd.mcmodel -R .note.netbsd.pax -R .ident -R .comment -R .copyright ${PROG} && \\\n"); +fprintf(outmk, "\t\t${OBJCOPY} -S ${OBJCOPY_REMOVE_FLAGS} ${PROG} && \\\n"); fprintf(outmk, "\t\ttouch ${PROG}.unstripped; \\\n"); fprintf(outmk, "\t}\n"); fprintf(outmk, "objs: $(SUBMAKE_TARGETS)\n");
CVS commit: src/usr.bin/crunch/crunchgen
Module Name:src Committed By: wiz Date: Thu Jul 26 08:57:26 UTC 2018 Modified Files: src/usr.bin/crunch/crunchgen: crunchgen.1 Log Message: Add -S to SYNOPSIS. Sort option descriptions. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/usr.bin/crunch/crunchgen/crunchgen.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/crunch/crunchgen/crunchgen.1 diff -u src/usr.bin/crunch/crunchgen/crunchgen.1:1.36 src/usr.bin/crunch/crunchgen/crunchgen.1:1.37 --- src/usr.bin/crunch/crunchgen/crunchgen.1:1.36 Wed Jul 25 23:41:28 2018 +++ src/usr.bin/crunch/crunchgen/crunchgen.1 Thu Jul 26 08:57:26 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: crunchgen.1,v 1.36 2018/07/25 23:41:28 kamil Exp $ +.\" $NetBSD: crunchgen.1,v 1.37 2018/07/26 08:57:26 wiz Exp $ .\" .\" Copyright (c) 1994 University of Maryland .\" All Rights Reserved. @@ -32,7 +32,7 @@ .Nd generates build environment for a crunched binary .Sh SYNOPSIS .Nm -.Op Fl fOopqs +.Op Fl fOopqSs .Op Fl c Ar c-file-name .Op Fl D Ar src-root .Op Fl d Ar build-options @@ -129,10 +129,10 @@ Produce static pie (position independent .It Fl q Quiet operation. Status messages are suppressed. -.It Fl s -Enable sanitization. .It Fl S Enable sanitization with a sanitizer in libc. +.It Fl s +Enable sanitization. .It Fl v Ar varspec Append a variable specification to the on-the fly generated Makefile. .El
CVS commit: src/usr.bin/crunch/crunchgen
Module Name:src Committed By: wiz Date: Thu Jul 26 08:57:33 UTC 2018 Modified Files: src/usr.bin/crunch/crunchgen: crunchgen.c Log Message: Sync usage with man page. To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/usr.bin/crunch/crunchgen/crunchgen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/crunch/crunchgen/crunchgen.c diff -u src/usr.bin/crunch/crunchgen/crunchgen.c:1.88 src/usr.bin/crunch/crunchgen/crunchgen.c:1.89 --- src/usr.bin/crunch/crunchgen/crunchgen.c:1.88 Wed Jul 25 23:41:28 2018 +++ src/usr.bin/crunch/crunchgen/crunchgen.c Thu Jul 26 08:57:32 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: crunchgen.c,v 1.88 2018/07/25 23:41:28 kamil Exp $ */ +/* $NetBSD: crunchgen.c,v 1.89 2018/07/26 08:57:32 wiz Exp $ */ /* * Copyright (c) 1994 University of Maryland * All Rights Reserved. @@ -38,7 +38,7 @@ #include #if !defined(lint) -__RCSID("$NetBSD: crunchgen.c,v 1.88 2018/07/25 23:41:28 kamil Exp $"); +__RCSID("$NetBSD: crunchgen.c,v 1.89 2018/07/26 08:57:32 wiz Exp $"); #endif #include @@ -225,7 +225,7 @@ void usage(void) { fprintf(stderr, - "%s [-fOoq] [-c c-file-name] [-D src-root] [-d build-options]\n" + "%s [-fOopqSs] [-c c-file-name] [-D src-root] [-d build-options]\n" "\t [-e exec-file-name] [-L lib-dir] [-m makefile-name]\n" "\t [-v var-spec] conf-file\n", pname); exit(1);
CVS commit: src/usr.bin/crunch/crunchgen
Module Name:src Committed By: kamil Date: Wed Jul 25 23:41:28 UTC 2018 Modified Files: src/usr.bin/crunch/crunchgen: crunchgen.1 crunchgen.c Log Message: Introduce a new option -S in crunchgen(1) The -S argument enables sanitization with a sanitizer in libc. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/usr.bin/crunch/crunchgen/crunchgen.1 cvs rdiff -u -r1.87 -r1.88 src/usr.bin/crunch/crunchgen/crunchgen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/crunch/crunchgen/crunchgen.1 diff -u src/usr.bin/crunch/crunchgen/crunchgen.1:1.35 src/usr.bin/crunch/crunchgen/crunchgen.1:1.36 --- src/usr.bin/crunch/crunchgen/crunchgen.1:1.35 Thu Jun 21 10:55:54 2018 +++ src/usr.bin/crunch/crunchgen/crunchgen.1 Wed Jul 25 23:41:28 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: crunchgen.1,v 1.35 2018/06/21 10:55:54 kamil Exp $ +.\" $NetBSD: crunchgen.1,v 1.36 2018/07/25 23:41:28 kamil Exp $ .\" .\" Copyright (c) 1994 University of Maryland .\" All Rights Reserved. @@ -131,6 +131,8 @@ Quiet operation. Status messages are suppressed. .It Fl s Enable sanitization. +.It Fl S +Enable sanitization with a sanitizer in libc. .It Fl v Ar varspec Append a variable specification to the on-the fly generated Makefile. .El Index: src/usr.bin/crunch/crunchgen/crunchgen.c diff -u src/usr.bin/crunch/crunchgen/crunchgen.c:1.87 src/usr.bin/crunch/crunchgen/crunchgen.c:1.88 --- src/usr.bin/crunch/crunchgen/crunchgen.c:1.87 Thu Jun 21 10:55:54 2018 +++ src/usr.bin/crunch/crunchgen/crunchgen.c Wed Jul 25 23:41:28 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: crunchgen.c,v 1.87 2018/06/21 10:55:54 kamil Exp $ */ +/* $NetBSD: crunchgen.c,v 1.88 2018/07/25 23:41:28 kamil Exp $ */ /* * Copyright (c) 1994 University of Maryland * All Rights Reserved. @@ -38,7 +38,7 @@ #include #if !defined(lint) -__RCSID("$NetBSD: crunchgen.c,v 1.87 2018/06/21 10:55:54 kamil Exp $"); +__RCSID("$NetBSD: crunchgen.c,v 1.88 2018/07/25 23:41:28 kamil Exp $"); #endif #include @@ -102,7 +102,9 @@ static int goterror = 0; static const char *pname = "crunchgen"; -static int verbose, readcache, useobjs, oneobj, pie, sanitizer; /* options */ +/* options */ +static int verbose, readcache, useobjs, oneobj, pie, libcsanitizer, sanitizer; + static int reading_cache; static char *machine; static char *makeobjdirprefix; @@ -165,6 +167,7 @@ main(int argc, char **argv) case 'O': oneobj = 0; break; case 'o': useobjs = 1, oneobj = 0; break; case 's': sanitizer = 1; break; + case 'S': libcsanitizer = 1; break; case 'm': (void)estrlcpy(outmkname, optarg, sizeof(outmkname)); break; case 'c': (void)estrlcpy(outcfname, optarg, sizeof(outcfname)); break; @@ -923,6 +926,8 @@ top_makefile_rules(FILE *outmk) if (!pie) fprintf(outmk, "NOPIE=\n"); +if (!libcsanitizer) + fprintf(outmk, "NOLIBCSANITIZER=\n"); if (!sanitizer) fprintf(outmk, "NOSANITIZER=\n"); fprintf(outmk, "NOMAN=\n\n"); @@ -1020,7 +1025,7 @@ prog_makefile_rules(FILE *outmk, prog_t for (lst = vars; lst != NULL; lst = lst->next) fprintf(outmk, "%s\\n", lst->str); fprintf(outmk, "'\\\n"); - fprintf(outmk, MAKECMD "%s ", sanitizer ? "" : "NOSANITIZER="); + fprintf(outmk, MAKECMD "%s %s ", libcsanitizer ? "" : "NOLIBCSANITIZER=", sanitizer ? "" : "NOSANITIZER="); if (p->objs) fprintf(outmk, "${%s_OBJS} ) \n\n", p->ident); else
CVS commit: src/usr.bin/crunch/crunchgen
Module Name:src Committed By: kamil Date: Thu Jun 21 10:55:54 UTC 2018 Modified Files: src/usr.bin/crunch/crunchgen: crunchgen.1 crunchgen.c Log Message: Add new option -s to crunchgen(1) -- enable sanitization As of today typical sanitizers require dynamic executables, while crunchgen(1) programs are produced with static properties. Lack of specified -s will: - generate a Makefile file with NOSANITIZER= - build programs that are dependencies with NOSANITIZER= In future there is an option to handle sanitization in statically linked programs. An idea with -s LGTM by To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/usr.bin/crunch/crunchgen/crunchgen.1 cvs rdiff -u -r1.86 -r1.87 src/usr.bin/crunch/crunchgen/crunchgen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/crunch/crunchgen/crunchgen.1 diff -u src/usr.bin/crunch/crunchgen/crunchgen.1:1.34 src/usr.bin/crunch/crunchgen/crunchgen.1:1.35 --- src/usr.bin/crunch/crunchgen/crunchgen.1:1.34 Mon Oct 9 10:31:50 2017 +++ src/usr.bin/crunch/crunchgen/crunchgen.1 Thu Jun 21 10:55:54 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: crunchgen.1,v 1.34 2017/10/09 10:31:50 wiz Exp $ +.\" $NetBSD: crunchgen.1,v 1.35 2018/06/21 10:55:54 kamil Exp $ .\" .\" Copyright (c) 1994 University of Maryland .\" All Rights Reserved. @@ -24,7 +24,7 @@ .\" Computer Science Department .\" University of Maryland at College Park .\" -.Dd May 31, 2017 +.Dd June 21, 2018 .Dt CRUNCHGEN 1 .Os .Sh NAME @@ -32,7 +32,7 @@ .Nd generates build environment for a crunched binary .Sh SYNOPSIS .Nm -.Op Fl fOopq +.Op Fl fOopqs .Op Fl c Ar c-file-name .Op Fl D Ar src-root .Op Fl d Ar build-options @@ -129,6 +129,8 @@ Produce static pie (position independent .It Fl q Quiet operation. Status messages are suppressed. +.It Fl s +Enable sanitization. .It Fl v Ar varspec Append a variable specification to the on-the fly generated Makefile. .El Index: src/usr.bin/crunch/crunchgen/crunchgen.c diff -u src/usr.bin/crunch/crunchgen/crunchgen.c:1.86 src/usr.bin/crunch/crunchgen/crunchgen.c:1.87 --- src/usr.bin/crunch/crunchgen/crunchgen.c:1.86 Tue May 8 23:05:17 2018 +++ src/usr.bin/crunch/crunchgen/crunchgen.c Thu Jun 21 10:55:54 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: crunchgen.c,v 1.86 2018/05/08 23:05:17 mrg Exp $ */ +/* $NetBSD: crunchgen.c,v 1.87 2018/06/21 10:55:54 kamil Exp $ */ /* * Copyright (c) 1994 University of Maryland * All Rights Reserved. @@ -38,7 +38,7 @@ #include #if !defined(lint) -__RCSID("$NetBSD: crunchgen.c,v 1.86 2018/05/08 23:05:17 mrg Exp $"); +__RCSID("$NetBSD: crunchgen.c,v 1.87 2018/06/21 10:55:54 kamil Exp $"); #endif #include @@ -102,7 +102,7 @@ static int goterror = 0; static const char *pname = "crunchgen"; -static int verbose, readcache, useobjs, oneobj, pie; /* options */ +static int verbose, readcache, useobjs, oneobj, pie, sanitizer; /* options */ static int reading_cache; static char *machine; static char *makeobjdirprefix; @@ -157,13 +157,14 @@ main(int argc, char **argv) if (argc > 0) pname = argv[0]; -while ((optc = getopt(argc, argv, "m:c:d:e:fopqD:L:Ov:")) != -1) { +while ((optc = getopt(argc, argv, "m:c:d:e:fopqsD:L:Ov:")) != -1) { switch(optc) { case 'f': readcache = 0; break; case 'p': pie = 1; break; case 'q': verbose = 0; break; case 'O': oneobj = 0; break; case 'o': useobjs = 1, oneobj = 0; break; + case 's': sanitizer = 1; break; case 'm': (void)estrlcpy(outmkname, optarg, sizeof(outmkname)); break; case 'c': (void)estrlcpy(outcfname, optarg, sizeof(outcfname)); break; @@ -922,6 +923,8 @@ top_makefile_rules(FILE *outmk) if (!pie) fprintf(outmk, "NOPIE=\n"); +if (!sanitizer) + fprintf(outmk, "NOSANITIZER=\n"); fprintf(outmk, "NOMAN=\n\n"); fprintf(outmk, "DBG=%s\n", dbg); @@ -1017,7 +1020,7 @@ prog_makefile_rules(FILE *outmk, prog_t for (lst = vars; lst != NULL; lst = lst->next) fprintf(outmk, "%s\\n", lst->str); fprintf(outmk, "'\\\n"); - fprintf(outmk, MAKECMD); + fprintf(outmk, MAKECMD "%s ", sanitizer ? "" : "NOSANITIZER="); if (p->objs) fprintf(outmk, "${%s_OBJS} ) \n\n", p->ident); else
CVS commit: src/usr.bin/crunch/crunchgen
Module Name:src Committed By: mrg Date: Tue May 8 23:05:17 UTC 2018 Modified Files: src/usr.bin/crunch/crunchgen: crunchgen.c Log Message: in dir_search(), don't assume a directory existing is useful, instead confirm that there is a non zero makefile in there. (this assumes the makefile is called "Makefile", which is assumed in other places in crunchgen.c already, so this doesn't make it worse.) this fixes build issues when an empty subdir exists because some files were moved subdir at some stage (ktrace, rcorder), and a non-prune update may look in the wrong dir. bump version (lots of updates between now and the previous update.) To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.86 src/usr.bin/crunch/crunchgen/crunchgen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/crunch/crunchgen/crunchgen.c diff -u src/usr.bin/crunch/crunchgen/crunchgen.c:1.85 src/usr.bin/crunch/crunchgen/crunchgen.c:1.86 --- src/usr.bin/crunch/crunchgen/crunchgen.c:1.85 Sun Oct 8 15:06:17 2017 +++ src/usr.bin/crunch/crunchgen/crunchgen.c Tue May 8 23:05:17 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: crunchgen.c,v 1.85 2017/10/08 15:06:17 christos Exp $ */ +/* $NetBSD: crunchgen.c,v 1.86 2018/05/08 23:05:17 mrg Exp $ */ /* * Copyright (c) 1994 University of Maryland * All Rights Reserved. @@ -38,7 +38,7 @@ #include #if !defined(lint) -__RCSID("$NetBSD: crunchgen.c,v 1.85 2017/10/08 15:06:17 christos Exp $"); +__RCSID("$NetBSD: crunchgen.c,v 1.86 2018/05/08 23:05:17 mrg Exp $"); #endif #include @@ -55,7 +55,7 @@ __RCSID("$NetBSD: crunchgen.c,v 1.85 201 #include #include -#define CRUNCH_VERSION "20050208" +#define CRUNCH_VERSION "20180508" #define MAXLINELEN 16384 #define MAXFIELDS 2048 @@ -907,8 +907,8 @@ dir_search(char *progname) strlst_t *dir; for (dir=srcdirs; dir != NULL; dir=dir->next) { - (void)snprintf(path, sizeof(path), "%s/%s", dir->str, progname); - if (is_dir(path)) + snprintf(path, sizeof(path), "%s/%s/Makefile", dir->str, progname); + if (is_nonempty_file(path)) return dir->str; } return NULL;
CVS commit: src/usr.bin/crunch/crunchgen
Module Name:src Committed By: wiz Date: Mon Oct 9 10:31:50 UTC 2017 Modified Files: src/usr.bin/crunch/crunchgen: crunchgen.1 Log Message: New sentence, new line. Remove superfluous Pps. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/usr.bin/crunch/crunchgen/crunchgen.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/crunch/crunchgen/crunchgen.1 diff -u src/usr.bin/crunch/crunchgen/crunchgen.1:1.33 src/usr.bin/crunch/crunchgen/crunchgen.1:1.34 --- src/usr.bin/crunch/crunchgen/crunchgen.1:1.33 Sun Oct 8 15:06:17 2017 +++ src/usr.bin/crunch/crunchgen/crunchgen.1 Mon Oct 9 10:31:50 2017 @@ -1,4 +1,4 @@ -.\" $NetBSD: crunchgen.1,v 1.33 2017/10/08 15:06:17 christos Exp $ +.\" $NetBSD: crunchgen.1,v 1.34 2017/10/09 10:31:50 wiz Exp $ .\" .\" Copyright (c) 1994 University of Maryland .\" All Rights Reserved. @@ -334,7 +334,6 @@ Here is an example .Em crunchgen input conf file, named .Dq Pa kcopy.conf : -.Pp .Bd -literal -offset indent srcdirs /usr/src/bin /usr/src/sbin @@ -358,7 +357,6 @@ line. The crunched binary .Dq kcopy can be built as follows: -.Pp .Bd -literal -offset indent % crunchgen -m Makefile kcopy.conf# gen Makefile and kcopy.c % make objs # build the component programs' .o files @@ -379,7 +377,8 @@ and hard-linked to the names of the comp was written by .An James da Silva Aq Mt j...@cs.umd.edu . .Pp -Copyright (c) 1994 University of Maryland. All Rights Reserved. +Copyright (c) 1994 University of Maryland. +All Rights Reserved. .Sh BUGS While .Nm @@ -402,7 +401,6 @@ some other arrangements made. If a program directory being searched for is found, but contains no objects, other directories are not searched. This causes the following directive to fail: -.Pp .Bd -literal -offset indent srcdirs /usr/src/usr.bin /usr/src/usr.bin/less progs less gzip @@ -420,7 +418,6 @@ fails to find objects for the program. To avoid this problem, list specific srcdirs first, and the more general ones later, for e.g.: -.Pp .Bd -literal -offset indent srcdirs /usr/src/usr.bin/less /usr/src/usr.bin progs less gzip
CVS commit: src/usr.bin/crunch/crunchgen
Module Name:src Committed By: christos Date: Sun Oct 8 15:06:17 UTC 2017 Modified Files: src/usr.bin/crunch/crunchgen: crunchgen.1 crunchgen.c Log Message: Handle static PIE To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/usr.bin/crunch/crunchgen/crunchgen.1 cvs rdiff -u -r1.84 -r1.85 src/usr.bin/crunch/crunchgen/crunchgen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/crunch/crunchgen/crunchgen.1 diff -u src/usr.bin/crunch/crunchgen/crunchgen.1:1.32 src/usr.bin/crunch/crunchgen/crunchgen.1:1.33 --- src/usr.bin/crunch/crunchgen/crunchgen.1:1.32 Tue Mar 18 14:20:44 2014 +++ src/usr.bin/crunch/crunchgen/crunchgen.1 Sun Oct 8 11:06:17 2017 @@ -1,4 +1,4 @@ -.\" $NetBSD: crunchgen.1,v 1.32 2014/03/18 18:20:44 riastradh Exp $ +.\" $NetBSD: crunchgen.1,v 1.33 2017/10/08 15:06:17 christos Exp $ .\" .\" Copyright (c) 1994 University of Maryland .\" All Rights Reserved. @@ -24,7 +24,7 @@ .\" Computer Science Department .\" University of Maryland at College Park .\" -.Dd June 10, 2013 +.Dd May 31, 2017 .Dt CRUNCHGEN 1 .Os .Sh NAME @@ -32,7 +32,7 @@ .Nd generates build environment for a crunched binary .Sh SYNOPSIS .Nm -.Op Fl fOoq +.Op Fl fOopq .Op Fl c Ar c-file-name .Op Fl D Ar src-root .Op Fl d Ar build-options @@ -124,6 +124,8 @@ the program objects into a single reloca Use existing object files. Rather than rebuilding object files via reach-over makefiles, instead search for and use existing object files. +.It Fl p +Produce static pie (position independent executables). .It Fl q Quiet operation. Status messages are suppressed. Index: src/usr.bin/crunch/crunchgen/crunchgen.c diff -u src/usr.bin/crunch/crunchgen/crunchgen.c:1.84 src/usr.bin/crunch/crunchgen/crunchgen.c:1.85 --- src/usr.bin/crunch/crunchgen/crunchgen.c:1.84 Sun May 29 12:12:58 2016 +++ src/usr.bin/crunch/crunchgen/crunchgen.c Sun Oct 8 11:06:17 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: crunchgen.c,v 1.84 2016/05/29 16:12:58 christos Exp $ */ +/* $NetBSD: crunchgen.c,v 1.85 2017/10/08 15:06:17 christos Exp $ */ /* * Copyright (c) 1994 University of Maryland * All Rights Reserved. @@ -38,7 +38,7 @@ #include #if !defined(lint) -__RCSID("$NetBSD: crunchgen.c,v 1.84 2016/05/29 16:12:58 christos Exp $"); +__RCSID("$NetBSD: crunchgen.c,v 1.85 2017/10/08 15:06:17 christos Exp $"); #endif #include @@ -102,7 +102,7 @@ static int goterror = 0; static const char *pname = "crunchgen"; -static int verbose, readcache, useobjs, oneobj; /* options */ +static int verbose, readcache, useobjs, oneobj, pie; /* options */ static int reading_cache; static char *machine; static char *makeobjdirprefix; @@ -151,14 +151,16 @@ main(int argc, char **argv) readcache = 1; useobjs = 0; oneobj = 1; +pie = 0; *outmkname = *outcfname = *execfname = '\0'; if (argc > 0) pname = argv[0]; -while ((optc = getopt(argc, argv, "m:c:d:e:foqD:L:Ov:")) != -1) { +while ((optc = getopt(argc, argv, "m:c:d:e:fopqD:L:Ov:")) != -1) { switch(optc) { case 'f': readcache = 0; break; + case 'p': pie = 1; break; case 'q': verbose = 0; break; case 'O': oneobj = 0; break; case 'o': useobjs = 1, oneobj = 0; break; @@ -918,7 +920,8 @@ top_makefile_rules(FILE *outmk) { prog_t *p; -fprintf(outmk, "NOPIE=\n"); +if (!pie) + fprintf(outmk, "NOPIE=\n"); fprintf(outmk, "NOMAN=\n\n"); fprintf(outmk, "DBG=%s\n", dbg); @@ -948,7 +951,7 @@ top_makefile_rules(FILE *outmk) fprintf(outmk, " %s_make", p->ident); fprintf(outmk, "\n\n"); -fprintf(outmk, "LDSTATIC=-static\n\n"); +fprintf(outmk, "LDSTATIC=-static%s\n\n", pie ? " -pie" : ""); fprintf(outmk, "PROG=%s\n\n", execfname); fprintf(outmk, "all: ${PROG}.crunched\n");
CVS commit: src/usr.bin/crunch/crunchgen
Module Name:src Committed By: christos Date: Sun May 29 16:12:58 UTC 2016 Modified Files: src/usr.bin/crunch/crunchgen: crunchgen.c Log Message: Don't make crunch binaries PIE To generate a diff of this commit: cvs rdiff -u -r1.83 -r1.84 src/usr.bin/crunch/crunchgen/crunchgen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/crunch/crunchgen/crunchgen.c diff -u src/usr.bin/crunch/crunchgen/crunchgen.c:1.83 src/usr.bin/crunch/crunchgen/crunchgen.c:1.84 --- src/usr.bin/crunch/crunchgen/crunchgen.c:1.83 Fri May 15 22:33:12 2015 +++ src/usr.bin/crunch/crunchgen/crunchgen.c Sun May 29 12:12:58 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: crunchgen.c,v 1.83 2015/05/16 02:33:12 matt Exp $ */ +/* $NetBSD: crunchgen.c,v 1.84 2016/05/29 16:12:58 christos Exp $ */ /* * Copyright (c) 1994 University of Maryland * All Rights Reserved. @@ -38,7 +38,7 @@ #include #if !defined(lint) -__RCSID("$NetBSD: crunchgen.c,v 1.83 2015/05/16 02:33:12 matt Exp $"); +__RCSID("$NetBSD: crunchgen.c,v 1.84 2016/05/29 16:12:58 christos Exp $"); #endif #include @@ -918,6 +918,7 @@ top_makefile_rules(FILE *outmk) { prog_t *p; +fprintf(outmk, "NOPIE=\n"); fprintf(outmk, "NOMAN=\n\n"); fprintf(outmk, "DBG=%s\n", dbg);
CVS commit: src/usr.bin/crunch/crunchgen
Module Name:src Committed By: matt Date: Sat May 16 02:33:12 UTC 2015 Modified Files: src/usr.bin/crunch/crunchgen: crunchgen.c Log Message: Use :Q instead of to quote make vars DBG and LDSTATIC To generate a diff of this commit: cvs rdiff -u -r1.82 -r1.83 src/usr.bin/crunch/crunchgen/crunchgen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/crunch/crunchgen/crunchgen.c diff -u src/usr.bin/crunch/crunchgen/crunchgen.c:1.82 src/usr.bin/crunch/crunchgen/crunchgen.c:1.83 --- src/usr.bin/crunch/crunchgen/crunchgen.c:1.82 Sat Jan 4 08:58:51 2014 +++ src/usr.bin/crunch/crunchgen/crunchgen.c Sat May 16 02:33:12 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: crunchgen.c,v 1.82 2014/01/04 08:58:51 martin Exp $ */ +/* $NetBSD: crunchgen.c,v 1.83 2015/05/16 02:33:12 matt Exp $ */ /* * Copyright (c) 1994 University of Maryland * All Rights Reserved. @@ -38,7 +38,7 @@ #include sys/cdefs.h #if !defined(lint) -__RCSID($NetBSD: crunchgen.c,v 1.82 2014/01/04 08:58:51 martin Exp $); +__RCSID($NetBSD: crunchgen.c,v 1.83 2015/05/16 02:33:12 matt Exp $); #endif #include stdlib.h @@ -1003,7 +1003,7 @@ prog_makefile_rules(FILE *outmk, prog_t fprintf(outmk, %s\\n, lst-str); fprintf(outmk, '\\\n); #define MAKECMD \ -\t| ${MAKE} -f- CRUNCHEDPROG=1 DBG=\${DBG}\ LDSTATIC=\${LDSTATIC}\ +\t| ${MAKE} -f- CRUNCHEDPROG=1 DBG=${DBG:Q} LDSTATIC=${LDSTATIC:Q} fprintf(outmk, MAKECMD depend); fprintf(outmk, )\n); fprintf(outmk, \t( cd %s; printf '.PATH: ${%s_SRCDIR}\\n
CVS commit: src/usr.bin/crunch/crunchgen
Module Name:src Committed By: martin Date: Sat Jan 4 08:58:51 UTC 2014 Modified Files: src/usr.bin/crunch/crunchgen: crunchgen.c Log Message: Remove .note.netbsd.mcmodel and .note.netbsd.pax from the chrunched binaries. We don't know wether the former would make sense (as currently used, it never makes sense for static binaries) and we can not conclude safe PAX flags from combined binaries. To generate a diff of this commit: cvs rdiff -u -r1.81 -r1.82 src/usr.bin/crunch/crunchgen/crunchgen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/crunch/crunchgen/crunchgen.c diff -u src/usr.bin/crunch/crunchgen/crunchgen.c:1.81 src/usr.bin/crunch/crunchgen/crunchgen.c:1.82 --- src/usr.bin/crunch/crunchgen/crunchgen.c:1.81 Mon Jun 10 18:27:30 2013 +++ src/usr.bin/crunch/crunchgen/crunchgen.c Sat Jan 4 08:58:51 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: crunchgen.c,v 1.81 2013/06/10 18:27:30 joerg Exp $ */ +/* $NetBSD: crunchgen.c,v 1.82 2014/01/04 08:58:51 martin Exp $ */ /* * Copyright (c) 1994 University of Maryland * All Rights Reserved. @@ -38,7 +38,7 @@ #include sys/cdefs.h #if !defined(lint) -__RCSID($NetBSD: crunchgen.c,v 1.81 2013/06/10 18:27:30 joerg Exp $); +__RCSID($NetBSD: crunchgen.c,v 1.82 2014/01/04 08:58:51 martin Exp $); #endif #include stdlib.h @@ -957,7 +957,7 @@ top_makefile_rules(FILE *outmk) fprintf(outmk, \t@[ -f ${PROG}.unstripped -a ! ${PROG} -nt ${PROG}.unstripped ] || { \\\n); fprintf(outmk, \t\t${_MKSHMSG:Uecho} \ strip \ ${PROG}; \\\n); fprintf(outmk, \t\tcp ${PROG} ${PROG}.unstripped \\\n); -fprintf(outmk, \t\t${OBJCOPY} -S -R .eh_frame -R .eh_frame_hdr -R .note -R .ident -R .comment -R .copyright ${PROG} \\\n); +fprintf(outmk, \t\t${OBJCOPY} -S -R .eh_frame -R .eh_frame_hdr -R .note -R .note.netbsd.mcmodel -R .note.netbsd.pax -R .ident -R .comment -R .copyright ${PROG} \\\n); fprintf(outmk, \t\ttouch ${PROG}.unstripped; \\\n); fprintf(outmk, \t}\n); fprintf(outmk, objs: $(SUBMAKE_TARGETS)\n);
CVS commit: src/usr.bin/crunch/crunchgen
Module Name:src Committed By: joerg Date: Mon Jun 10 18:27:30 UTC 2013 Modified Files: src/usr.bin/crunch/crunchgen: crunchgen.c Log Message: Strip .eh_frame and .eh_frame_hdr from crunched binaries. To generate a diff of this commit: cvs rdiff -u -r1.80 -r1.81 src/usr.bin/crunch/crunchgen/crunchgen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/crunch/crunchgen/crunchgen.c diff -u src/usr.bin/crunch/crunchgen/crunchgen.c:1.80 src/usr.bin/crunch/crunchgen/crunchgen.c:1.81 --- src/usr.bin/crunch/crunchgen/crunchgen.c:1.80 Tue Aug 30 23:10:45 2011 +++ src/usr.bin/crunch/crunchgen/crunchgen.c Mon Jun 10 18:27:30 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: crunchgen.c,v 1.80 2011/08/30 23:10:45 joerg Exp $ */ +/* $NetBSD: crunchgen.c,v 1.81 2013/06/10 18:27:30 joerg Exp $ */ /* * Copyright (c) 1994 University of Maryland * All Rights Reserved. @@ -38,7 +38,7 @@ #include sys/cdefs.h #if !defined(lint) -__RCSID($NetBSD: crunchgen.c,v 1.80 2011/08/30 23:10:45 joerg Exp $); +__RCSID($NetBSD: crunchgen.c,v 1.81 2013/06/10 18:27:30 joerg Exp $); #endif #include stdlib.h @@ -957,7 +957,7 @@ top_makefile_rules(FILE *outmk) fprintf(outmk, \t@[ -f ${PROG}.unstripped -a ! ${PROG} -nt ${PROG}.unstripped ] || { \\\n); fprintf(outmk, \t\t${_MKSHMSG:Uecho} \ strip \ ${PROG}; \\\n); fprintf(outmk, \t\tcp ${PROG} ${PROG}.unstripped \\\n); -fprintf(outmk, \t\t${OBJCOPY} -S -R .note -R .ident -R .comment -R .copyright ${PROG} \\\n); +fprintf(outmk, \t\t${OBJCOPY} -S -R .eh_frame -R .eh_frame_hdr -R .note -R .ident -R .comment -R .copyright ${PROG} \\\n); fprintf(outmk, \t\ttouch ${PROG}.unstripped; \\\n); fprintf(outmk, \t}\n); fprintf(outmk, objs: $(SUBMAKE_TARGETS)\n);
CVS commit: src/usr.bin/crunch/crunchgen
Module Name:src Committed By: joerg Date: Mon Jun 10 19:40:53 UTC 2013 Modified Files: src/usr.bin/crunch/crunchgen: crunchgen.1 Log Message: Document section stripping. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/usr.bin/crunch/crunchgen/crunchgen.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/crunch/crunchgen/crunchgen.1 diff -u src/usr.bin/crunch/crunchgen/crunchgen.1:1.29 src/usr.bin/crunch/crunchgen/crunchgen.1:1.30 --- src/usr.bin/crunch/crunchgen/crunchgen.1:1.29 Sun Apr 8 22:00:38 2012 +++ src/usr.bin/crunch/crunchgen/crunchgen.1 Mon Jun 10 19:40:53 2013 @@ -1,4 +1,4 @@ -.\ $NetBSD: crunchgen.1,v 1.29 2012/04/08 22:00:38 wiz Exp $ +.\ $NetBSD: crunchgen.1,v 1.30 2013/06/10 19:40:53 joerg Exp $ .\ .\ Copyright (c) 1994 University of Maryland .\ All Rights Reserved. @@ -24,7 +24,7 @@ .\ Computer Science Department .\ University of Maryland at College Park .\ -.Dd October 18, 2006 +.Dd June 10, 2013 .Dt CRUNCHGEN 1 .Os .Sh NAME @@ -272,6 +272,28 @@ If they are not valid for a particular p program is skipped in the .Ar objs target. +.Pp +The makefile produced by +.Nm +strips certain sections from the final binary to reduce its size. +This includes: +.Bl -tag -width .Li .eh_frame_hdr +.It Li .eh_frame +Unwinding tables for exceptions and backtraces. +.It Li .eh_frame_hdr +Index of the +.Li .eh_frame +section. +.It Li .note +Optional data for the kernel and/or runtime linker. +.It Li .comment +Comments in the binary. +.It Li .ident +Embedded source revisions used by +.Xr ident 1 . +.It Li .copyright +Embedded copyright notes. +.El .Sh ENVIRONMENT .Bl -tag -width MAKEOBJDIRPREFIX .It Ev MAKEOBJDIRPREFIX
CVS commit: src/usr.bin/crunch/crunchgen
Module Name:src Committed By: joerg Date: Tue Aug 30 23:10:45 UTC 2011 Modified Files: src/usr.bin/crunch/crunchgen: crunchgen.c Log Message: static + __dead To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/usr.bin/crunch/crunchgen/crunchgen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/crunch/crunchgen/crunchgen.c diff -u src/usr.bin/crunch/crunchgen/crunchgen.c:1.79 src/usr.bin/crunch/crunchgen/crunchgen.c:1.80 --- src/usr.bin/crunch/crunchgen/crunchgen.c:1.79 Sun May 15 21:28:51 2011 +++ src/usr.bin/crunch/crunchgen/crunchgen.c Tue Aug 30 23:10:45 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: crunchgen.c,v 1.79 2011/05/15 21:28:51 christos Exp $ */ +/* $NetBSD: crunchgen.c,v 1.80 2011/08/30 23:10:45 joerg Exp $ */ /* * Copyright (c) 1994 University of Maryland * All Rights Reserved. @@ -38,7 +38,7 @@ #include sys/cdefs.h #if !defined(lint) -__RCSID($NetBSD: crunchgen.c,v 1.79 2011/05/15 21:28:51 christos Exp $); +__RCSID($NetBSD: crunchgen.c,v 1.80 2011/08/30 23:10:45 joerg Exp $); #endif #include stdlib.h @@ -83,45 +83,45 @@ /* global state */ -strlst_t *srcdirs = NULL; -strlst_t *libs= NULL; -strlst_t *vars = NULL; -prog_t *progs = NULL; - -char line[MAXLINELEN]; - -char confname[MAXPATHLEN], infilename[MAXPATHLEN]; -char outmkname[MAXPATHLEN], outcfname[MAXPATHLEN], execfname[MAXPATHLEN]; -char cachename[MAXPATHLEN], curfilename[MAXPATHLEN]; -char curdir[MAXPATHLEN]; -char topdir[MAXPATHLEN]; -char libdir[MAXPATHLEN] = /usr/lib; -char dbg[MAXPATHLEN] = -Os; -int linenum = -1; -int goterror = 0; - -const char *pname = crunchgen; - -int verbose, readcache, useobjs, oneobj; /* options */ -int reading_cache; -char *machine; -char *makeobjdirprefix; -char *makebin; -char *makeflags; +static strlst_t *srcdirs = NULL; +static strlst_t *libs= NULL; +static strlst_t *vars = NULL; +static prog_t *progs = NULL; + +static char line[MAXLINELEN]; + +static char confname[MAXPATHLEN], infilename[MAXPATHLEN]; +static char outmkname[MAXPATHLEN], outcfname[MAXPATHLEN], execfname[MAXPATHLEN]; +static char cachename[MAXPATHLEN], curfilename[MAXPATHLEN]; +static char curdir[MAXPATHLEN]; +static char topdir[MAXPATHLEN]; +static char libdir[MAXPATHLEN] = /usr/lib; +static char dbg[MAXPATHLEN] = -Os; +static int linenum = -1; +static int goterror = 0; + +static const char *pname = crunchgen; + +static int verbose, readcache, useobjs, oneobj; /* options */ +static int reading_cache; +static char *machine; +static char *makeobjdirprefix; +static char *makebin; +static char *makeflags; /* general library routines */ -void status(const char *str); -void out_of_memory(void); -void add_string(strlst_t **listp, char *str); -int is_dir(const char *pathname); -int is_nonempty_file(const char *pathname); +static void status(const char *str); +__dead static void out_of_memory(void); +static void add_string(strlst_t **listp, char *str); +static int is_dir(const char *pathname); +static int is_nonempty_file(const char *pathname); /* helper routines for main() */ -void usage(void); -void parse_conf_file(void); -void gen_outputs(void); +__dead static void usage(void); +static void parse_conf_file(void); +static void gen_outputs(void); extern char *crunched_skel[]; @@ -234,19 +234,19 @@ /* helper routines for parse_conf_file */ -void parse_one_file(char *filename); -void parse_line(char *line, int *fc, char **fv, int nf); -void add_srcdirs(int argc, char **argv); -void add_progs(int argc, char **argv); -void add_link(int argc, char **argv); -void add_libs(int argc, char **argv); -void add_special(int argc, char **argv); +static void parse_one_file(char *filename); +static void parse_line(char *line, int *fc, char **fv, int nf); +static void add_srcdirs(int argc, char **argv); +static void add_progs(int argc, char **argv); +static void add_link(int argc, char **argv); +static void add_libs(int argc, char **argv); +static void add_special(int argc, char **argv); -prog_t *find_prog(char *str); -void add_prog(char *progname); +static prog_t *find_prog(char *str); +static void add_prog(char *progname); -void +static void parse_conf_file(void) { if (!is_nonempty_file(infilename)) { @@ -262,7 +262,7 @@ } -void +static void parse_one_file(char *filename) { char *fieldv[MAXFIELDS]; @@ -315,7 +315,7 @@ } -void +static void parse_line(char *pline, int *fc, char **fv, int nf) { char *p; @@ -341,7 +341,7 @@ } -void +static void add_srcdirs(int argc, char **argv) { int i; @@ -369,7 +369,7 @@ } -void +static void add_progs(int argc, char **argv) { int i; @@ -379,7 +379,7 @@ } -void +static void add_prog(char *progname) { prog_t *p1, *p2; @@ -408,7 +408,7 @@ } -void +static void add_link(int argc, char **argv) { int i; @@ -426,7 +426,7 @@ } -void +static
CVS commit: src/usr.bin/crunch/crunchgen
Module Name:src Committed By: christos Date: Sat Apr 24 17:58:40 UTC 2010 Modified Files: src/usr.bin/crunch/crunchgen: crunchgen.c Log Message: pass LDSTATIC to recursive makes. To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 src/usr.bin/crunch/crunchgen/crunchgen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/crunch/crunchgen/crunchgen.c diff -u src/usr.bin/crunch/crunchgen/crunchgen.c:1.77 src/usr.bin/crunch/crunchgen/crunchgen.c:1.78 --- src/usr.bin/crunch/crunchgen/crunchgen.c:1.77 Wed Apr 21 10:58:10 2010 +++ src/usr.bin/crunch/crunchgen/crunchgen.c Sat Apr 24 13:58:40 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: crunchgen.c,v 1.77 2010/04/21 14:58:10 christos Exp $ */ +/* $NetBSD: crunchgen.c,v 1.78 2010/04/24 17:58:40 christos Exp $ */ /* * Copyright (c) 1994 University of Maryland * All Rights Reserved. @@ -38,7 +38,7 @@ #include sys/cdefs.h #if !defined(lint) -__RCSID($NetBSD: crunchgen.c,v 1.77 2010/04/21 14:58:10 christos Exp $); +__RCSID($NetBSD: crunchgen.c,v 1.78 2010/04/24 17:58:40 christos Exp $); #endif #include stdlib.h @@ -1001,7 +1001,9 @@ for (lst = vars; lst != NULL; lst = lst-next) fprintf(outmk, %s\\n, lst-str); fprintf(outmk, '\\\n); - fprintf(outmk, \t| ${MAKE} -f- CRUNCHEDPROG=1 DBG=\${DBG}\ depend); +#define MAKECMD \ +\t| ${MAKE} -f- CRUNCHEDPROG=1 DBG=\${DBG}\ LDSTATIC=\${LDSTATIC}\ + fprintf(outmk, MAKECMD depend); fprintf(outmk, )\n); fprintf(outmk, \t( cd %s; printf '.PATH: ${%s_SRCDIR}\\n .CURDIR:= ${%s_SRCDIR}\\n @@ -1010,7 +1012,7 @@ for (lst = vars; lst != NULL; lst = lst-next) fprintf(outmk, %s\\n, lst-str); fprintf(outmk, '\\\n); - fprintf(outmk, \t| ${MAKE} -f- CRUNCHEDPROG=1 DBG=\${DBG}\ ); + fprintf(outmk, MAKECMD); if (p-objs) fprintf(outmk, ${%s_OBJS} ) \n\n, p-ident); else
CVS commit: src/usr.bin/crunch/crunchgen
Module Name:src Committed By: christos Date: Wed Apr 21 14:58:10 UTC 2010 Modified Files: src/usr.bin/crunch/crunchgen: crunchgen.c Log Message: move LDSTATIC before the includes because the rules need it early for conditionals. To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/usr.bin/crunch/crunchgen/crunchgen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/crunch/crunchgen/crunchgen.c diff -u src/usr.bin/crunch/crunchgen/crunchgen.c:1.76 src/usr.bin/crunch/crunchgen/crunchgen.c:1.77 --- src/usr.bin/crunch/crunchgen/crunchgen.c:1.76 Sat Jan 9 01:37:57 2010 +++ src/usr.bin/crunch/crunchgen/crunchgen.c Wed Apr 21 10:58:10 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: crunchgen.c,v 1.76 2010/01/09 06:37:57 kiyohara Exp $ */ +/* $NetBSD: crunchgen.c,v 1.77 2010/04/21 14:58:10 christos Exp $ */ /* * Copyright (c) 1994 University of Maryland * All Rights Reserved. @@ -38,7 +38,7 @@ #include sys/cdefs.h #if !defined(lint) -__RCSID($NetBSD: crunchgen.c,v 1.76 2010/01/09 06:37:57 kiyohara Exp $); +__RCSID($NetBSD: crunchgen.c,v 1.77 2010/04/21 14:58:10 christos Exp $); #endif #include stdlib.h @@ -946,6 +946,7 @@ fprintf(outmk, %s_make, p-ident); fprintf(outmk, \n\n); +fprintf(outmk, LDSTATIC=-static\n\n); fprintf(outmk, PROG=%s\n\n, execfname); fprintf(outmk, all: ${PROG}.crunched\n); @@ -967,7 +968,6 @@ void bottom_makefile_rules(FILE *outmk) { -fprintf(outmk, LDSTATIC=-static\n); }
CVS commit: src/usr.bin/crunch/crunchgen
Module Name:src Committed By: kiyohara Date: Sat Jan 9 06:37:57 UTC 2010 Modified Files: src/usr.bin/crunch/crunchgen: crunchgen.c Log Message: Fix a bug. always mkdir for 'objs' and 'objdir' when NEW_TOOLCHAIN. To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 src/usr.bin/crunch/crunchgen/crunchgen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/crunch/crunchgen/crunchgen.c diff -u src/usr.bin/crunch/crunchgen/crunchgen.c:1.75 src/usr.bin/crunch/crunchgen/crunchgen.c:1.76 --- src/usr.bin/crunch/crunchgen/crunchgen.c:1.75 Tue Apr 14 22:03:07 2009 +++ src/usr.bin/crunch/crunchgen/crunchgen.c Sat Jan 9 06:37:57 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: crunchgen.c,v 1.75 2009/04/14 22:03:07 lukem Exp $ */ +/* $NetBSD: crunchgen.c,v 1.76 2010/01/09 06:37:57 kiyohara Exp $ */ /* * Copyright (c) 1994 University of Maryland * All Rights Reserved. @@ -38,7 +38,7 @@ #include sys/cdefs.h #if !defined(lint) -__RCSID($NetBSD: crunchgen.c,v 1.75 2009/04/14 22:03:07 lukem Exp $); +__RCSID($NetBSD: crunchgen.c,v 1.76 2010/01/09 06:37:57 kiyohara Exp $); #endif #include stdlib.h @@ -993,7 +993,6 @@ fprintf(outmk, %s_OBJS=, p-ident); output_strlst(outmk, p-objs); } - fprintf(outmk, %s:\n\t mkdir %s\n, p-ident, p-ident); fprintf(outmk, %s_make: %s .PHONY\n, p-ident, p-ident); fprintf(outmk, \t( cd %s; printf '.PATH: ${%s_SRCDIR}\\n .CURDIR:= ${%s_SRCDIR}\\n @@ -1020,6 +1019,9 @@ fprintf(outmk, %s_make:\...@echo \** Using existing objs for %s\\n\n, p-ident, p-name); +#ifdef NEW_TOOLCHAIN +fprintf(outmk, %s:\n\t mkdir %s\n, p-ident, p-ident); +#endif fprintf(outmk, %s.cro: %s .WAIT ${%s_OBJPATHS}\n, p-name, p-ident, p-ident);