Initial import from FreeBSD RELENG_4:
[dragonfly.git] / usr.bin / genassym / genassym.8
1 .\"
2 .\" $FreeBSD: src/usr.bin/genassym/genassym.8,v 1.2.2.1 2000/12/08 15:13:37 ru Exp $
3 .\"
4 .Dd December 20, 1999
5 .Dt GENASSYM 8
6 .Os
7 .Sh NAME
8 .Nm genassym
9 .Nd generate assembler symbols from C
10 .Sh SYNOPSIS
11 .Nm
12 .Op Fl o Ar outfile
13 .Ar objfile
14 .Sh DESCRIPTION
15 The
16 .Nm
17 command is a special-purpose program to generate assembler
18 symbols from C code and is used to interface the low-level
19 assembly code with the C code.
20 This, for example, is used
21 to build a
22 .Fx
23 kernel or module.
24 Its
25 .Ar objfile
26 argument is the name of an ELF object file that holds the
27 symbol definitions.
28 These definitions are extracted from
29 the object file and written to standard output or to the
30 file specified with
31 .Ar outfile ,
32 suitable for inclusion in assembler source files.
33 .Pp
34 The
35 .Nm
36 command only extracts symbols from the object file if they
37 are prefixed by
38 .Nm assym_
39 and are global data types, whose value is the value given
40 to the symbol.
41 The following C declaration
42 .Bd -literal -offset indent -compact
43 int assym_MY_SYMBOL = 3;
44 .Ed
45 is used to create the following assembler symbol.
46 .Bd -literal -offset indent -compact
47 #define MY_SYMBOL 0x3
48 .Ed
49 Note that the size of the symbol is extracted from the
50 object file, which means that the symbol may have any type
51 that is wide enough to hold the value.
52 .Sh SEE ALSO
53 .Xr config 8
54 .Xr gensetdefs 8
55 .Sh AUTHORS
56 The
57 .Nm
58 command was written by
59 .An Marcel Moolenaar Aq marcel@FreeBSD.org
60 and was based on the
61 .Dv gensetdefs
62 command.
63 .Sh BUGS
64 Not all linkers store the size of the symbol in the ELF
65 object file.
66 The GNU linker for Alpha has this bug for
67 example (binutils 2.9.1). In those cases the size of the
68 symbol is assumed to be equal to the word size of the ELF
69 object file.
70 For Alpha this is 64 bits and for i386 this
71 is 32 bits.
72 .Sh HISTORY
73 The
74 .Nm
75 command first appeared in
76 .Fx 4.0 .