Passing Options to the Linker

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-libgcc

-shared-libgcc has the opposite effect of -static-libgcc. When it is used, the GNU standard libraries are linked in dynamically, allowing the user to override the static linking behavior when the -static option is used. Note: By default, all C++ standard and support libraries are linked dynamically.

-shared-intel

Specifies that all Intel-provided libraries should be linked dynamically.

-static

Causes the executable to link all libraries statically, as opposed to dynamically.
When -static is not used:

  • /lib/ld-linux.so.2 is linked in

  • all other libs are linked dynamically

When -static is used:
  • /lib/ld-linux.so.2 is not linked in

  • all other libs are linked statically

-static-libgcc

This option causes the GNU standard libraries to be linked in statically.

-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.

-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.

-static-intel

This option causes Intel-provided libraries to be linked in statically. It is the opposite of -shared-intel.

-Wl,optlist

This option passes a comma-separated list (optlist) of linker options to the linker.

-Xlinker val

This option passes a value (val), such as a linker option, an object, or a library, directly to the linker.


Submit feedback on this help topic

Copyright © 1996-2011, Intel Corporation. All rights reserved.