Relocatable EXEs (was [ros-kernel] ReactOS 0.3.0 Release Plans)

Filip Navara xnavara at volny.cz
Sat Sep 18 14:54:43 CEST 2004


Filip Navara wrote:

> Barubary wrote:
>
>>>> - *Relocatable EXEs*
>>>
>>>
>>>
>>> Damn, where did you get this? To my best knowledge binutils support 
>>> relocatable executables.
>>
>>
>>
>> I never found a way, and neither did the ReactOS team.  binutils 
>> seems to assume that EXEs are never relocatable, while DLLs always 
>> are.  Both statements are false, though a non-relocatable DLL isn't 
>> very useful.
>
>
> I'm not going to say that there aren't problems with it, but BinUtils 
> are able to generate relocatable executables and there are at least 
> two methods to do that:
> 1) Passing "-pie" and "--image-base" base options to "ld" and then 
> manually (or using some tool) remove the DLL flag from the PE header. 
> Actually it's a bug that the DLL flag is ever placed in the PE header, 
> but it's pretty easy to workaround it. Also for the NTOSKRNL case in 
> ReactOS we really don't care if there is the DLL flag as the 
> FreeLoader doesn't check it (only the user mode loader does that... 
> (I'm not sure if this is actually implemented in ReactOS)).
> 2) Using a linker script.
> I have never tried to use the second method, but I was told it's 
> possible. For the first method I can supply the tool if needed.

Even better...Attached is a patch against BinUtils 15/08/04 that fixed 
the "-pie" support for PE exectuables. If someone wants to forward it to 
the BinUtils people feel free to do so and leave me a note.

Regards,
Filip
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ld.diff
Type: text/x-patch
Size: 1004 bytes
Desc: not available
Url : http://reactos.com:8080/pipermail/ros-kernel/attachments/20040918/674e2270/ld.bin


More information about the Ros-kernel mailing list