Here are the macros that control how the compiler handles initialization and termination functions:
mainwill not call
__mainas described above. This macro should be defined for systems that control the contents of the init section on a symbol-by-symbol basis, such as OSF/1, and should not be defined explicitly for systems that support
__maindespite 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.
ASM_OUTPUT_CONSTRUCTOR (stream, name)
assemble_nameto 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
collect2program, which looks through the symbol table to find these functions by their names.
ASM_OUTPUT_DESTRUCTOR (stream, name)
ASM_OUTPUT_CONSTRUCTORbut used for termination functions rather than initialization functions. When
ASM_OUTPUT_DESTRUCTORare defined, the initializaiton 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 such systems you
must not define
as the object file's initialization routine must have global scope.
On certain kinds of systems, you can define these macros to make
collect2 work faster (and, in some cases, make it work at all):
collect2can assume this format and scan object files directly for dynamic constructor/destructor functions.
collect2can assume this format and scan object files directly for dynamic constructor/destructor functions. These macros are effective only in a native compiler;
collect2as part of a cross compiler always uses
nmfor the target machine.
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"under SunOS 4.
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