On gcc target machines, when one wanted to compile a shared library, one would need to specify -fpic or -fPIC to get things to work correcly. This is because by default absolute
You never needed to generate separate .o
files. Always specify the compiler options to generate portable code (typically -fPIC
).
On some systems, the compiler may be configured to force this option on, or set it by default. But it doesn't hurt to specify it anyway.
Note: One hopes that where PC-relative addressing is supported and performs well, that -fPIC
uses that mode rather than dedicating an extra register.