Linking 32–bit SMP object files using the ld command

To use the ld command to link an SMP program, follow these guidelines:
If you had a program called mytest and you wanted to obtain access to the functions in the 1003.1-1996 standard POSIX pthreads API, you would link with the libpthreads.a library, using something similar to the following command:
ld -bh:4 -bpT:0x10000000 -bpD:0x20000000 /lib/crt0.o mytest.o -lxlf90
    -lxlopt -lxlf -lxlsmp -lpthreads -lm -lc -o mytest
The 1003.1-1996 standard is not fully compatible with Draft 7. If you have programs that require the Draft 7 interface, link your programs with the libpthreads_compat.a and libxlfpthrds_compat.a libraries (which provide compatibility support) followed by the libpthreads.a library. For example, if you have a program called mytest that was written to use the Draft 7 interface, you would use something similar to the following command:
ld -bh:4 -bpT:0x10000000 -bpD:0x20000000 /lib/crt0.o mytest.o
   -lxlfpthrds_compat -lxlf90 -lxlopt -lxlf -lxlsmp
     -lpthreads_compat -lpthreads -lm -lc -o mytest 

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.