This answer indicates that compiling with -fPIC
"emit[s] position-independent code...[and] makes a difference on AArch64, m68k, PowerPC and SPARC."
Indeed, I believe it might fix this bug for sparc64 and I would like to try it out. The easiest fix would be to always enable -fPIC but I want to understand if that is appropriate. In order to sharpen my axe before I start experimenting with -fPIC
:
Are there any downsides or reasons not to use -fPIC
or -fpic
?
- Performance?
- Compatibility?
- Shared lib considerations?
- Static build considerations?
- Others?
It -fPIC
seems to fix a few different compilation/linking issues---but after all, its an option, so when wouldn't you use it?
(If PIC incurs a bit of overhead at runtime to get started then that is ok, but if it affects runtime performance after main() starts then I would like to understand the details.)