To use the
ld command to link a 64-bit
SMP program, follow these guidelines:
- Do not use the -e flag to change the
default starting point of the executable output file (__start).
If you use other starting points, your results will be unpredictable.
- Specify the following options and files with the ld command:
- -bh:4, -bpT:0x100000000, -bpD:0x110000000, -b64
- The object file that contains the system startup routine:
- crt0_64.o for a program that was not
profiled.
- mcrt0_64.o for a program that was profiled
with the -p option.
- gcrt0_64.o for a program that was profiled
with the -pg option.
- Link with the startup files in /usr/lib.
- Compiler and system libraries:
- -lxlf90, -lxlsmp, -lm, -lc,
and -lpthreads, in that order (you only
need -lxlsmp if you compile with the -qsmp option).
- If you use the -qautodbl option, specify
one of the libraries that are listed in the suboptions of -qautodbl.
- If you use the -qpdf1 compiler
option, specify -lxlipa.
- If you use the -qhot=vector suboption,
specify -lxlopt.
For example, to link the object files smpfile1.o and smpfile2.o,
you could specify the following:
ld -bh:4 -bpT:0x100000000 -bpD:0x110000000 -b64 /lib/crt0_64.o -lxlf90
-lxlsmp -lm -lc -lpthreads smpfile1.o smpfile2.o
The configuration file /opt/IBM/xlf/15.1.0/etc/xlf.cfg lists
these default libraries and linker options. By doing a sample compilation
with the -# option, you can see exactly
how the compiler would run the linker.
See the AIX® Commands
Reference, Volumes 1 - 6 for a description of the linker options.