Node:Macros for Initialization, Next:Instruction Output, Previous:Initialization, Up:Assembler Format
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.
HAS_INIT_SECTION
main
will not call __main
as described above.
This macro should be defined for systems that control start-up code
on a symbol-by-symbol basis, such as OSF/1, and should not
be defined explicitly for systems that support INIT_SECTION_ASM_OP
.
LD_INIT_SWITCH
LD_FINI_SWITCH
COLLECT_SHARED_INIT_FUNC (
stream,
func)
_GLOBAL__DI
will be generated.
This function and the following one are used by collect2 when linking a
shared library that needs constructors or destructors, or has DWARF2
exception tables embedded in the code.
COLLECT_SHARED_FINI_FUNC (
stream,
func)
_GLOBAL__DD
will be generated.
INVOKE__main
main
will call __main
despite the presence of
INIT_SECTION_ASM_OP
. This macro should be defined for systems
where the init section is not actually run automatically, but is still
useful for collecting the lists of constructors and destructors.
SUPPORTS_INIT_PRIORITY
init_priority
attribute is supported and the
compiler should emit instructions to control the order of initialization
of objects. If zero, the compiler will issue an error message upon
encountering an init_priority
attribute.
bool TARGET_HAVE_CTORS_DTORS | Target Hook |
This value is true if the target supports some "native" method of
collecting constructors and destructors to be run at startup and exit.
It is false if we must use collect2 .
|
void TARGET_ASM_CONSTRUCTOR (rtx symbol, int priority) | Target Hook |
If defined, a function that outputs assembler code to arrange to call
the function referenced by symbol at initialization time.
Assume that symbol is a If this macro is not defined by the target, a suitable default will
be chosen if (1) the target supports arbitrary section names, (2) the
target defines |
void TARGET_ASM_DESTRUCTOR (rtx symbol, int priority) | Target Hook |
This is like TARGET_ASM_CONSTRUCTOR but used for termination
functions rather than initialization functions.
|
If TARGET_HAVE_CTORS_DTORS
is true, the initialization routine
generated for the generated object file will have static linkage.
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
for the target machine.
REAL_NM_FILE_NAME
nm
. The default is to search the path normally for
nm
.
If your system supports shared libraries and has a program to list the
dynamic dependencies of a given library or executable, you can define
these macros to enable support for running initialization and
termination functions in shared libraries:
LDD_SUFFIX
"ldd"
under SunOS 4.
PARSE_LDD_OUTPUT (
ptr)
LDD_SUFFIX
. ptr is a variable
of type char *
that points to the beginning of a line of output
from LDD_SUFFIX
. If the line lists a dynamic dependency, the
code must advance ptr to the beginning of the filename on that
line. Otherwise, it must set ptr to NULL
.