Linkers (Link Editors) at Indiana University
Welcome to the UITS Research and Academic Computing HPC Linkers WWW page. Link editors are commonly known as linkers. The linker is automatically invoked by the compiler as the last step of compiling a program. The linker inserts code (or maps in shared libraries) to resolve program library references and/or combines object modules into an executable image suitable for loading into memory. The linker is typically invoked with the ld command on unix-like systems and a man page is provided.
Options specified for the compile which pertain to the linker are passed down to the linker and may be position dependent (see man ld for more information. Note: linker options are usually not documented on the compiler man page.)
Linking can be suppressed with compiler options. Successful compilation then ceases after writing one or more object modules (suffix .o .) Although the linker may be invoked using the ld command from the command line, makefile or other script to link one or more object modules; the same result may be achieved by invoking the compiler with desired linker options. Object modules written by some compilers (such as C++) may require linking in this fashion.
Linking with the math library (/usr/lib/libm) or linear algebra libraries such as BLAS or LAPACK are examples of situations where a little familiarity with the linker might be helpful.
- To use the IBM-optimized BLAS library on the SP, use the -lblas option on your compile statement. To use LAPACK, add -L/libapps/lapack -llapack (or -llapack90 for the Fortran90 version).
- On the AVIDD Cluster, the ATLAS libraries (written at Innovative Computing Laboratory (ICL), headed by Jack Dongarra, at the University of Tennessee) are available in two "flavors". Documentation is in /N/hpc/blas/atlas/gnu32/doc and /N/hpc/blas/atlas/intel71/doc . Libraries include BLAS and LAPACK and are located in /N/hpc/blas/atlas/gnu32 and /N/hpc/blas/atlas/intel71 .
Compiler options also support inlining code from libraries and linking with alternate libraries such as optimized math libraries. These options are documented on the compiler man page or other compiler documentation. In general, there are two kinds of linking: Static and Dynamic. Static linking is always supported. Many systems such as those derived from System V R4 and others also support dynamic linking.
Static linking is the result of the linker copying all library routines used in the program into the executable image. This may require more disk space and memory than dynamic linking, but can be more portable (does not require the presence of the library on the system where run).
Dynamic linking is accomplished by placing the name of a sharable library in the executable image. Actual linking with the library routines does not occur until the image is run, when both executable and library are placed in memory. An advantage of dynamic linking is that multiple programs can share a single copy of the library.
Different versions of the libraries are required for static and dynamic
linking. Static libraries are called archives and have suffix
.a, shared object libraries used for dynamic linking have suffix
.so -- usually both are available. For example the math library
in /usr/lib:
Static or dynamic linking can be selected with compiler options such as
cc -dy for dynamic and cc -dn for static linking.
Ususally dynamic linking is preferable. Exceptions include when the target system does not have a copy of the shared library, where it is desired to have a separate copy of the library routines and where mapping an entire shared object library results in a larger executable than static linking.
IMSL Library tips for Research IBM SP
Knowledge Base articles related
to linkers.
- On the Research SP system, how can I link a C job to the IMSL C Library and execute it?
- Using the SCAAMP systems, how do I link a Fortran job to IMSL and execute it?
- When compiling a C program on Unix, why do I get "ld: Unresolved:"?
- On the Research SP, how do I link a Fortran job to IMSL and execute it?
- What is Linux?
- What is IMSL?
- Is NAG Library available on Unix? How do I access it?
- How do I access NAG Library on the Research SP systems?
Subroutine Libraries Information
Numerical Computing Resources




