JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris 11.1 Linkers and Libraries Guide     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information

Preface

Part I Using the Link-Editor and Runtime Linker

1.  Introduction to the Oracle Solaris Link Editors

2.  Link-Editor

3.  Runtime Linker

4.  Shared Objects

Part II Quick Reference

5.  Link-Editor Quick Reference

Static Mode

Creating a Relocatable Object

Creating a Static Executable

Dynamic Mode

Creating a Shared Object

Creating a Dynamic Executable

Part III Advanced Topics

6.  Direct Bindings

7.  Building Objects to Optimize System Performance

8.  Mapfiles

9.  Interfaces and Versioning

10.  Establishing Dependencies with Dynamic String Tokens

11.  Extensibility Mechanisms

Part IV ELF Application Binary Interface

12.  Object File Format

13.  Program Loading and Dynamic Linking

14.  Thread-Local Storage

Part V Appendices

A.  Linker and Libraries Updates and New Features

B.  System V Release 4 (Version 1) Mapfiles

Index

Dynamic Mode

Dynamic mode is the default mode of operation for the link-editor. It can be enforced by specifying the -d y option, but is implied when not using the -d n option.

Under this mode, relocatable objects, shared objects and archive libraries are acceptable forms of input. Use of the -l option results in a directory search, where each directory is searched for a shared object. If no shared object is found, the same directory is then searched for an archive library. A search only for archive libraries can be enforced by using the -B static option. See Linking With a Mix of Shared Objects and Archives.

Creating a Shared Object

The following example combines the above points.

$ cc -c -o foo.o -K pic -xregs=no%appl foo.c
$ cc -M mapfile -G -o libfoo.so.1 -z text -z defs -B direct -z lazyload \
-z discard-unused=sections -R /home/lib foo.o -L. -lbar -lc

The following example combines the above points.

$ cc -M mapfile -G -o libfoo.so.1 -z text -z defs -B direct -z lazyload \
-z discard-unused=sections -R /home/lib -h libfoo.so.1 foo.o -L. -lbar -lc
$ ln -s libfoo.so.1 libfoo.so

Creating a Dynamic Executable

The following example combines the above points.

$ cc -o prog -R /home/lib -z discard-unused=dependencies -z lazyload -B direct -L. \
-lfoo file1.o file2.o file3.o .....