[PATCH] winebuild: Rename delay import libs .text$2 section to .data$2.

Jacek Caban jacek at codeweavers.com
Mon Nov 1 10:36:46 CDT 2021


On 10/22/21 9:22 PM, Alexandre Julliard wrote:
> Rémi Bernon <rbernon at codeweavers.com> writes:
>
>> GNU dlltool outputs the DELAY_IMPORT_DESCRIPTOR of delay import libs in
>> a .text$2 section, which is then merged into .text and changes its flags
>> to add the DATA flag.
>>
>> This is incorrect and breaks some DRMs, which are then validating that
>> .text sections doesn't have the IMAGE_SCN_CNT_INITIALIZED_DATA flag set.
>>
>> Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
>> ---
>>
>> This is actually more some kind of RFC, as I'm not sure at all what this
>> change really implies and why the descriptor has to be in .text in the
>> first place. It seems like some GNU specific thing, as it seems from
>> internet comments that MSVC places the descriptor in .data section?
> Yes, it sounds like it should be fixed in binutils. Sadly the delay
> import support in dlltool is not great, maybe we should try to find a
> way to bypass it.


Technically, all that dlltool does we could do ourselves in winebuild, 
so we could potentially generate delay importlibs ourselves. However, I 
think that the whole binutils' idea of delay importlibs is just a hack 
that we'd ideally not follow. The right solution, in my opinion, is 
having proper support for -delayload linker flag. lld-link already got 
it right and Wine can use it (so I'd expect that the problem doesn't 
exist in llvm-mingw or pure Clang Wine builds). It should be possible to 
implement that in LD as well.


Jacek




More information about the wine-devel mailing list