2011-01-29 04:18:43     When to use -fpic/fPIC?

Document created by Aaronwu Employee on Aug 26, 2013
Version 1Show Document
  • View in full screen mode

2011-01-29 04:18:43     When to use -fpic/fPIC?

Gilles Ganault (FRANCE)

Message: 97749   




The article on creating libraries doesn't mention the -fpic/fPIC option. I have a couple of questions:


1. When should we use those switches?


2. Should we use -fpic or -fPIC?


3. Should we use them for all binaries (application + libraries) or only when compiling libraries?


4. If only needed to compile libraries, should we use them only with shared libraries, static libraries, or both?


Thank you.




2011-01-29 04:43:02     Re: When to use -fpic/fPIC?

Mike Frysinger (UNITED STATES)

Message: 97750   


you do not need to use or worry about either flag.  the toolchain itself will take care of it.





2011-01-29 05:10:16     Re: When to use -fpic/fPIC?

Gilles Ganault (FRANCE)

Message: 97751   


Good to know. Thank you.