JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Linker and Libraries Guide     Oracle Solaris 10 8/11 Information Library
search filter icon
search icon

Document Information


1.  Introduction to the Oracle Solaris Link Editors

2.  Link-Editor

3.  Runtime Linker

4.  Shared Objects

5.  Application Binary Interfaces and Versioning

6.  Support Interfaces

7.  Object File Format

8.  Thread-Local Storage

9.  Mapfiles

A.  Link-Editor Quick Reference

Static Mode

Creating a Relocatable Object

Creating a Static Executable

Dynamic Mode

Creating a Shared Object

Creating a Dynamic Executable

B.  Versioning Quick Reference

C.  Establishing Dependencies with Dynamic String Tokens

D.  Direct Bindings

E.  System V Release 4 (Version 1) Mapfiles

F.  Linker and Libraries Updates and New Features


Static Mode

Static mode is selected when the -d n option is used, and enables you to create relocatable objects and static executables. Under this mode, only relocatable objects and archive libraries are acceptable forms of input. Use of the -l option results in a search for archive libraries.

Creating a Relocatable Object

To create a relocatable object use the -r option.

$ ld -r -o temp.o file1.o file2.o file3.o .....

Creating a Static Executable

Note - The use of static executables is limited. See Static Executables. Static executables usually contain platform-specific implementation details that restrict the ability of the executable to be run on an alternative platform, or version of the operating system. Many implementations of Oracle Solaris shared objects depend on dynamic linking facilities, such as dlopen(3C) and dlsym(3C). See Loading Additional Objects. These facilities are not available to static executables.

To create a static executable use the -d n option without the -r option.

$ cc -dn -o prog file1.o file2.o file3.o .....

The -a option is available to indicate the creation of a static executable. The use of -d n without a -r implies -a.