Here are the macros that control how the compiler handles initialization and termination functions:
INIT_SECTION_ASM_OP
crtstuff.c
' and `libgcc2.c
' arrange to run the
initialization functions.
ASM_OUTPUT_CONSTRUCTOR (stream, name)
Assume that name is the name of a C function generated
automatically by the compiler. This function takes no arguments. Use
the function assemble_name
to output the name name; this
performs any system-specific syntactic transformations such as adding an
underscore.
If you don't define this macro, nothing special is output to arrange to
call the function. This is correct when the function will be called in
some other manner---for example, by means of the collect2
program,
which looks through the symbol table to find these functions by their
names.
ASM_OUTPUT_DESTRUCTOR (stream, name)
ASM_OUTPUT_CONSTRUCTOR
but used for termination
functions rather than initialization functions.
If your system uses collect2
as the means of processing
constructors, then that program normally uses nm
to scan an
object file for constructor functions to be called. On certain kinds of
systems, you can define these macros to make collect2
work faster
(and, in some cases, make it work at all):
OBJECT_FORMAT_COFF
collect2
can assume this format and scan
object files directly for dynamic constructor/destructor functions.
OBJECT_FORMAT_ROSE
collect2
can assume this format and scan object files directly
for dynamic constructor/destructor functions.
These macros are effective only in a native compiler; collect2
as
part of a cross compiler always uses nm
.
REAL_NM_FILE_NAME
nm
. The default is to search the path normally for
nm
.