Why is the fPIC switch missing?

Vladimir Panteleev thecybershadow.lists at gmail.com
Mon Sep 23 19:17:29 UTC 2019


On Monday, 23 September 2019 at 08:19:35 UTC, Boris Carvajal 
wrote:
> On Monday, 23 September 2019 at 01:31:03 UTC, Emmanuelle wrote:
>> Hello. My problem is exactly what it says on the title: my dmd 
>> (windows 7, x64) doesn't seem to have -fPIC:
>
> I think it's not needed. The generated code on Windows is 
> always position independent.

I believe Windows uses relocations. Relocations require patching 
the image after loading using a relocation table. 
Position-independent code does not require relocations, it is 
ready to run from any address straight after loading. This allows 
multiple copies of programs or libraries to be loaded at the same 
time in different processes at different addresses (with ASLR), 
but share their physical memory pages.



More information about the Digitalmars-d-learn mailing list