use shared lib of libbackend.so

Ian Lance Taylor iant@google.com
Sat Apr 2 19:28:00 GMT 2011


kevin diggs <diggskevin38@gmail.com> writes:

> On Sat, Apr 2, 2011 at 12:37 PM, Ian Lance Taylor <iant@google.com> wrote:
>>
>> I'm kind of surprised that it is twice as slow.  But it is true that on
>> an ELF system shared libraries are always slower than static libraries,
>> though the slowdown is normally more on the order of 5%.
>>
> Is this a characteristic of ELF? Or how 'most' processors have to
> implement PIC in ELF (i.e. could a ... better designed processor have
> the same performance?)?

It's a characteristic of ELF.  In a shared library, all calls to
globally visible functions have to go through the PLT.  All references
to global variables have to go through the GOT.  Some slowdown is
inevitable.  You can adjust somewhat by using symbol visibility, but
that would be somewhat painful in the gcc source code base, and the gain
would be minimal.

Ian



More information about the Gcc-help mailing list