1999-12-23 11:07:45 +00:00
|
|
|
.\"
|
|
|
|
.\" $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
|
2000-03-01 12:20:22 +00:00
|
|
|
assembly code with the C code.
|
|
|
|
This, for example, is used
|
1999-12-23 11:07:45 +00:00
|
|
|
to build a FreeBSD kernel or module.
|
|
|
|
Its
|
|
|
|
.Ar objfile
|
|
|
|
argument is the name of an ELF object file that holds the
|
2000-03-01 12:20:22 +00:00
|
|
|
symbol definitions.
|
|
|
|
These definitions are extracted from
|
1999-12-23 11:07:45 +00:00
|
|
|
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
|
2000-03-01 12:20:22 +00:00
|
|
|
to the symbol.
|
|
|
|
The following C declaration
|
1999-12-23 11:07:45 +00:00
|
|
|
.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
|
2000-03-01 12:20:22 +00:00
|
|
|
object file.
|
|
|
|
The GNU linker for Alpha has this bug for
|
1999-12-23 11:07:45 +00:00
|
|
|
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
|
2000-03-01 12:20:22 +00:00
|
|
|
object file.
|
|
|
|
For Alpha this is 64 bits and for i386 this
|
1999-12-23 11:07:45 +00:00
|
|
|
is 32 bits.
|
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
command first appeared in FreeBSD 4.0.
|