1.\" $OpenBSD: genassym.sh.8,v 1.9 2015/03/13 19:58:41 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.\" 16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26.\" 27.Dd $Mdocdate: March 13 2015 $ 28.Dt GENASSYM.SH 8 29.Os 30.Sh NAME 31.Nm genassym.sh 32.Nd emit an assym.h file 33.Sh SYNOPSIS 34.Nm sh genassym.sh 35.Op Fl c 36.Ar C compiler invocation 37.Sh DESCRIPTION 38.Nm 39is a shell script normally used during the kernel build process to 40create an assym.h file. 41This file defines a number of cpp constants derived from the configuration 42information 43.Nm 44reads from stdin. 45The generated file is used by kernel sources 46written in assembler to gain access to information (e.g. structure 47offsets and sizes) normally only known to the C compiler. 48.Pp 49.Nm 50resides in the 51.Pa /sys/kern 52directory. 53Arguments to 54.Nm 55are usually of the form 56.Ar ${CC} ${CFLAGS} ${CPPFLAGS} 57where 58.Ar ${CC} 59is the C compiler used to compile the kernel, while 60.Ar ${CFLAGS} 61and 62.Ar ${CPPFLAGS} 63are flag arguments to the C compiler. 64The script creates a C source file from its input. 65Then the C compiler is called according to the script's arguments 66to compile this file. 67.Pp 68Normally 69.Nm 70instructs the C compiler to create an assembler source from the constructed 71C source. 72The resulting file is then processed to extract the information 73needed to create the assym.h file. 74The 75.Fl c 76flag instructs 77.Nm 78to create slightly different code, generate an executable from this code 79and run it. 80In both cases the assym.h file is written to stdout. 81.Sh DIAGNOSTICS 82Either self-explanatory, or generated by one of the programs 83called from the script. 84The script will exit with the return code from the compiler or, in the 85.Fl c 86case, with the return code from the generated executable. 87.Sh SEE ALSO 88.Xr genassym.cf 5 89.Sh HISTORY 90The 91.Nm 92script first appeared in 93.Ox 2.2 . 94