Re: Pic vs. non Pic library code?

"John Smith" <js@xxxxxxxxxxxxxxx> writes:

> Thanks for the explanation. So you're saying there is PIC enabled code will
> always work with both binaries and shared objects?


> My users could not care less about a few extra
> milliseconds wasted in the loader.

It's not just the startup that you pay performance hit in PIC code.

Every call (even call from your library into itself) carries a
small penalty:

non-PIC code:

call 0x12345678 <bar>

PIC code:

call 0x23456789 <PLT+48>

jmp *(GOT+4) # loader sets things up such that on 2nd and
# subsequent calls this jumps directly to 'bar'

So instead of direct call, you execute 'call + jump-indirect'
There is similar overhead for non-static data references.

For most non-CPU critical tasks this is perfectly acceptable;
but sometimes it isn't.

In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.