This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: about -fpic/-fPIC option for gcc



Lin George wrote:
> 
> Hello everyone,
> 
> 
> I am confused about the meaning and function of -fpic
> and -fPIC option of gcc. I am more confused when after
> reading the manual of gcc (for example, what means
> PIC, GOT, constant addresses, etc.). Could anyone
> explain to me what are their functions in easy to
> understand words?
> 
> Here are the descriptions from gcc manual, which makes
> me confused. :-)
> 

While -fpic is platform-dependent, -fPIC works always, but generates much
more code than -fpic does.
In practice, using an non-technical language, -fPIC will generate a code
capable to see things beyond
the normal scope, so that system can map the (position independent) code in
any case.
The rule is: if you want a fast and small code, and the target is
pic-enabled, use -fpic.
Otherwise, avoid headhaches using -fPIC always.

Regards,
Marcelo Slomp
-- 
View this message in context: http://www.nabble.com/about--fpic--fPIC-option-for-gcc-tf2209766.html#a6308284
Sent from the gcc - Help forum at Nabble.com.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]