Instructs the compiler to generate Position-Independent Code suitable for use in shared libraries.
.-nopic-------------. | .-=--small-. | >>- -q--+-pic--+----------+-+---------------------------------->< '-=--large-'
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. |
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.
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 information