Re: effect of -fPIC on code speed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Miles Bader <miles@xxxxxxx> writes:

> Ian Lance Taylor <iant@xxxxxxxxxx> writes:
>> The -fPIC option inhibits code inlining, which is probably why you are
>> seeing smaller object files.
>
> Hmm, that's an unexpected side-effect... maybe the gcc documentation
> should mention it?

There is a great deal one could say about -fPIC.  It's hard to know what
should be said in the gcc docs.  To me it seems more appropriate in some
document about what PIC really is.

What happens here is that when using -fPIC symbol interposition is
permitted for any globally visible symbol.  That is, the -fPIC code is
presumed to wind up in a shared library.  An executable may override any
function in a shared library.  The code in the shared library which
calls that function is then expected to call the definition in the
executable instead.  It follows that when using -fPIC the compiler may
not inline any call to a globally visible function, because that would
prevent symbol interposition.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux