[PATCH] winnt.h: Fix MSVC variants of InterlockedIncrement16 and InterlockedDecrement16.
Jacek Caban
jacek at codeweavers.com
Tue Feb 16 15:55:23 CST 2021
On 15.02.2021 12:58, Martin Storsjö wrote:
> On Wed, 10 Feb 2021, Martin Storsjö wrote:
>
>> On Wed, 10 Feb 2021, Jacek Caban wrote:
>>
>>> I had another look at it and I sent the part that replaces use of
>>> llvm-ar and llvm-ranlib with lld-link /lib. However, I couldn't get
>>> importlibs using lld-link -implib right. I tried MSVC, suspecting
>>> that something is wrong with lld-link, but I found that what I was
>>> trying to do is not supported by link.exe. -implib option is really
>>> meant for an addition to linker, not for importlib-only execution.
>>
>> It does seem to work for me, e.g. like this:
>>
>> link.exe -lib -machine:arm64 -def:test.def -out:test.lib
>>
>> However lld-link doesn't implement that combination, so you're right
>> that llvm-dlltool is the one we have to use for now. I guess I should
>> look into implementing that option combination at some point though.
>
> Actually, lld-link has implemented a very similar variant:
>
> lld-link -machine:arm64 -def:test.def -implib:test.lib
>
> Which does the equivalent of
>
> link.exe -lib -machine:arm64 -def:test.def -out:test.lib
>
> This hasn't been implemented in llvm-lib though (which is what you get
> when calling lld-link /lib); it'd require moving a couple functions
> out from lld into the lower level libraries/interfaces that are shared
> with llvm-lib.
>
> If you're ok with deviating from the strict MSVC interfaces, then just
> "lld-link -machine: -def: -implib:" does that though.
I tried that and I couldn't get it to work. That's what this patch does:
https://source.winehq.org/patches/data/198665
x86 build with that patch has broken imports because it includes stdcall
decorations in import table. I couldn't make it stop doing that. With
additional '=undecoredsymbol' in .def files I could strip leading
underscore, but import entries still contained '@argsize' part. I'm
attaching a minimal test case reproducing it without winebuild. I get:
$ make test
lld-link -machine:i386 -def:test.def -implib:libtest.a
clang -o test.exe -fuse-ld=lld test.c -nodefaultlibs -nostartfiles
libtest.a -Wl,-entry:testentry -target i686-windows -Wl,-subsystem:windows
winedump -j import test.exe |grep TestFunc
00002030 1 _TestFunc at 0
Maybe I'm missing something. It might be an intended behaviour, that's
why I tried to experiment with link.exe.
Thanks,
Jacek
-------------- next part --------------
A non-text attachment was scrubbed...
Name: deftest.tar.xz
Type: application/x-xz
Size: 548 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20210216/f843d813/attachment.xz>
More information about the wine-devel
mailing list