[PATCH] Support for -pie flag on PE executables

Filip Navara xnavara@volny.cz
Tue Sep 28 16:18:00 GMT 2004


> I don't exactly understand what is going on here. It seems like link_info.shared
> is being set when a PIE executable is created?  Is that right?

Right.

> That would indicate
> that it is not possible to create a PIE DLL, which sort of makes sense but I'm
> still not sure why info->shared is being used.

info->shared is set either when DLL is to be created (-shared flag) or when relocatable 
executable should be created (-pie flag). Without this patch the -pie flag would make the 
linker think that we want to build a DLL (because it doesn't respect link_info.pie at 
all), but actually we want only relocatable EXE. The only difference between DLL and 
relocatable EXE is the DLL flag in PE header and the default base address. My patch just 
makes the linker correctly interpret these two differences between -pie and -shared.

Regards,
Filip



More information about the Binutils mailing list