[PATCH] winnt.h: Fix MSVC variants of InterlockedIncrement16 and InterlockedDecrement16.

Martin Storsjö martin at martin.st
Mon Feb 15 05:58:28 CST 2021


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.

// Martin


More information about the wine-devel mailing list