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


Read syntax diagramSkip visual syntax diagram               .-=--small-.
>>- -q----pic--+----------+------------------------------------><


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.


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

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

Specifying -qpic=large has the same effect as passing -bbigtoc to ld.


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

xlc mylib.c -qpic=small -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 information