Purpose
Generates position-independent
code suitable for use in shared libraries.
Syntax
.-nopic-----------------.
>>- -q--+-pic--+--------------+-+------------------------------><
| .-small-. |
'-=--+-large-+-'
Defaults
- -qnopic in 32-bit compilation mode when
the -qmkshrobj option is not specified.
- -qpic=small in 64-bit compilation mode.
- -qpic=small when the -qmkshrobj option is specified.
Parameters
- small
- Instructs the compiler to assume that the size of the Global Offset Table (GOT) in 32-bit
mode or Table of Contents (TOC) in 64-bit mode is no larger than 64 Kb. When -qpic=small is
in effect, the compiler generates one instruction for each GOT or TOC access.
- large
- Instructs the compiler to assume that the size of the TOC is larger
than 64 Kb in 64-bit mode. When -qpic=large is
in effect, the compiler generates two instructions for each TOC access
to enlarge the accessing range. This helps avoid TOC overflow conditions
when the Table of Contents is larger than 64 Kb.
Specifying -qpic without
any suboptions is equivalent to -qpic=small.
Usage
When you specify -qpic=large -qtls -q64,
thread local storage (TLS) symbols are not affected by -qpic=large.
When -q64 is in effect, -qpic is always
enabled.
You can use different TOC access options for different
compilation units in an application.
Note: For applications whose
TOC size is larger than 64K, using -qpic=large can
improve performance. However, for applications whose TOC is smaller
than 64K, using -qpic=large slows down the program.
To decide whether to use -qpic=large, compile the
program with -qpic=small first. If an overflow
error message is generated, use -qpic=large instead.