Re: [PATCH] Cygwin: resolve AArch64 linking by linking to onecore instead of kernel32

Jon Turney <[email protected]> Fri, 5 Jun 2026 15:37:47 +0100
Newsgroups gmane.os.cygwin.patches
Message-ID <[email protected]>
On 14/07/2025 14:11, Corinna Vinschen wrote:
> Hi Radek,
> 
> On Jul 10 19:14, Radek Barton via Cygwin-patches wrote:
>> Hello.
>>
>> As Windows Arm64 platform does not carry historical compatibility layers, the structure of Windows API DLLs is cleaner on Arm64 than on x64. For this reason, the x64 linking against `kernel32.dll` is not sufficient leading to undefined references to many Windows API symbols that are in different DLLs that would have to be added to the linking command explicitly.
>>
>> To address that, there is a concept of umbrella DLLs (https://learn.microsoft.com/en-us/windows/win32/apiindex/windows-umbrella-libraries), that can be added instead. The recommended replacement for `kernel32.dll` is `onecore.dll` (https://learn.microsoft.com/en-us/windows-hardware/drivers/develop/building-for-onecore#building-for-onecore) that should be available since Windows 7.
>>
>> In case of Cygwin linking, there is one exception, `pdh.dll` (Performance Data Helper, https://learn.microsoft.com/en-us/windows/win32/perfctrs/performance-counters-functions), that is not included in the `onecore.dll`.
> 
> The pdh functions used by Cygwin are NOT linked against.  They are
> runtime loaded (see autoload.cc, right at the end), so it should not be
> necessary to link against libpdh.a.  Can you please check again?
  I assume that -lpdh has been added here because the autoload stubs 
used during aarch64 development translate into direct linkage.

Hopefully, it's not necessary with a full autoload implementation .