Enables or disables the generation of position-independent code with relative address references, which are independent of the location where your program is loaded.
Default
The default is -fno-pic.
Syntax
-fpic
-fno-pic
Parameters
None.
Operation
If you use -fpic, then the compiler:
Accesses all static data using PC-relative addressing.
Accesses all imported or exported read-write data using a Global Offset Table
(GOT) entry created by the linker.
Accesses all read-only data relative to the PC.
Position-independent code compiled with -fpic is suitable for
use in SysV and BPABI shared objects.
-fpic causes the compiler to invoke armlink with
the --fpic option when performing the link step.
Note:
When building a shared library, use -fpic together with either
the -fvisibility option or the visibility attribute, to control
external visibility of functions and variables.
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers of your data.