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

Re: Should .a library contains non-reallocatable code?



On 20/02/2015 12:06, Simon McVittie wrote:
> On 19/02/15 23:19, Jeff Epler wrote:
>> Here are two scenarios where building a static library (libfoo) with
>> -fPIC is desirable
> ...
>> I wonder whether these scenarios were considered when the Policy was
>> written.
> Conversely, when that part of the policy was written, 32-bit x86 was the
> major architecture.
>
> My understanding is that i386 performance suffers significantly from PIC
> (since PIC uses up a CPU register, and i386 doesn't have many of those),
> whereas on architectures with more registers (notably including ARM,
> x86-64 (including x32) and PowerPC), it doesn't hurt anywhere near as much.

There is also the cost of a indirections (a double indirection, IIRC) to
reach global variables on PIC code through the GOT, while non-PIC code
can reach global objects directly.

Alastair

>     S
>
>

-- 
Alastair McKinstry, <alastair@sceal.ie>, <mckinstry@debian.org>, https://diaspora.sceal.ie/u/amckinstry
Misentropy: doubting that the Universe is becoming more disordered. 


Reply to: