Bug 108678 - Windows on ARM64 platform target aarch64-w64-mingw32
Summary: Windows on ARM64 platform target aarch64-w64-mingw32
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 13.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Blocks: 115083
  Show dependency treegraph
Reported: 2023-02-05 14:43 UTC by Brecht Sanders
Modified: 2024-06-05 13:39 UTC (History)
6 users (show)

See Also:
Target: Aarch64-mingw
Known to work:
Known to fail:
Last reconfirmed: 2023-11-09 00:00:00


Note You need to log in before you can comment on or make changes to this bug.
Description Brecht Sanders 2023-02-05 14:43:03 UTC
Are there plans to support Windows (using MinGW-w64) on ARM64?

The triplet for this platform should be: aarch64-w64-mingw32

I'm trying to build natively on a Windows on ARM device (bootstrapping from LLVM/CLang).

Since binutils 2.40 there some support for aarch64 COFF/PE format, and I already built a working binutils with the following supported targets:

ld --help|sed -n "s/^.*supported targets: //p"
pe-x86-64 pei-x86-64 pe-bigobj-x86-64 elf64-x86-64 pe-i386 pei-i386 elf32-i386
elf32-iamcu pdb elf64-little elf64-big elf32-little elf32-big pe-bigobj-i386 pe-aarch64-little pei-aarch64-little srec symbolsrec verilog tekhex binary ihex plugin

So it looks like pe-aarch64-little and pei-aarch64-little are listed.

I'm don't know if a pe-bigobj-aarch64-little is needed or if it will be supported in the future.

My first attempt to get gcc (I tried with source tarball 12.2.0) to configure was changing the following line in gcc/config.gcc:

i[34567]86-*-mingw* | x86_64-*-mingw*)


i[34567]86-*-mingw* | x86_64-*-mingw* | aarch64-*-mingw*)

but then I get the following error:

Unknown tune used in --with-tune=generic

What needs to be changed to get past that?
Comment 1 Andrew Pinski 2023-02-05 18:19:54 UTC
I have not seen anyone step up to patch GCC for aarch64-mingw yet.
Most aarch64 developers don't use Windows at all. There is some support being worked on for aarch64 darwin (Mac OS) though.
Comment 2 Brecht Sanders 2023-02-05 19:23:30 UTC
I would love to give it a go if only I knew where to add the support.

I actually got a Windows on ARM device hoping I could figure it out, bit it looks I will need tome help.

The "Unknown tune used in --with-tune=generic" error is where I'm currently stuck, and I couldn't figure out in which file(s) I need to address this.
Comment 3 Brecht Sanders 2023-06-24 20:14:11 UTC
Any pointers on which files to edit in order to support aarch64-mingw ?

I think it won't require reinventing the wheel as it will probably be a mix of existing *-mingw and aarch64-* stuff...
Comment 4 Zac Walker 2023-06-26 08:25:15 UTC
I have been working on an experimental aarch64-w64-mingw32 toolchain. It can build several C libraries and small executables successfully. Currently parked here on github:


It is based on previous work by Mark Harmstone and Jedidiah Thompson. I am currently working on structured exception handling support. This seems to be the main missing part - without it C++ exceptions do not work.
Comment 5 Brecht Sanders 2023-06-26 18:05:49 UTC
Thanks Zac, how can I see what you actually changed?
Is there a particular GCC version I can diff https://github.com/ZacWalk/gcc-woarm64 against?
Comment 6 Zac Walker 2023-06-26 20:34:11 UTC
I have been rebasing regularly to keep all my changes on top of the commit log. You can use github's compare url to combine my changes into a single diff (based on commit hash). For example:

Comment 7 Jonathan Wakely 2023-06-26 22:05:05 UTC
The change to libstdc++-v3/src/c++17/fast_float/fast_float.h should be done upstream: https://github.com/fastfloat/fast_float
Comment 8 Zac Walker 2023-06-28 11:40:57 UTC
Thanks Jonathan. I am still in test and cleanup up mode but hope to start upstreaming in a few weeks.
Comment 9 Andrew Pinski 2023-11-09 03:47:16 UTC
Comment 10 Brecht Sanders 2024-04-17 20:15:55 UTC
What is the status of GCC support for aarch64-w64-mingw32 ?

I just tried GCC 14 snapshot 20240414 and it looks like it's still not supported.

Build fails with:
*** Configuration aarch64-w64-mingw32 not supported
Comment 11 Andrew Pinski 2024-04-17 20:20:35 UTC
(In reply to Brecht Sanders from comment #10)
> What is the status of GCC support for aarch64-w64-mingw32 ?
> I just tried GCC 14 snapshot 20240414 and it looks like it's still not
> supported.
> Build fails with:
> *** Configuration aarch64-w64-mingw32 not supported

Patches have started to be posted but won't be fully reviewed/committed until after GCC 14 is released due to them coming in late (during stage 4) in the release cycle (See https://gcc.gnu.org/develop.html for the full gcc release/development cycle).
Comment 12 Christophe Lyon 2024-04-18 09:14:22 UTC
Indeed the plan is to commit the first series (https://gcc.gnu.org/pipermail/gcc-patches/2024-April/649261.html) once stage-1 re-opens (as approved in https://gcc.gnu.org/pipermail/gcc-patches/2024-April/649299.html
Comment 13 cqwrteur 2024-05-14 08:08:30 UTC
/home/cqwrteur/toolchains_build/gcc/gcc/c-family/c-format.cc:5159:(.text+0x7c1): undefined reference to `msformat_init()'
/usr/local/lib/gcc/x86_64-pc-linux-gnu/15.0.0/../../../../x86_64-pc-linux-gnu/bin/ld: c-family/c-format.o: in function `cmp_attribs(char const*, char const*)':

Can you explain to me what is going on? Thank you!
Comment 14 cqwrteur 2024-05-14 09:56:55 UTC

/home/cqwrteur/toolchains_build/gcc/libgcc/libgcov.h:49:10: fatal error: sys/mman.h: No such file or directory
   49 | #include <sys/mman.h>
      |          ^~~~~~~~~~~~
compilation terminated.
make[4]: *** [Makefile:933: _gcov_interval_profiler.o] Error 1
make[4]: *** Waiting for unfinished jobs....
Comment 15 Evgeny Karpov 2024-06-05 13:39:54 UTC
It looks like the same issue which was described here
Please specify only C language in the configuration for now.