HP-UX Reference (11i v1 05/09) - 3 Library Functions A-M (vol 6)

c
crt0.o(3) crt0.o(3)
NAME
crt0.o, gcrt0.o, mcrt0.o - execution startup routines; PA-RISC 64-bit ELF uses crt0.o only
DESCRIPTION
PA-RISC 32-bit SOM
The C, Pascal, and FORTRAN compilers link in the object files
crt0.o, gcrt0.o,or mcrt0.o to pro-
vide startup capabilities and environments for program execution. All are identical except that
gcrt0.o
and mcrt0.o provide additional functionality for gprof(1) and prof(1) profiling support respectively.
The following symbols are defined in these object files:
_environ An array of character pointers to the environment in which the program will
run. This array is terminated by a null pointer.
_FPU_MODEL A variable of type short containing the FPU model number returned by the FP
status instruction. This variable is initialized with data from the kernel.
_FPU_REVISION A variable of type short containing the FPU revision number returned by the FP
status instruction. This variable is initialized with data from the kernel.
_CPU_KEYBITS_1
A variable of type int containing CPU specific information. This variable is ini-
tialized with data from the kernel.
_CPU_REVISION A variable of type int containing the CPU revision of the machine. This variable
is initialized with data from the kernel.
_SYSTEM_ID A variable of type int containing the system id value for an executable program.
$START$ Execution start address.
_start A secondary startup routine for C programs, called from $START$, which in
turn calls main. This routine is contained in the C library rather than the
crt0.o file. For Pascal and FORTRAN programs, this symbol labels the begin-
ning of the outer block (main program) and is generated by the compilers.
$global$ The initial address of the program’s data pointer. The startup code loads this
address into general register 27.
$UNWIND_START The beginning of the stack unwind table.
$UNWIND_END The end of the stack unwind table.
$RECOVER_START
The beginning of the try/recover table.
$RECOVER_END The end of the try/recover table.
The crt0.o file defines a null procedure for _mcount, so programs compiled with profiling can be linked
without profiling.
The linker defines the following two symbols:
_ _text_start The beginning address of the program’s text area.
_ _data_start The beginning address of the program’s data area.
PA-RISC 64-bit ELF
The C, Pascal, and FORTRAN compilers link in the object file crt0.o to provide startup capabilities and
environments for program execution. It contains startup code that must be linked using ld to every -
noshared
PA-RISC 64-bit program. In a -dynamic program, the crt0.o object file is not used, and
all actions normally associated with it are instead done by the dynamic loader dld.sl(5). Additional func-
tionality for prof(1) and gprof(1) profiling support is no longer handled by crt0.o.
In a PA-RISC 64-bit environment, crt0.o processes initializers and terminators. Initializers are routines
that are called before the program entry point and terminators are routines that are called when the pro-
gram terminates via the exit routine. Initializers are invoked in reverse order of the link line so that
dependent libraries are initialized before the libraries that depend on them. Terminators, on the other
hand, are invoked in the forward order.
Unlike the SOM version of crt0.o, crt0.o for PA-RISC 64-bit ELF does not define any variables. It,
however, sets the following global variables:
HP-UX 11i Version 1: September 2005 1 Hewlett-Packard Company Section 3101