[fpc-pascal] Text relocation in x86 binary lib
Matthias Klumpp
matthias at nlinux.org
Mon May 31 16:26:46 CEST 2010
On Mon, 31 May 2010 14:31:19 +0200, Jonas Maebe <jonas.maebe at elis.ugent.be>
wrote:
> On 31 May 2010, at 14:23, Matthias Klumpp wrote:
>
>> A quick check which eu-findtextrels found a lot of those in the lib.
>> Exactly the same code compiled for 64bit does not contain any text
>> relocation.
>> How can this happen?
>
> It's because we don't generate PIC (position-independent code) by
> default on Linux-i386, because
> a) PIC is fairly inefficient on i386 (it requires an extra register,
> and the i386 is already register-starved as it is -- on average, it
> results in a 10% performance degradation)
> b) very few people use SELinux, and on non-SELinux systems dynamic
> libraries without PIC work fine (with a small memory usage penalty,
> because the code cannot be shared amongst multiple processes)
According to SELinux, this is a security issue..
> On x86-64, there is almost no penalty for PIC vs no PIC.
> You have to recompile the entire RTL and your own code with the -Cg
> compiler option to get shared libraries that only contain PIC.
Then it's up to red Hat to fix this in FPC or in SELinux.
Thanks!
More information about the fpc-pascal
mailing list