freebsd-dev/usr.bin/genassym/genassym.8
Sheldon Hearn 87faa07bec Remove single-space hard sentence breaks. These degrade the quality
of the typeset output, tend to make diffs harder to read and provide
bad examples for new-comers to mdoc.
2000-03-01 12:20:22 +00:00

74 lines
1.7 KiB
Groff

.\"
.\" $FreeBSD$
.\"
.Dd December 20, 1999
.Dt GENASSYM 8
.Os
.Sh NAME
.Nm genassym
.Nd generate assembler symbols from C
.Sh SYNOPSIS
.Nm genassym
.Op Fl o Ar outfile
.Ar objfile
.Sh DESCRIPTION
The
.Nm
command is a special-purpose program to generate assembler
symbols from C code and is used to interface the low-level
assembly code with the C code.
This, for example, is used
to build a FreeBSD kernel or module.
Its
.Ar objfile
argument is the name of an ELF object file that holds the
symbol definitions.
These definitions are extracted from
the object file and written to standard output or to the
file specified with
.Ar outfile ,
suitable for inclusion in assembler source files.
.Pp
The
.Nm
command only extracts symbols from the object file if they
are prefixed by
.Nm assym_
and are global data types, whose value is the value given
to the symbol.
The following C declaration
.Bd -literal -offset indent -compact
int assym_MY_SYMBOL = 3;
.Ed
is used to create the following assembler symbol.
.Bd -literal -offset indent -compact
#define MY_SYMBOL 0x3
.Ed
Note that the size of the symbol is extracted from the
object file, which means that the symbol may have any type
that is wide enough to hold the value.
.Sh SEE ALSO
.Xr config 8
.Xr gensetdefs 8
.Sh AUTHORS
The
.Nm
command was written by
.An Marcel Moolenaar Aq marcel@FreeBSD.org
and was based on the
.Dv gensetdefs
command.
.Sh BUGS
Not all linkers store the size of the symbol in the ELF
object file.
The GNU linker for Alpha has this bug for
example (binutils 2.9.1). In those cases the size of the
symbol is assumed to be equal to the word size of the ELF
object file.
For Alpha this is 64 bits and for i386 this
is 32 bits.
.Sh HISTORY
The
.Nm
command first appeared in FreeBSD 4.0.