Linking

This topic describes the options that let you control and customize the linking with tools and libraries and define the output of the ld linker. See the ld man page for more information on the linker.

Option Description
-Ldirectory Instruct the linker to search directory for libraries.
-Qoption,tool,list Passes an argument list to another program in the compilation sequence, such as the assembler or linker.
-shared Instructs the compiler to build a Dynamic Shared Object (DSO) instead of an executable.
-shared-libcxa -shared-libcxa has the opposite effect of -static-libcxa. When it is used, the Intel-provided libcxa C++ library is linked in dynamically, allowing the user to override the static linking behavior when the -static option is used.
-i_dynamic Specifies that all Intel-provided libraries should be linked dynamically.
-static Causes the executable to link all libraries statically, as opposed to dynamically.
-static-libcxa By default, the Intel-provided libcxa C++ library is linked in dynamically. Use -static-libcxa on the command line to link libcxa statically, while still allowing the standard libraries to be linked in by the default behavior.
-Bstatic This option is placed in the linker command line corresponding to its location on the user command line. This option is used to control the linking behavior of any library being passed in via the command line.

When -Bstatic is not used:

  • /lib/ld-linux.so.2 is linked in
  • libm, libcxa, and libc are linked dynamically
  • all other libs are linked statically

When -Bstatic is used:

  • /lib/ld-linux.so.2 is not linked in
  • all other libs are linked statically

-Bdynamic

This option is placed in the linker command line corresponding to its location on the user command line. This option is used to control the linking behavior of any library being passed in via the command line.

Suppressing Linking

Use the -c option to suppress linking. For example, entering the following command produces the object files file1.o and file2.o:

<compiler> -c file1.c file2.c

Note

The preceding command does not link these files to produce an executable file.