Oracle® Solaris 11.2 Linkers and Libraries Guide

Exit Print View

Updated: July 2014
 
 

Link-Editing

The link-editor, ld (1) , takes a variety of input files, typically generated from compilers, assemblers, or previous invocations of the link-editor. The link-editor concatenates and interprets the data within these input files to form an output file. The output file that is produced is one of the following basic types.

  • Dynamic Executable - A concatenation of input relocatable objects that requires intervention by the runtime linker, ld.so.1 (1) , to produce a runnable process. Dynamic executables typically have one or more dependencies in the form of shared objects.

    A dynamic executable is created when the –z type=exec option is used, or is the default when no other options that control the output file type are provided.

  • Position-independent Executable - A special case of a shared object, that specifies an interpreter. Position-independent executables should be created from position-independent code. Unlike a dynamic executable, which requires a fixed address space for execution, a position-independent executable can be loaded at an arbitrary address chosen by exec (2) .

    A position-independent executable is created when the –z type=pie option is used.

  • Relocatable Object - A concatenation of input relocatable objects that can be used in subsequent link-edit phases.

    A relocatable object is created when the –z type=reloc option, or –r option are used.

  • Shared Object - A concatenation of input relocatable objects that provide services that can be bound to a dynamic executable at runtime. Shared objects should be created from position-independent code. Shared objects can have dependencies on other shared objects.

    A shared object is created when the –z type=shared option, or –G option are used.