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

Re: Ch.10.2 Libraries - shared lib compilation - -fPIC



Russ Allbery wrote:
> Andrey Rahmatullin <wrar@debian.org> writes:
> > Text relocations are forbidden at least on amd64 though.
> > https://stackoverflow.com/questions/7865059/why-does-gcc-force-pic-for-x64-shared-libs
>
> Yeah, but I believe not on i386.
>
> This is really a very 32-bit, x86-specific problem.

Also, x86-64 has %rip as an accessible register and %rip-relative addressing,
so it doesn't require tricks like "call next instruction, pop off the return
value, offset from that". With %rip-relative addressing, PIC doesn't cost you a
register at all.


Reply to: