[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Each linker target uses an `emultempl' script to generate the
emulation code. The name of the `emultempl' script is set by the
TEMPLATE_NAME
variable in the `emulparams' script. If the
TEMPLATE_NAME
variable is not set, the default is
`generic'. If the value of TEMPLATE_NAME
is template,
`genscripts.sh' will use `emultempl/template.em'.
Most targets use the generic `emultempl' script, `emultempl/generic.em'. A different `emultempl' script is only needed if the linker must support unusual actions, such as linking against shared libraries.
The `emultempl' script is normally written as a simple invocation
of cat
with a here document. The document will use a few
variable substitutions. Typically each function names uses a
substitution involving EMULATION_NAME
, for ease of debugging when
the linker supports multiple emulations.
Every function and variable in the emitted file should be static. The
only globally visible object must be named
ld_EMULATION_NAME_emulation
, where EMULATION_NAME is
the name of the emulation set in `configure.tgt' (this is also the
name of the `emulparams' file without the `.sh' extension).
The `genscripts.sh' script will set the shell variable
EMULATION_NAME
before invoking the `emultempl' script.
The ld_EMULATION_NAME_emulation
variable must be a
struct ld_emulation_xfer_struct
, as defined in `ldemul.h'.
It defines a set of function pointers which are invoked by the linker,
as well as strings for the emulation name (normally set from the shell
variable EMULATION_NAME
and the default BFD target name (normally
set from the shell variable OUTPUT_FORMAT
which is normally set
by the `emulparams' file).
The `genscripts.sh' script will set the shell variable
COMPILE_IN
when it invokes the `emultempl' script for the
default emulation. In this case, the `emultempl' script should
include the linker scripts directly, and return them from the
get_scripts
entry point. When the emulation is not the default,
the get_scripts
entry point should just return a file name. See
`emultempl/generic.em' for an example of how this is done.
At some point, the linker emulation entry points should be documented.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |