Linking

Though linking occurs automatically, the options in this category allow you to direct input and output to the linker, controlling how the linker processes your object files.
Table 1. Linking options
Option name Description
-qcrt, -nostartfiles (-qnocrt)

Specifies whether system startup files are to be linked.

-e

When used together with the -shared (-qmkshrobj), specifies an entry point for a shared object.

-L

At link time, searches the directory path for library files specified by the -l option.

-l

Searches for the specified library file. The linker searches for libkey.so, and then libkey.a if libkey.so is not found.

-qlib, -nodefaultlibs (-qnolib)

Specifies whether standard system libraries and XL C/C++ libraries are to be linked.

-R

At link time, writes search paths for shared libraries into the executable, so that these directories are searched at program run time for any required shared libraries.

-static (-qstaticlink)

Controls whether static or shared runtime libraries are linked into an application.

-Wl

Passes the listed options to the linker.

The following options are supported by XL C/C++ for GCC compatibility. For details about these options, see the GNU Compiler Collection online documentation at http://gcc.gnu.org/onlinedocs/.
  • -idirafter
  • -imacros
  • -iprefix
  • -iwithprefix
  • -iquote
  • -pie
  • -rdynamic
  • -Xlinker option


Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us