Issue 174388
Summary clang cannot handled _InterlockedIncrement definition in the Windows SDK when cross-building to Arm64
Labels clang
Assignees
Reporter amyspark
    Hi,

This is to report that Clang cannot crosscompile to Windows Arm64 because it cannot handle the definition of `_InterlockedIncrement` in the Windows SDK. I had reported this issue previously to [Microsoft](https://developercommunity.visualstudio.com/t/Arm64-cross-build-breaks-down-on-windows/11022346) but they claim it's a LLVM issue.

<details><summary>Error log</summary>

```
In file included from .. /source/common/cpu.cpp:393:
In file included from .. /source/common\aarch64/cpu.h:67:
In file included from C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\windows.h:176:
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winbase.h(9857,23): error: no matching function for call to '_InterlockedIncrement'
 9857 | return (unsigned) _InterlockedIncrement((volatile long*) Addend);
      | ^~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winbase.h(9853,1): note: candidate function not viable: no known conversion from 'volatile long *' to 'volatile unsigned int *' for 1st argument
 9853 | InterlockedIncrement(
      | ^
 9854 |     _Inout_ _Interlocked_operand_ unsigned volatile *Addend
      | ~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winnt.h(5638,30): note: expanded from macro 'InterlockedIncrement'
 5638 | #define InterlockedIncrement _InterlockedIncrement
      | ^
In file included from .. /source/common/cpu.cpp:393:
In file included from .. /source/common\aarch64/cpu.h:67:
In file included from C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\windows.h:176:
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winbase.h(9866,28): error: no matching function for call to '_InterlockedIncrement'
 9866 | return (unsigned long) _InterlockedIncrement((volatile long*) Addend);
 |                            ^~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winbase.h(9853,1): note: candidate function not viable: no known conversion from 'volatile long *' to 'volatile unsigned int *' for 1st argument
 9853 | InterlockedIncrement(
      | ^
 9854 |     _Inout_ _Interlocked_operand_ unsigned volatile *Addend
      | ~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winnt.h(5638,30): note: expanded from macro 'InterlockedIncrement'
 5638 | #define InterlockedIncrement _InterlockedIncrement
      |                              ^
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winbase.h(9862,1): note: candidate function not viable: no known conversion from 'volatile long *' to 'volatile unsigned long *' for 1st argument
 9862 | InterlockedIncrement(
      | ^
 9863 |     _Inout_ _Interlocked_operand_ unsigned long volatile *Addend
 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winnt.h(5638,30): note: expanded from macro 'InterlockedIncrement'
 5638 | #define InterlockedIncrement _InterlockedIncrement
      |                              ^
In file included from .. /source/common/cpu.cpp:393:
In file included from .. /source/common\aarch64/cpu.h:67:
In file included from C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\windows.h:176:
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winbase.h(9889,28): error: no matching function for call to '_InterlockedDecrement'
 9889 | return (unsigned long) _InterlockedDecrement((volatile long*) Addend);
 |                            ^~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winbase.h(9885,1): note: candidate function not viable: no known conversion from 'volatile long *' to 'volatile unsigned int *' for 1st argument
 9885 | InterlockedDecrement(
      | ^
 9886 |     _Inout_ _Interlocked_operand_ unsigned volatile *Addend
      | ~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winnt.h(5639,30): note: expanded from macro 'InterlockedDecrement'
 5639 | #define InterlockedDecrement _InterlockedDecrement
      |                              ^
In file included from .. /source/common/cpu.cpp:393:
In file included from .. /source/common\aarch64/cpu.h:67:
In file included from C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\windows.h:176:
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winbase.h(9898,28): error: no matching function for call to '_InterlockedDecrement'
 9898 | return (unsigned long) _InterlockedDecrement((volatile long*) Addend);
 |                            ^~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winbase.h(9885,1): note: candidate function not viable: no known conversion from 'volatile long *' to 'volatile unsigned int *' for 1st argument
 9885 | InterlockedDecrement(
      | ^
 9886 |     _Inout_ _Interlocked_operand_ unsigned volatile *Addend
      | ~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winnt.h(5639,30): note: expanded from macro 'InterlockedDecrement'
 5639 | #define InterlockedDecrement _InterlockedDecrement
      |                              ^
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winbase.h(9894,1): note: candidate function not viable: no known conversion from 'volatile long *' to 'volatile unsigned long *' for 1st argument
 9894 | InterlockedDecrement(
      | ^
 9895 |     _Inout_ _Interlocked_operand_ unsigned long volatile *Addend
 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winnt.h(5639,30): note: expanded from macro 'InterlockedDecrement'
 5639 | #define InterlockedDecrement _InterlockedDecrement
      |                              ^
In file included from .. /source/common/cpu.cpp:393:
In file included from .. /source/common\aarch64/cpu.h:67:
In file included from C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\windows.h:176:
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winbase.h(9924,23): error: no matching function for call to '_InterlockedExchange'
 9924 | return (unsigned) _InterlockedExchange((volatile long*) Target, (long) Value);
      |                       ^~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winbase.h(9919,1): note: candidate function not viable: no known conversion from 'volatile long *' to 'volatile unsigned int *' for 1st argument
 9919 | InterlockedExchange(
      | ^
 9920 |     _Inout_ _Interlocked_operand_ unsigned volatile *Target,
      | ~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winnt.h(5641,29): note: expanded from macro 'InterlockedExchange'
 5641 | #define InterlockedExchange _InterlockedExchange
      | ^
In file included from .. /source/common/cpu.cpp:393:
In file included from .. /source/common\aarch64/cpu.h:67:
In file included from C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\windows.h:176:
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winbase.h(9934,28): error: no matching function for call to '_InterlockedExchange'
 9934 | return (unsigned long) _InterlockedExchange((volatile long*) Target, (long) Value);
      |                            ^~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winbase.h(9919,1): note: candidate function not viable: no known conversion from 'volatile long *' to 'volatile unsigned int *' for 1st argument
 9919 | InterlockedExchange(
      | ^
 9920 |     _Inout_ _Interlocked_operand_ unsigned volatile *Target,
      | ~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winnt.h(5641,29): note: expanded from macro 'InterlockedExchange'
 5641 | #define InterlockedExchange _InterlockedExchange
      | ^
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winbase.h(9929,1): note: candidate function not viable: no known conversion from 'volatile long *' to 'volatile unsigned long *' for 1st argument
 9929 | InterlockedExchange(
      | ^
 9930 |     _Inout_ _Interlocked_operand_ unsigned long volatile *Target,
 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winnt.h(5641,29): note: expanded from macro 'InterlockedExchange'
 5641 | #define InterlockedExchange _InterlockedExchange
      |                             ^
In file included from .. /source/common/cpu.cpp:393:
In file included from .. /source/common\aarch64/cpu.h:67:
In file included from C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\windows.h:176:
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winbase.h(9958,23): error: no matching function for call to '_InterlockedExchangeAdd'
 9958 | return (unsigned) _InterlockedExchangeAdd((volatile long*) Addend, (long) Value);
      |                       ^~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winbase.h(9953,1): note: candidate function not viable: no known conversion from 'volatile long *' to 'volatile unsigned int *' for 1st argument
 9953 | InterlockedExchangeAdd(
      | ^
 9954 |     _Inout_ _Interlocked_operand_ unsigned volatile *Addend,
 |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winnt.h(5642,32): note: expanded from macro 'InterlockedExchangeAdd'
 5642 | #define InterlockedExchangeAdd _InterlockedExchangeAdd
      |                                ^
In file included from .. /source/common/cpu.cpp:393:
In file included from .. /source/common\aarch64/cpu.h:67:
In file included from C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\windows.h:176:
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winbase.h(9968,23): error: no matching function for call to '_InterlockedExchangeAdd'
 9968 | return (unsigned) _InterlockedExchangeAdd((volatile long*) Addend,  - (long) Value);
      |                       ^~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winbase.h(9953,1): note: candidate function not viable: no known conversion from 'volatile long *' to 'volatile unsigned int *' for 1st argument
 9953 | InterlockedExchangeAdd(
      | ^
 9954 |     _Inout_ _Interlocked_operand_ unsigned volatile *Addend,
 |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winnt.h(5642,32): note: expanded from macro 'InterlockedExchangeAdd'
 5642 | #define InterlockedExchangeAdd _InterlockedExchangeAdd
      |                                ^
In file included from .. /source/common/cpu.cpp:393:
In file included from .. /source/common\aarch64/cpu.h:67:
In file included from C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\windows.h:176:
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winbase.h(9978,28): error: no matching function for call to '_InterlockedExchangeAdd'
 9978 | return (unsigned long) _InterlockedExchangeAdd((volatile long*) Addend, (long) Value);
      | ^~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winbase.h(9953,1): note: candidate function not viable: no known conversion from 'volatile long *' to 'volatile unsigned int *' for 1st argument
 9953 | InterlockedExchangeAdd(
      | ^
 9954 |     _Inout_ _Interlocked_operand_ unsigned volatile *Addend,
 |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winnt.h(5642,32): note: expanded from macro 'InterlockedExchangeAdd'
 5642 | #define InterlockedExchangeAdd _InterlockedExchangeAdd
      | ^
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winbase.h(9973,1): note: candidate function not viable: no known conversion from 'volatile long *' to 'volatile unsigned long *' for 1st argument
 9973 | InterlockedExchangeAdd(
      | ^
 9974 |     _Inout_ _Interlocked_operand_ unsigned long volatile *Addend,
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winnt.h(5642,32): note: expanded from macro 'InterlockedExchangeAdd'
 5642 | #define InterlockedExchangeAdd _InterlockedExchangeAdd
      |                                ^
In file included from .. /source/common/cpu.cpp:393:
In file included from .. /source/common\aarch64/cpu.h:67:
In file included from C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\windows.h:176:
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winbase.h(9988,28): error: no matching function for call to '_InterlockedExchangeAdd'
  9988 | return (unsigned long) _InterlockedExchangeAdd((volatile long*) Addend,  - (long) Value);
       | ^~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winbase.h(9953,1): note: candidate function not viable: no known conversion from 'volatile long *' to 'volatile unsigned int *' for 1st argument
 9953 | InterlockedExchangeAdd(
      | ^
 9954 |     _Inout_ _Interlocked_operand_ unsigned volatile *Addend,
 |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winnt.h(5642,32): note: expanded from macro 'InterlockedExchangeAdd'
 5642 | #define InterlockedExchangeAdd _InterlockedExchangeAdd
      | ^
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winbase.h(9973,1): note: candidate function not viable: no known conversion from 'volatile long *' to 'volatile unsigned long *' for 1st argument
 9973 | InterlockedExchangeAdd(
      | ^
 9974 |     _Inout_ _Interlocked_operand_ unsigned long volatile *Addend,
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\winnt.h(5642,32): note: expanded from macro 'InterlockedExchangeAdd'
 5642 | #define InterlockedExchangeAdd _InterlockedExchangeAdd
      |                                ^
In file included from .. /source/common/cpu.cpp:393:
In file included from .. /source/common\aarch64/cpu.h:67:
In file included from C:\Program Files (x86)\Windows Kits\10\\inc<truncated>Please see the issue for the entire body.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to