HP-UX Linker and Libraries User's Guide
The linker uses four startup files:
• 32-bit PA is /opt/langtools/lib/crt0.o
• 64-bit PA is /opt/langtools/lib/pa_64/crt0.o
The linker uses this startup file when it is in compatibility mode (+compat) or it is in default
standard mode (+std) with the -noshared option.
• 32-bit IPF is /opt/langtools/lib/hpux32/crt0.o
The linker uses this startup file when it is in default standard mode (+std) with the -noshared
option.
• 64-bit IPF is /opt/langtools/lib/hpux64/crt0.o
The linker uses this startup file when it is in default standard mode (+std) with the -noshared
option.
If the -p profiling option is specified on the compile line, the compilers link with -L
/usr/ccs/lib/libp -lprof. If the-G profiling option is specified, the compilers link with
/usr/ccs/lib/lip -lgprof.
PA-RISC ONLY:
If the linker option -I is specified to create an executable file with profile-based optimization, in
32-bit mode icrt0.o is used, and in 64-bit mode the linker inserts
/usr/ccs/lib/pa20_64/fdp_init.o. If the linker options -I and -b are specified to create
a shared library with profile-based optimization, in 32-bit mode scrt0.o is used, and in 64-bit
mode, the linker inserts /usr/ccs/lib/pa20_64/fdp_init-sl.o. In 64-bit mode, the linker
uses the single 64-bit crt0.o to support these options.
For details on startup files, see crt0(3).
The Program's Entry Point
For archive-bound (using the -complete compiler option or the -noshared linker option)
executables, the entry point is the location at which execution begins in the a.out file. The entry
point is defined by the symbol $START$ in crt0.o. In share-bound executables, the entry point
is defined by the symbol $START$ in the dynamic loader (dld.so).
The a.out File
The information contained in the resulting a.out file depends on which architecture the file was
created on and what options were used to link the program. In any case, an executable a.out
file contains information that HP-UX needs when loading and running the file. For example: Is it a
shared executable? Does it reference shared libraries? Is it demand-loadable? Where do the text
(code), data, and bss (uninitialized data) segments reside in the file? For details on the format of
this file, see a.out(4).
Magic Numbers (PA-RISC ONLY)
In 32-bit mode, the linker records a magic number with each executable program that determines
how the program should be loaded. There are three possible values for an executable file's magic
number:
SHARE_MAGIC The program's text (code) can be shared by processes; its data cannot be
shared. The first process to run the program loads the entire program into virtual
memory. If the program is already loaded by another process, then a process
shares the program text with the other process.
DEMAND_MAGIC As with SHARE_MAGIC the program's text is shareable but its data is not.
However, the program's text is loaded only as needed - that is, only as the
pages are accessed. This improves process startup time since the entire
22 Compiling and Linking Programs on HP-UX