pic

Applies to C Applies to C++

Purpose

Instructs the compiler to generate Position-Independent Code suitable for use in shared libraries.

Syntax


Syntax Diagram

where


nopic Instructs the compiler to not generate Position Independant Code.
pic Instructs the compiler to generate Position Independant Code.
small Instructs the compiler to assume that the size of the Global Offset Table is no larger than 64 Kb.
large Allows the Global Offset Table to be larger than 64 Kb in size, allowing more addresses to be stored in the table. Code generated with this option is usually larger than that generated with -qpic=small.

Notes

If -qpic is specified without any suboptions, -qpic=small is assumed.

The -qpic option is implied if the -qmkshrobj compiler option is specified.

Specifying -q64 automatically implies -qpic.

Example

To compile a shared library libmylib.so, use the following command:

xlc mylib.c -qpic -Wl, -shared, -soname="libmylib.so.1" -o libmylib.so.1

Refer to the ld command in your operating system documentation for more information about the -shared and -soname options.

Related References

Compiler Command Line Options
32, 64
mkshrobj IBM Copyright 2003