24.05.2014 Views

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

- If you use the -qautodbl option, specify some extra libraries that are listed<br />

in “-qautodbl Option” on page 134.<br />

- If you use the -qpdf1 compiler option, specify -lxlopt.<br />

- If you use the -qhot=vector suboption, specify -lxlopt.<br />

On <strong>AIX</strong> Version 5.1 and higher, the default POSIX pthreads API is the 1003.1-1996<br />

standard. If you had a program called mytest and you wanted to obtain access to<br />

the functions in the 1003.1-1996 standard POSIX pthreads API on <strong>AIX</strong> Version 5.1,<br />

you would link with the libpthreads.a library, using something similar to the<br />

following command:<br />

ld -bh:4 -bpT:0x10000000 -bpD:0x20000000 /lib/crt0_r.o mytest.o -lxlf90_r<br />

-lxlf -lxlsmp -lm_r -lm -lc_r -lc -lpthreads -o mytest<br />

The 1003.1-1996 standard is not fully compatible with Draft 7. If you have<br />

programs that require the Draft 7 interface, link your programs with the<br />

libpthreads_compat.a and libxlfpthrds_compat.a libraries (which provide<br />

compatibility support) followed by the libpthreads.a library. For example, if you<br />

have a program called mytest that was written to use the Draft 7 interface, on <strong>AIX</strong><br />

Version 5.1, you would use something similar to the following command:<br />

ld -bh:4 -bpT:0x10000000 -bpD:0x20000000 /lib/crt0_r.o mytest.o<br />

-lxlfpthrds_compat -lxlf90_r -lxlf -lxlsmp -lm_r -lm -lc_r -lc<br />

-lpthreads_compat -lpthreads -o mytest<br />

The configuration file /etc/xlf.cfg lists these default libraries and linker options. By<br />

doing a sample compilation with the -# option, you can see exactly how the<br />

compiler would run the linker.<br />

See the <strong>AIX</strong> Commands Reference <strong>for</strong> a description of the linker options.<br />

Linking 64–Bit SMP Object Files Using the ld Command<br />

To use the ld command to link a 64-bit SMP program, follow these guidelines:<br />

v Do not specify the -e flag.<br />

v Do not change the default starting point of the executable output file (__start).<br />

If you use other starting points, your results will be unpredictable.<br />

v Specify the following options and files with the ld command:<br />

– On <strong>AIX</strong> 5.1, -bh:4, -bpT:0x10000000, -bpD:0x20000000, -b64.<br />

– The object file that contains the system startup routine:<br />

- crt0_64.o <strong>for</strong> a program that was not profiled.<br />

- mcrt0_64.o <strong>for</strong> a program that was profiled with the -p option.<br />

- gcrt0_64.o <strong>for</strong> a program that was profiled with the -pg option.<br />

– Link with the startup files in /usr/lib.<br />

– Compiler and system libraries:<br />

- -lxlf90, -lxlsmp, -lm, -lc, and -lpthreads, in that order (you only need<br />

-lxlsmp if you compile with the -qsmp option).<br />

- If you use the -qautodbl option, specify some extra libraries that are listed<br />

in the “-qautodbl Option” on page 134.<br />

- If you use the -qpdf1 compiler option, specify -lxlopt.<br />

- If you use the -qhot=vector suboption, specify -lxlopt.<br />

For example, to link the object files smpfile1.o and smpfile2.o on <strong>AIX</strong> 5.1, you<br />

could specify the following:<br />

ld -bh:4 -bpT:0x10000000 -bpD:0x20000000 -b64 /lib/crt0_64.o -lxlf90<br />

-lxlsmp -lm -lc smpfile1.o smpfile2.o<br />

Editing, Compiling, Linking, and Running <strong>XL</strong> <strong>Fortran</strong> Programs 43

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!