diff options
author | Jason McIntyre <jmc@cvs.openbsd.org> | 2003-05-21 11:40:00 +0000 |
---|---|---|
committer | Jason McIntyre <jmc@cvs.openbsd.org> | 2003-05-21 11:40:00 +0000 |
commit | 3a762aebb60df3bd0941b5ec3b7c8bc6fcb0550d (patch) | |
tree | 42a4b4e84507f34ded4c7022789b88a819d371d4 | |
parent | 18344a94f2c7c7b9883551e312d7f33b46d2a767 (diff) |
- finish mdoc'ing crunch pages
- better use of macros
ok deraadt@
-rw-r--r-- | distrib/crunch/crunchgen/crunchgen.1 | 254 | ||||
-rw-r--r-- | distrib/crunch/crunchide/crunchide.1 | 26 |
2 files changed, 140 insertions, 140 deletions
diff --git a/distrib/crunch/crunchgen/crunchgen.1 b/distrib/crunch/crunchgen/crunchgen.1 index 897faba82a9..cb4a90e29c5 100644 --- a/distrib/crunch/crunchgen/crunchgen.1 +++ b/distrib/crunch/crunchgen/crunchgen.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: crunchgen.1,v 1.11 2003/05/08 09:17:56 jmc Exp $ +.\" $OpenBSD: crunchgen.1,v 1.12 2003/05/21 11:39:59 jmc Exp $ .\" .\" .\" Copyright (c) 1994 University of Maryland @@ -29,10 +29,10 @@ .Dt CRUNCHGEN 1 .Os .Sh NAME -.Nm \&crunchgen +.Nm crunchgen .Nd generates build environment for a crunched binary .Sh SYNOPSIS -.Nm \&crunchgen +.Nm crunchgen .Op Fl fqE .Op Fl m Ar makefile-name .Op Fl c Ar c-file-name @@ -41,64 +41,70 @@ .Op Fl L Ar lib-dir .Op Ar conf-file .Sh DESCRIPTION - A crunched binary is a program made up of many other programs linked -together into a single executable. The crunched binary main() -function determines which component program to run by the contents of -argv[0]. The main reason to crunch programs together is for fitting -as many programs as possible onto an installation or system recovery -floppy. - +together into a single executable. +The crunched binary main() function determines which component program +to run by the contents of argv[0]. +The main reason to crunch programs together is for fitting as many programs +as possible onto an installation or system recovery floppy. .Pp -.Nm Crunchgen +.Nm reads in the specifications in .Ar conf-file for a crunched binary, and generates a Makefile and accompanying top-level C source file that when built create the crunched executable -file from the component programs. For each component program, -.Nm crunchgen +file from the component programs. +For each component program, +.Nm can optionally attempt to determine the object (.o) files that make up -the program from its source directory Makefile. This information is -cached between runs. -.Nm Crunchgen +the program from its source directory Makefile. +This information is cached between runs. +.Nm uses the companion program -.Nm crunchide +.Xr crunchide 1 to eliminate link-time conflicts between the component programs by hiding all unnecessary symbols. - .Pp After -.Nm crunchgen -is run, the crunched binary can be built by running ``make -f -<conf-name>.mk''. The component programs' object files must already -be built. A ``objs'' target, included in the output makefile, will -run make in each component program's source dir to build the object -files for the user. This is not done automatically since in release -engineering circumstances it is generally not desirable to be -modifying objects in other directories. - +.Nm +is run, the crunched binary can be built by running +.Dq make -f <conf-name>.mk . +The component programs' object files must already be built. +An +.Dq objs +target, included in the output makefile, +will run make in each component program's source dir to build the object +files for the user. +This is not done automatically since in release engineering circumstances +it is generally not desirable to be modifying objects in other directories. .Pp The options are as follows: .Bl -tag -width indent .It Fl c Ar c-file-name Set output C file name to .Ar c-file-name . -The default name is ``<conf-name>.c''. +The default name is +.Dq Ao conf-name Ac Ns \&.c . .It Fl e Ar exec-file-name Set crunched binary executable file name to .Ar exec-file-name . -The default name is ``<conf-name>''. +The default name is +.Dq Aq conf-name . .It Fl f -Flush cache. Forces the recalculation of cached parameters. +Flush cache. +Forces the recalculation of cached parameters. .It Fl m Ar makefile-name Set output Makefile name to .Ar makefile-name . -The default name is ``<conf-name>.mk''. +The default name is +.Dq Ao conf-name Ac Ns \&.mk . .It Fl q -Quiet operation. Status messages are suppressed. +Quiet operation. +Status messages are suppressed. .It Fl E -Don't prepend stub names with an underscore. Used for architectures that -don't have underscore prepended to symbol names. Example mips ELF. +Don't prepend stub names with an underscore. +Used for architectures that don't have underscore prepended to symbol names. +Example mips ELF. .It Fl D Ar src-root Assume that relative source directory specifications begin with .Ar src-root . @@ -107,173 +113,165 @@ Try to obtain libraries from .Ar lib-dir . .El .Sh CRUNCHGEN CONFIGURATION FILE COMMANDS - -.Nm Crunchgen +.Nm reads specifications from the .Ar conf-file -that describe the components of the crunched binary. In its simplest -use, the component program names are merely listed along with the -top-level source directories in which their sources can be found. -.Nm Crunchgen +that describe the components of the crunched binary. +In its simplest use, the component program names are merely listed +along with the top-level source directories in which their sources +can be found. +.Nm then calculates (via the source makefiles) and caches the -list of object files and their locations. For more specialized -situations, the user can specify by hand all the parameters that -.Nm crunchgen +list of object files and their locations. +For more specialized situations, the user can specify by hand +all the parameters that +.Nm needs. .Pp The .Ar conf-file commands are as follows: .Bl -tag -width indent -.It Nm srcdirs Ar dirname ... +.It srcdirs Ar dirname ... A list of source trees in which the source directories of the -component programs can be found. These dirs are searched using the -BSD ``<source-dir>/<progname>/'' convention. Multiple -.Nm srcdirs -lines can be specified. The directories are searched in the order -they are given. -.It Nm progs Ar progname ... -A list of programs that make up the crunched binary. Multiple -.Nm progs -lines can be specified. -.It Nm libs Ar libspec ... +component programs can be found. +These dirs are searched using the BSD +.Dq <source-dir>/<progname>/ +convention. +Multiple srcdirs lines can be specified. +The directories are searched in the order they are given. +.It progs Ar progname ... +A list of programs that make up the crunched binary. +Multiple progs lines can be specified. +.It libs Ar libspec ... A list of library specifications to be included in the crunched binary link. -Multiple -.Nm libs -lines can be specified. -.It Nm ln Ar progname linkname +Multiple libs lines can be specified. +.It ln Ar progname linkname Causes the crunched binary to invoke .Ar progname whenever .Ar linkname -appears in argv[0]. This allows programs that change their behavior when +appears in argv[0]. +This allows programs that change their behavior when run under different names to operate correctly. .El - +.Pp To handle specialized situations, such as when the source is not available or not built via a conventional Makefile, the following -.Nm special +.Ic special commands can be used to set -.Nm crunchgen +.Nm parameters for a component program. .Bl -tag -width indent -.It Nm special Ar progname Nm srcdir Ar pathname +.It special Ar progname No srcdir Ar pathname Set the source directory for .Ar progname . -This is normally calculated by searching the specified -.Nm srcdirs +This is normally calculated by searching the specified srcdirs for a directory named .Ar progname . -.It Nm special Ar progname Nm objdir Ar pathname +.It special Ar progname No objdir Ar pathname Set the obj directory for .Ar progname . This is normally calculated by looking for a directory named -.Dq Pa obj +.Dq obj under the .Ar srcdir , and if that is not found, the .Ar srcdir -itself becomes the -.Ar objdir . -.It Nm special Ar progname Nm objs Ar object-file-name ... +itself becomes the objdir. +.It special Ar progname No objs Ar object-file-name ... Set the list of object files for program .Ar progname . This is normally calculated by constructing a temporary makefile that includes -.Dq Nm srcdir / Pa Makefile +.Dq srcdir/Makefile and outputs the value of $(OBJS). -.It Nm special Ar progname Nm objpaths Ar full-pathname-to-object-file ... +.It special Ar progname No objpaths Ar full-pathname-to-object-file ... Sets the pathnames of the object files for program .Ar progname . -This is normally calculated by prepending the -.Nm objdir -pathname to each file in the -.Nm objs -list. +This is normally calculated by prepending the objdir +pathname to each file in the objs list. .El - .Pp -Only the -.Nm objpaths -parameter is actually needed by +Only the objpaths parameter is actually needed by .Nm crunchgen , -but it is calculated from -.Nm objdir -and -.Nm objs , -which are in turn calculated from -.Nm srcdir , -so is sometimes convenient to specify the earlier parameters and let -.Nm crunchgen +but it is calculated from objdir and objs, +which are in turn calculated from srcdir, +so it is sometimes convenient to specify the earlier parameters and let +.Nm calculate forward from there if it can. - .Pp The makefile produced by -.Nm crunchgen +.Nm contains an optional .Ar objs target that will build the object files for each component program by -running make inside that program's source directory. For this to work the -.Nm srcdir -and -.Nm objs -parameters must also be valid. If they are not valid for a particular program, that -program is skipped in the +running make inside that program's source directory. +For this to work the srcdir and objs parameters must also be valid. +If they are not valid for a particular program, that program is skipped in the .Ar objs target. .Sh EXAMPLES Here is an example -.Nm crunchgen +.Nm input conf file, named -.Dq Pa kcopy.conf : -.Pp -.nf - srcdirs /usr/src/bin /usr/src/sbin +.Pa kcopy.conf : +.Bd -literal -offset indent +srcdirs /usr/src/bin /usr/src/sbin - progs test cp echo sh fsck halt init mount umount myinstall - ln test [ # test can be invoked via [ - ln sh -sh # init invokes the shell with "-sh" in argv[0] +progs test cp echo sh fsck halt init mount umount myinstall +ln test [ # test can be invoked via [ +ln sh -sh # init invokes the shell with "-sh" in argv[0] - special myprog objpaths /homes/leroy/src/myinstall.o # no sources +special myprog objpaths /homes/leroy/src/myinstall.o # no sources - libs -lutil -lcrypt -.fi +libs -lutil -lcrypt +.Ed .Pp This conf file specifies a small crunched binary consisting of some -basic system utilities plus a home-grown install program ``myinstall'', +basic system utilities plus a home-grown install program +.Dq myinstall , for which no source directory is specified, but its object file is specified directly with the -.Nm special +.Ic special line. .Pp -The crunched binary ``kcopy'' can be built as follows: +The crunched binary +.Dq kcopy +can be built as follows: .Pp -.nf - % crunchgen -m Makefile kcopy.conf # gen Makefile and kcopy.c - % make objs # build the component programs' .o files - % make # build the crunched binary kcopy - % kcopy sh # test that this invokes a sh shell - $ # it works! -.fi +.Bd -literal -offset indent +% crunchgen -m Makefile kcopy.conf # gen Makefile and kcopy.c +% make objs # build the component programs' .o files +% make # build the crunched binary kcopy +% kcopy sh # test that this invokes a sh shell +$ # it works! +.Ed .Pp -At this point the binary ``kcopy'' can be copied onto an install floppy +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 SEE ALSO .Xr crunchide 1 .Sh CAVEATS While -.Nm crunch +.Nm takes care to eliminate link conflicts between the component programs of a crunched binary, conflicts are still possible between the -libraries that are linked in. Some shuffling in the order of -libraries may be required, and in some rare cases two libraries may +libraries that are linked in. +Some shuffling in the order of libraries may be required, +and in some rare cases two libraries may have an unresolveable conflict and thus cannot be crunched together. .Pp Some versions of the BSD build environment do not by default build the -intermediate object file for single-source file programs. The ``make -objs'' target must then be used to get those object files built, or -some other arrangements made. +intermediate object file for single-source file programs. +The +.Dq make objs +target must then be used to get those object files built, +or some other arrangements made. .Sh AUTHORS -.Nm Crunch -was written by James da Silva <jds@cs.umd.edu>. -.sp 0 +.Nm +was written by James da Silva +.Aq jds@cs.umd.edu . +.Pp Copyright (c) 1994 University of Maryland. All Rights Reserved. diff --git a/distrib/crunch/crunchide/crunchide.1 b/distrib/crunch/crunchide/crunchide.1 index 75c8126a6b0..0c0e836fab3 100644 --- a/distrib/crunch/crunchide/crunchide.1 +++ b/distrib/crunch/crunchide/crunchide.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: crunchide.1,v 1.6 2003/05/08 09:17:56 jmc Exp $ +.\" $OpenBSD: crunchide.1,v 1.7 2003/05/21 11:39:59 jmc Exp $ .\" .\" .\" Copyright (c) 1994 University of Maryland @@ -37,8 +37,7 @@ .Op Fl k Ar keep-symbol .Op Ar object-file ... .Sh DESCRIPTION - -.Nm Crunchide +.Nm hides the global symbols of .Ar object-file such that they are ignored by subsequent runs of the linker, @@ -47,15 +46,16 @@ Some symbols may be left visible via the .Fl k Ar keep-symbol and .Fl f Ar keep-list-file -options. The +options. +The .Ar keep-list-file must contain a list of symbols to keep visible, one symbol per line. Note that the C compiler prepends an underscore in front of symbols, so to keep the C function ``foo'' visible, the option -\&``-k _foo'' must be used. - +.Dq -k _foo +must be used. .Pp -.Nm Crunchide +.Nm is designed as a companion program for .Xr crunchgen 1 , which automates the process of creating crunched binaries from @@ -63,16 +63,18 @@ multiple component programs. .Sh NOTES The ELF version of .Nm crunchide -mangles the symboltable beyond recognition. +mangles the symbol table beyond recognition. It is therefore not advisable to try to run .Xr nm 1 -on a crunched object file. This is due to the nature of the ELF symboltable +on a crunched object file. +This is due to the nature of the ELF symbol table and how some arches uses the symbol attributes for their GOT build. .Sh SEE ALSO .Xr crunchgen 1 , .Xr ld 1 .Sh AUTHORS -.Nm Crunch -was written by James da Silva <jds@cs.umd.edu>. -.sp 0 +.Nm +was written by James da Silva +.Aq jds@cs.umd.edu . +.Pp Copyright (c) 1994 University of Maryland. All Rights Reserved. |