1.\" $OpenBSD: genassym.sh.8,v 1.7 2007/05/31 19:19:59 jmc Exp $ 2.\" $NetBSD: genassym.sh.8,v 1.5 1999/03/17 20:31:19 garbled Exp $ 3.\" 4.\" Copyright (c) 1997 Matthias Pfaller. 5.\" All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 3. All advertising materials mentioning features or use of this software 16.\" must display the following acknowledgement: 17.\" This product includes software developed by Matthias Pfaller. 18.\" 4. The name of the author may not be used to endorse or promote products 19.\" derived from this software without specific prior written permission 20.\" 21.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31.\" 32.Dd $Mdocdate: May 31 2007 $ 33.Dt GENASSYM.SH 8 34.Os 35.Sh NAME 36.Nm genassym.sh 37.Nd emit an assym.h file 38.Sh SYNOPSIS 39.Nm sh genassym.sh 40.Op Fl c 41.Ar C compiler invocation 42.Sh DESCRIPTION 43.Nm 44is a shell script normally used during the kernel build process to 45create an assym.h file. 46This file defines a number of cpp constants derived from the configuration 47information 48.Nm 49reads from stdin. 50The generated file is used by kernel sources 51written in assembler to gain access to information (e.g. structure 52offsets and sizes) normally only known to the C compiler. 53.Pp 54.Nm 55resides in the 56.Pa /sys/kern 57directory. 58Arguments to 59.Nm 60are usually of the form 61.Ar ${CC} ${CFLAGS} ${CPPFLAGS} 62where 63.Ar ${CC} 64is the C compiler used to compile the kernel, while 65.Ar ${CFLAGS} 66and 67.Ar ${CPPFLAGS} 68are flag arguments to the C compiler. 69The script creates a C source file from its input. 70Then the C compiler is called according to the script's arguments 71to compile this file. 72.Pp 73Normally 74.Nm 75instructs the C compiler to create an assembler source from the constructed 76C source. 77The resulting file is then processed to extract the information 78needed to create the assym.h file. 79The 80.Fl c 81flag instructs 82.Nm 83to create slightly different code, generate an executable from this code 84and run it. 85In both cases the assym.h file is written to stdout. 86.Sh DIAGNOSTICS 87Either self-explanatory, or generated by one of the programs 88called from the script. 89The script will exit with the return code from the compiler, or, in the 90.Fl c 91case, with the return code from the generated executable. 92.Sh SEE ALSO 93.Xr genassym.cf 5 94.Sh HISTORY 95The 96.Nm 97script first appeared in 98.Ox 2.2 . 99