Message ID | VI1PR83MB04314E947B1CF296708085DDF8572@VI1PR83MB0431.EURPRD83.prod.outlook.com |
---|---|
Headers | show |
Series | Add aarch64-w64-mingw32 target | expand |
Hi Evgeny, Great job! For reference, here is a test build of this patch series using Linaro Toolchain CI: https://ci.linaro.org/view/tcwg-build/job/tcwg_gnu_mingw_build--master-woa64-build/9/artifact/artifacts/ -- Maxim Kuvyrkov https://www.linaro.org > On Feb 21, 2024, at 21:47, Evgeny Karpov <Evgeny.Karpov@microsoft.com> wrote: > > Hello, > > We would like to take your attention to the review of changes for the > new GCC target, aarch64-w64-mingw32. The new target will be > supported, tested, added to CI, and maintained by Linaro. This marks > the first of three planned patch series contributing to the GCC C > compiler's support for Windows Arm64. > > 1. Minimal aarch64-w64-mingw32 C implementation to cross-compile > hello-world with libgcc for Windows Arm64 using MinGW. > 2. Extension of the aarch64-w64-mingw32 C implementation to > cross-compile OpenSSL, OpenBLAS, FFmpeg, and libjpeg-turbo. All > packages successfully pass tests. > 3. Addition of call stack support for debugging, resolution of > optimization issues in the C compiler, and DLL export/import for the > aarch64-w64-mingw32 target. > > This patch series introduces the 1st point, which involves building > hello-world for the aarch64-w64-mingw32 target. The patch depends on > the binutils changes for the aarch64-w64-mingw32 target that have > already been merged. > > The binutils should include recent relocation fixes. > f87eaf8ff3995a5888c6dc4996a20c770e6bcd36 > aarch64: Add new relocations and limit COFF AArch64 relocation offsets > > The series is structured in a way to trivially show that it should not > affect any other targets. > > In this patch, several changes have been made to support the > aarch64-w64-mingw32 target for GCC. The modifications include the > definition of the MS ABI for aarch64, adjustments to FIXED_REGISTERS > and STATIC_CHAIN_REGNUM for different ABIs, and specific definitions > for COFF format on AArch64. Additionally, the patch reuses MinGW > <stdint.h> types and definitions from i386, relocating them to a new > mingw folder for shared usage between both targets. > > MinGW-specific options have been introduced for AArch64, along with > override options for aarch64-w64-mingw32. Builtin stack probing for > override options for aarch64-w64-mingw32. Builtin stack probing for > AArch64 has been enabled as an alternative for chkstk. Symbol name > encoding and section information handling for aarch64-w64-mingw32 have > been incorporated, and the MinGW environment has been added, which > will also be utilized for defining the Cygwin environment in the > future. > > The patch includes renaming "x86 Windows Options" to "Cygwin and MinGW > Options," which now encompasses AArch64 as well. AArch64-specific > Cygwin and MinGW Options have been introduced for the unique > requirements of the AArch64 architecture. > > Function type declaration and named sections support have been added. > The necessary objects for Cygwin and MinGW have been built for the > aarch64-w64-mingw32 target, and relevant files such as msformat-c.cc > and winnt-d.cc have been moved to the mingw folder for reuse in > AArch64. > > Furthermore, the aarch64-w64-mingw32 target has been included in both > libatomic and libgcc, ensuring support for the AArch64 architecture > within these libraries. These changes collectively enhance the > capabilities of GCC for the specified target. > > Coauthors: Zac Walker <zacwalker@microsoft.com>, > Mark Harmstone <mark@harmstone.com> and > Ron Riddle <ron.riddle@microsoft.com> > > Refactored, prepared, and validated by > Radek Barton <radek.barton@microsoft.com> and > Evgeny Karpov <evgeny.karpov@microsoft.com> > > Special thanks to the Linaro GNU toolchain team for internal review > and assistance in preparing the patch series! > > Regards, > Evgeny > > > Zac Walker (13): > Introduce aarch64-w64-mingw32 target > aarch64: The aarch64-w64-mingw32 target implements the MS ABI > aarch64: Mark x18 register as a fixed register for MS ABI > aarch64: Add aarch64-w64-mingw32 COFF > Reuse MinGW from i386 for AArch64 > Rename section and encoding functions from i386 which will be used in > aarch64 > Exclude i386 functionality from aarch64 build > aarch64: Add Cygwin and MinGW environments for AArch64 > aarch64: Add SEH to machine_function > Rename "x86 Windows Options" to "Cygwin and MinGW Options" > aarch64: Build and add objects for Cygwin and MinGW for AArch64 > aarch64: Add aarch64-w64-mingw32 target to libatomic > Add aarch64-w64-mingw32 target to libgcc > > fixincludes/mkfixinc.sh | 3 +- > gcc/config.gcc | 47 +++-- > gcc/config/aarch64/aarch64-coff.h | 92 +++++++++ > gcc/config/aarch64/aarch64-opts.h | 7 + > gcc/config/aarch64/aarch64-protos.h | 5 + > gcc/config/aarch64/aarch64.h | 25 ++- > gcc/config/aarch64/cygming.h | 178 ++++++++++++++++++ > gcc/config/i386/cygming.h | 18 +- > gcc/config/i386/cygming.opt.urls | 30 --- > gcc/config/i386/i386-protos.h | 12 +- > gcc/config/i386/mingw-w64.opt.urls | 2 +- > gcc/config/lynx.opt.urls | 2 +- > gcc/config/{i386 => mingw}/cygming.opt | 0 > gcc/config/mingw/cygming.opt.urls | 30 +++ > gcc/config/{i386 => mingw}/cygwin-d.cc | 0 > gcc/config/{i386 => mingw}/mingw-stdint.h | 0 > gcc/config/{i386 => mingw}/mingw.opt | 0 > gcc/config/{i386 => mingw}/mingw.opt.urls | 2 +- > gcc/config/{i386 => mingw}/mingw32.h | 0 > gcc/config/{i386 => mingw}/msformat-c.cc | 0 > gcc/config/{i386 => mingw}/t-cygming | 23 ++- > gcc/config/{i386 => mingw}/winnt-cxx.cc | 0 > gcc/config/{i386 => mingw}/winnt-d.cc | 0 > gcc/config/{i386 => mingw}/winnt-stubs.cc | 0 > gcc/config/{i386 => mingw}/winnt.cc | 30 +-- > gcc/doc/invoke.texi | 12 +- > gcc/varasm.cc | 2 +- > libatomic/configure.tgt | 2 +- > libgcc/config.host | 23 ++- > libgcc/config/aarch64/t-no-eh | 2 + > libgcc/config/{i386 => mingw}/t-gthr-win32 | 0 > libgcc/config/{i386 => mingw}/t-mingw-pthread | 0 > 32 files changed, 450 insertions(+), 97 deletions(-) > create mode 100644 gcc/config/aarch64/aarch64-coff.h > create mode 100644 gcc/config/aarch64/cygming.h > delete mode 100644 gcc/config/i386/cygming.opt.urls > rename gcc/config/{i386 => mingw}/cygming.opt (100%) > create mode 100644 gcc/config/mingw/cygming.opt.urls > rename gcc/config/{i386 => mingw}/cygwin-d.cc (100%) > rename gcc/config/{i386 => mingw}/mingw-stdint.h (100%) > rename gcc/config/{i386 => mingw}/mingw.opt (100%) > rename gcc/config/{i386 => mingw}/mingw.opt.urls (86%) > rename gcc/config/{i386 => mingw}/mingw32.h (100%) > rename gcc/config/{i386 => mingw}/msformat-c.cc (100%) > rename gcc/config/{i386 => mingw}/t-cygming (73%) > rename gcc/config/{i386 => mingw}/winnt-cxx.cc (100%) > rename gcc/config/{i386 => mingw}/winnt-d.cc (100%) > rename gcc/config/{i386 => mingw}/winnt-stubs.cc (100%) > rename gcc/config/{i386 => mingw}/winnt.cc (97%) > create mode 100644 libgcc/config/aarch64/t-no-eh > rename libgcc/config/{i386 => mingw}/t-gthr-win32 (100%) > rename libgcc/config/{i386 => mingw}/t-mingw-pthread (100%) > > -- > 2.25.1 >
On 21/02/2024 17:47, Evgeny Karpov wrote: > Hello, > > We would like to take your attention to the review of changes for the > new GCC target, aarch64-w64-mingw32. The new target will be > supported, tested, added to CI, and maintained by Linaro. This marks > the first of three planned patch series contributing to the GCC C > compiler's support for Windows Arm64. > > 1. Minimal aarch64-w64-mingw32 C implementation to cross-compile > hello-world with libgcc for Windows Arm64 using MinGW. > 2. Extension of the aarch64-w64-mingw32 C implementation to > cross-compile OpenSSL, OpenBLAS, FFmpeg, and libjpeg-turbo. All > packages successfully pass tests. > 3. Addition of call stack support for debugging, resolution of > optimization issues in the C compiler, and DLL export/import for the > aarch64-w64-mingw32 target. > > This patch series introduces the 1st point, which involves building > hello-world for the aarch64-w64-mingw32 target. The patch depends on > the binutils changes for the aarch64-w64-mingw32 target that have > already been merged. > > The binutils should include recent relocation fixes. > f87eaf8ff3995a5888c6dc4996a20c770e6bcd36 > aarch64: Add new relocations and limit COFF AArch64 relocation offsets > > The series is structured in a way to trivially show that it should not > affect any other targets. > > In this patch, several changes have been made to support the > aarch64-w64-mingw32 target for GCC. The modifications include the > definition of the MS ABI for aarch64, adjustments to FIXED_REGISTERS > and STATIC_CHAIN_REGNUM for different ABIs, and specific definitions > for COFF format on AArch64. Additionally, the patch reuses MinGW > <stdint.h> types and definitions from i386, relocating them to a new > mingw folder for shared usage between both targets. > > MinGW-specific options have been introduced for AArch64, along with > override options for aarch64-w64-mingw32. Builtin stack probing for > override options for aarch64-w64-mingw32. Builtin stack probing for > AArch64 has been enabled as an alternative for chkstk. Symbol name > encoding and section information handling for aarch64-w64-mingw32 have > been incorporated, and the MinGW environment has been added, which > will also be utilized for defining the Cygwin environment in the > future. > > The patch includes renaming "x86 Windows Options" to "Cygwin and MinGW > Options," which now encompasses AArch64 as well. AArch64-specific > Cygwin and MinGW Options have been introduced for the unique > requirements of the AArch64 architecture. > > Function type declaration and named sections support have been added. > The necessary objects for Cygwin and MinGW have been built for the > aarch64-w64-mingw32 target, and relevant files such as msformat-c.cc > and winnt-d.cc have been moved to the mingw folder for reuse in > AArch64. > > Furthermore, the aarch64-w64-mingw32 target has been included in both > libatomic and libgcc, ensuring support for the AArch64 architecture > within these libraries. These changes collectively enhance the > capabilities of GCC for the specified target. > > Coauthors: Zac Walker <zacwalker@microsoft.com>, > Mark Harmstone <mark@harmstone.com> and > Ron Riddle <ron.riddle@microsoft.com> > > Refactored, prepared, and validated by > Radek Barton <radek.barton@microsoft.com> and > Evgeny Karpov <evgeny.karpov@microsoft.com> > > Special thanks to the Linaro GNU toolchain team for internal review > and assistance in preparing the patch series! > > Regards, > Evgeny Thanks for posting this. I've only read quickly through this patch series and responded where I think some action is obviously required. That doesn't necessarily mean the other patches are perfect, though, just that nothing immediately caught my attention. R. > > > Zac Walker (13): > Introduce aarch64-w64-mingw32 target > aarch64: The aarch64-w64-mingw32 target implements the MS ABI > aarch64: Mark x18 register as a fixed register for MS ABI > aarch64: Add aarch64-w64-mingw32 COFF > Reuse MinGW from i386 for AArch64 > Rename section and encoding functions from i386 which will be used in > aarch64 > Exclude i386 functionality from aarch64 build > aarch64: Add Cygwin and MinGW environments for AArch64 > aarch64: Add SEH to machine_function > Rename "x86 Windows Options" to "Cygwin and MinGW Options" > aarch64: Build and add objects for Cygwin and MinGW for AArch64 > aarch64: Add aarch64-w64-mingw32 target to libatomic > Add aarch64-w64-mingw32 target to libgcc > > fixincludes/mkfixinc.sh | 3 +- > gcc/config.gcc | 47 +++-- > gcc/config/aarch64/aarch64-coff.h | 92 +++++++++ > gcc/config/aarch64/aarch64-opts.h | 7 + > gcc/config/aarch64/aarch64-protos.h | 5 + > gcc/config/aarch64/aarch64.h | 25 ++- > gcc/config/aarch64/cygming.h | 178 ++++++++++++++++++ > gcc/config/i386/cygming.h | 18 +- > gcc/config/i386/cygming.opt.urls | 30 --- > gcc/config/i386/i386-protos.h | 12 +- > gcc/config/i386/mingw-w64.opt.urls | 2 +- > gcc/config/lynx.opt.urls | 2 +- > gcc/config/{i386 => mingw}/cygming.opt | 0 > gcc/config/mingw/cygming.opt.urls | 30 +++ > gcc/config/{i386 => mingw}/cygwin-d.cc | 0 > gcc/config/{i386 => mingw}/mingw-stdint.h | 0 > gcc/config/{i386 => mingw}/mingw.opt | 0 > gcc/config/{i386 => mingw}/mingw.opt.urls | 2 +- > gcc/config/{i386 => mingw}/mingw32.h | 0 > gcc/config/{i386 => mingw}/msformat-c.cc | 0 > gcc/config/{i386 => mingw}/t-cygming | 23 ++- > gcc/config/{i386 => mingw}/winnt-cxx.cc | 0 > gcc/config/{i386 => mingw}/winnt-d.cc | 0 > gcc/config/{i386 => mingw}/winnt-stubs.cc | 0 > gcc/config/{i386 => mingw}/winnt.cc | 30 +-- > gcc/doc/invoke.texi | 12 +- > gcc/varasm.cc | 2 +- > libatomic/configure.tgt | 2 +- > libgcc/config.host | 23 ++- > libgcc/config/aarch64/t-no-eh | 2 + > libgcc/config/{i386 => mingw}/t-gthr-win32 | 0 > libgcc/config/{i386 => mingw}/t-mingw-pthread | 0 > 32 files changed, 450 insertions(+), 97 deletions(-) > create mode 100644 gcc/config/aarch64/aarch64-coff.h > create mode 100644 gcc/config/aarch64/cygming.h > delete mode 100644 gcc/config/i386/cygming.opt.urls > rename gcc/config/{i386 => mingw}/cygming.opt (100%) > create mode 100644 gcc/config/mingw/cygming.opt.urls > rename gcc/config/{i386 => mingw}/cygwin-d.cc (100%) > rename gcc/config/{i386 => mingw}/mingw-stdint.h (100%) > rename gcc/config/{i386 => mingw}/mingw.opt (100%) > rename gcc/config/{i386 => mingw}/mingw.opt.urls (86%) > rename gcc/config/{i386 => mingw}/mingw32.h (100%) > rename gcc/config/{i386 => mingw}/msformat-c.cc (100%) > rename gcc/config/{i386 => mingw}/t-cygming (73%) > rename gcc/config/{i386 => mingw}/winnt-cxx.cc (100%) > rename gcc/config/{i386 => mingw}/winnt-d.cc (100%) > rename gcc/config/{i386 => mingw}/winnt-stubs.cc (100%) > rename gcc/config/{i386 => mingw}/winnt.cc (97%) > create mode 100644 libgcc/config/aarch64/t-no-eh > rename libgcc/config/{i386 => mingw}/t-gthr-win32 (100%) > rename libgcc/config/{i386 => mingw}/t-mingw-pthread (100%) >
Hi all, Seems to work for me! Nice work. It also works nicely with EFI as well, for anyone interested: test.c: #include <efi.h> EFI_STATUS efi_main(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE* SystemTable) { SystemTable->ConOut->OutputString(SystemTable->ConOut, L"hello, world\r\n"); return EFI_SUCCESS; } $ aarch64-w64-mingw32-gcc -I/usr/include/efi -nostartfiles -Wl,--subsystem,10 -eefi_main test.c -o test.efi Mark On 21/2/24 17:47, Evgeny Karpov wrote: > Hello, > > We would like to take your attention to the review of changes for the > new GCC target, aarch64-w64-mingw32. The new target will be > supported, tested, added to CI, and maintained by Linaro. This marks > the first of three planned patch series contributing to the GCC C > compiler's support for Windows Arm64. > > 1. Minimal aarch64-w64-mingw32 C implementation to cross-compile > hello-world with libgcc for Windows Arm64 using MinGW. > 2. Extension of the aarch64-w64-mingw32 C implementation to > cross-compile OpenSSL, OpenBLAS, FFmpeg, and libjpeg-turbo. All > packages successfully pass tests. > 3. Addition of call stack support for debugging, resolution of > optimization issues in the C compiler, and DLL export/import for the > aarch64-w64-mingw32 target. > > This patch series introduces the 1st point, which involves building > hello-world for the aarch64-w64-mingw32 target. The patch depends on > the binutils changes for the aarch64-w64-mingw32 target that have > already been merged. > > The binutils should include recent relocation fixes. > f87eaf8ff3995a5888c6dc4996a20c770e6bcd36 > aarch64: Add new relocations and limit COFF AArch64 relocation offsets > > The series is structured in a way to trivially show that it should not > affect any other targets. > > In this patch, several changes have been made to support the > aarch64-w64-mingw32 target for GCC. The modifications include the > definition of the MS ABI for aarch64, adjustments to FIXED_REGISTERS > and STATIC_CHAIN_REGNUM for different ABIs, and specific definitions > for COFF format on AArch64. Additionally, the patch reuses MinGW > <stdint.h> types and definitions from i386, relocating them to a new > mingw folder for shared usage between both targets. > > MinGW-specific options have been introduced for AArch64, along with > override options for aarch64-w64-mingw32. Builtin stack probing for > override options for aarch64-w64-mingw32. Builtin stack probing for > AArch64 has been enabled as an alternative for chkstk. Symbol name > encoding and section information handling for aarch64-w64-mingw32 have > been incorporated, and the MinGW environment has been added, which > will also be utilized for defining the Cygwin environment in the > future. > > The patch includes renaming "x86 Windows Options" to "Cygwin and MinGW > Options," which now encompasses AArch64 as well. AArch64-specific > Cygwin and MinGW Options have been introduced for the unique > requirements of the AArch64 architecture. > > Function type declaration and named sections support have been added. > The necessary objects for Cygwin and MinGW have been built for the > aarch64-w64-mingw32 target, and relevant files such as msformat-c.cc > and winnt-d.cc have been moved to the mingw folder for reuse in > AArch64. > > Furthermore, the aarch64-w64-mingw32 target has been included in both > libatomic and libgcc, ensuring support for the AArch64 architecture > within these libraries. These changes collectively enhance the > capabilities of GCC for the specified target. > > Coauthors: Zac Walker <zacwalker@microsoft.com>, > Mark Harmstone <mark@harmstone.com> and > Ron Riddle <ron.riddle@microsoft.com> > > Refactored, prepared, and validated by > Radek Barton <radek.barton@microsoft.com> and > Evgeny Karpov <evgeny.karpov@microsoft.com> > > Special thanks to the Linaro GNU toolchain team for internal review > and assistance in preparing the patch series! > > Regards, > Evgeny > > > Zac Walker (13): > Introduce aarch64-w64-mingw32 target > aarch64: The aarch64-w64-mingw32 target implements the MS ABI > aarch64: Mark x18 register as a fixed register for MS ABI > aarch64: Add aarch64-w64-mingw32 COFF > Reuse MinGW from i386 for AArch64 > Rename section and encoding functions from i386 which will be used in > aarch64 > Exclude i386 functionality from aarch64 build > aarch64: Add Cygwin and MinGW environments for AArch64 > aarch64: Add SEH to machine_function > Rename "x86 Windows Options" to "Cygwin and MinGW Options" > aarch64: Build and add objects for Cygwin and MinGW for AArch64 > aarch64: Add aarch64-w64-mingw32 target to libatomic > Add aarch64-w64-mingw32 target to libgcc > > fixincludes/mkfixinc.sh | 3 +- > gcc/config.gcc | 47 +++-- > gcc/config/aarch64/aarch64-coff.h | 92 +++++++++ > gcc/config/aarch64/aarch64-opts.h | 7 + > gcc/config/aarch64/aarch64-protos.h | 5 + > gcc/config/aarch64/aarch64.h | 25 ++- > gcc/config/aarch64/cygming.h | 178 ++++++++++++++++++ > gcc/config/i386/cygming.h | 18 +- > gcc/config/i386/cygming.opt.urls | 30 --- > gcc/config/i386/i386-protos.h | 12 +- > gcc/config/i386/mingw-w64.opt.urls | 2 +- > gcc/config/lynx.opt.urls | 2 +- > gcc/config/{i386 => mingw}/cygming.opt | 0 > gcc/config/mingw/cygming.opt.urls | 30 +++ > gcc/config/{i386 => mingw}/cygwin-d.cc | 0 > gcc/config/{i386 => mingw}/mingw-stdint.h | 0 > gcc/config/{i386 => mingw}/mingw.opt | 0 > gcc/config/{i386 => mingw}/mingw.opt.urls | 2 +- > gcc/config/{i386 => mingw}/mingw32.h | 0 > gcc/config/{i386 => mingw}/msformat-c.cc | 0 > gcc/config/{i386 => mingw}/t-cygming | 23 ++- > gcc/config/{i386 => mingw}/winnt-cxx.cc | 0 > gcc/config/{i386 => mingw}/winnt-d.cc | 0 > gcc/config/{i386 => mingw}/winnt-stubs.cc | 0 > gcc/config/{i386 => mingw}/winnt.cc | 30 +-- > gcc/doc/invoke.texi | 12 +- > gcc/varasm.cc | 2 +- > libatomic/configure.tgt | 2 +- > libgcc/config.host | 23 ++- > libgcc/config/aarch64/t-no-eh | 2 + > libgcc/config/{i386 => mingw}/t-gthr-win32 | 0 > libgcc/config/{i386 => mingw}/t-mingw-pthread | 0 > 32 files changed, 450 insertions(+), 97 deletions(-) > create mode 100644 gcc/config/aarch64/aarch64-coff.h > create mode 100644 gcc/config/aarch64/cygming.h > delete mode 100644 gcc/config/i386/cygming.opt.urls > rename gcc/config/{i386 => mingw}/cygming.opt (100%) > create mode 100644 gcc/config/mingw/cygming.opt.urls > rename gcc/config/{i386 => mingw}/cygwin-d.cc (100%) > rename gcc/config/{i386 => mingw}/mingw-stdint.h (100%) > rename gcc/config/{i386 => mingw}/mingw.opt (100%) > rename gcc/config/{i386 => mingw}/mingw.opt.urls (86%) > rename gcc/config/{i386 => mingw}/mingw32.h (100%) > rename gcc/config/{i386 => mingw}/msformat-c.cc (100%) > rename gcc/config/{i386 => mingw}/t-cygming (73%) > rename gcc/config/{i386 => mingw}/winnt-cxx.cc (100%) > rename gcc/config/{i386 => mingw}/winnt-d.cc (100%) > rename gcc/config/{i386 => mingw}/winnt-stubs.cc (100%) > rename gcc/config/{i386 => mingw}/winnt.cc (97%) > create mode 100644 libgcc/config/aarch64/t-no-eh > rename libgcc/config/{i386 => mingw}/t-gthr-win32 (100%) > rename libgcc/config/{i386 => mingw}/t-mingw-pthread (100%) >
Hi Maxim, Thank you for the review and the test build! Regards, Evgeny -----Original Message----- Wednesday, February 21, 2024 7:27 PM Maxim Kuvyrkov wrote: Hi Evgeny, Great job! For reference, here is a test build of this patch series using Linaro Toolchain CI: https://ci.linaro.org/view/tcwg-build/job/tcwg_gnu_mingw_build--master-woa64-build/9/artifact/artifacts/ -- Maxim Kuvyrkov
Hi Mark, Thanks for testing the patch series! It is great to know that EFI also works well. Thank you for your contribution to this work! Regards, Evgeny -----Original Message----- Thursday, February 22, 2024 7:11 PM Mark Harmstone wrote: Hi all, Seems to work for me! Nice work. It also works nicely with EFI as well, for anyone interested: test.c: #include <efi.h> EFI_STATUS efi_main(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE* SystemTable) { SystemTable->ConOut->OutputString(SystemTable->ConOut, L"hello, world\r\n"); return EFI_SUCCESS; } $ aarch64-w64-mingw32-gcc -I/usr/include/efi -nostartfiles -Wl,--subsystem,10 -eefi_main test.c -o test.efi Mark
"Richard Earnshaw (lists)" <Richard.Earnshaw@arm.com> writes: > On 21/02/2024 17:47, Evgeny Karpov wrote: >> Hello, >> >> We would like to take your attention to the review of changes for the >> new GCC target, aarch64-w64-mingw32. The new target will be >> supported, tested, added to CI, and maintained by Linaro. This marks >> the first of three planned patch series contributing to the GCC C >> compiler's support for Windows Arm64. >> >> 1. Minimal aarch64-w64-mingw32 C implementation to cross-compile >> hello-world with libgcc for Windows Arm64 using MinGW. >> 2. Extension of the aarch64-w64-mingw32 C implementation to >> cross-compile OpenSSL, OpenBLAS, FFmpeg, and libjpeg-turbo. All >> packages successfully pass tests. >> 3. Addition of call stack support for debugging, resolution of >> optimization issues in the C compiler, and DLL export/import for the >> aarch64-w64-mingw32 target. >> >> This patch series introduces the 1st point, which involves building >> hello-world for the aarch64-w64-mingw32 target. The patch depends on >> the binutils changes for the aarch64-w64-mingw32 target that have >> already been merged. >> >> The binutils should include recent relocation fixes. >> f87eaf8ff3995a5888c6dc4996a20c770e6bcd36 >> aarch64: Add new relocations and limit COFF AArch64 relocation offsets >> >> The series is structured in a way to trivially show that it should not >> affect any other targets. >> >> In this patch, several changes have been made to support the >> aarch64-w64-mingw32 target for GCC. The modifications include the >> definition of the MS ABI for aarch64, adjustments to FIXED_REGISTERS >> and STATIC_CHAIN_REGNUM for different ABIs, and specific definitions >> for COFF format on AArch64. Additionally, the patch reuses MinGW >> <stdint.h> types and definitions from i386, relocating them to a new >> mingw folder for shared usage between both targets. >> >> MinGW-specific options have been introduced for AArch64, along with >> override options for aarch64-w64-mingw32. Builtin stack probing for >> override options for aarch64-w64-mingw32. Builtin stack probing for >> AArch64 has been enabled as an alternative for chkstk. Symbol name >> encoding and section information handling for aarch64-w64-mingw32 have >> been incorporated, and the MinGW environment has been added, which >> will also be utilized for defining the Cygwin environment in the >> future. >> >> The patch includes renaming "x86 Windows Options" to "Cygwin and MinGW >> Options," which now encompasses AArch64 as well. AArch64-specific >> Cygwin and MinGW Options have been introduced for the unique >> requirements of the AArch64 architecture. >> >> Function type declaration and named sections support have been added. >> The necessary objects for Cygwin and MinGW have been built for the >> aarch64-w64-mingw32 target, and relevant files such as msformat-c.cc >> and winnt-d.cc have been moved to the mingw folder for reuse in >> AArch64. >> >> Furthermore, the aarch64-w64-mingw32 target has been included in both >> libatomic and libgcc, ensuring support for the AArch64 architecture >> within these libraries. These changes collectively enhance the >> capabilities of GCC for the specified target. >> >> Coauthors: Zac Walker <zacwalker@microsoft.com>, >> Mark Harmstone <mark@harmstone.com> and >> Ron Riddle <ron.riddle@microsoft.com> >> >> Refactored, prepared, and validated by >> Radek Barton <radek.barton@microsoft.com> and >> Evgeny Karpov <evgeny.karpov@microsoft.com> >> >> Special thanks to the Linaro GNU toolchain team for internal review >> and assistance in preparing the patch series! >> >> Regards, >> Evgeny > > Thanks for posting this. Seconded. :) Thanks also for the very clear organisation of the series, and for commonising code rather than cut-&-pasting it. FWIW, I agree with all the comments posted so far, and just sent some other comments too. I think my main high-level comments are: - Could you double-check that all the code in the common files are used on both aarch64 and x86? I think it's OK to move code outside of x86 even if aarch64 doesn't want to use it, provided that it makes conceptual target-independent sense. But it's not clear whether unused code is deliberate or not (e.g. the EXTRA_OS_CPP_BUILTINS thing I mentioned in the part 2 review). - Could you test with all languages enabled, and say what languages are supported? Some languages require an existing compiler for the same language and so are more difficult to bootstrap for a new port. I suppose you'd need a cross-host build first, then use the cross-compiled compilers to bootstrap. Thanks, Richard
On Wed, Feb 21, 2024 at 12:48 PM Evgeny Karpov <Evgeny.Karpov@microsoft.com> wrote: > > Hello, > > We would like to take your attention to the review of changes for the > new GCC target, aarch64-w64-mingw32. The new target will be > supported, tested, added to CI, and maintained by Linaro. This marks > the first of three planned patch series contributing to the GCC C > compiler's support for Windows Arm64. > > 1. Minimal aarch64-w64-mingw32 C implementation to cross-compile > hello-world with libgcc for Windows Arm64 using MinGW. > 2. Extension of the aarch64-w64-mingw32 C implementation to > cross-compile OpenSSL, OpenBLAS, FFmpeg, and libjpeg-turbo. All > packages successfully pass tests. > 3. Addition of call stack support for debugging, resolution of > optimization issues in the C compiler, and DLL export/import for the > aarch64-w64-mingw32 target. > > This patch series introduces the 1st point, which involves building > hello-world for the aarch64-w64-mingw32 target. The patch depends on > the binutils changes for the aarch64-w64-mingw32 target that have > already been merged. > > The binutils should include recent relocation fixes. > f87eaf8ff3995a5888c6dc4996a20c770e6bcd36 > aarch64: Add new relocations and limit COFF AArch64 relocation offsets > > The series is structured in a way to trivially show that it should not > affect any other targets. To be clear, because of the refactoring, it will affect x86/x64 Windows targets. Can you do a testsuite run before and after and see that it doesn't get worse? The full testsuite for all languages for Windows isn't in great shape, but it's not awful. Some languages, like Rust and Fortran, have ~10 FAILs. C and C++ have several thousand. In particular, there are quite a few testsuite test FAILs regarding MS ABI that hopefully do not get worse. Lastly, I don't think I see in the current patch series where you add new testsuite coverage for aarch64-specific bits. I probably missed it, so feel free to helpfully correct me there :) I'd be curious to see how the tests were written to take into account target differences (using for example the dejagnu feature procs) and other nuances.
Richard, thank you for the initial review! Hopefully, the required actions have been addressed, which should improve the patch quality in v2. Regards, Evgeny -----Original Message----- Thursday, February 22, 2024 2:40 PM Richard Earnshaw (lists) wrote: Thanks for posting this. I've only read quickly through this patch series and responded where I think some action is obviously required. That doesn't necessarily mean the other patches are perfect, though, just that nothing immediately caught my attention. R.
Friday, February 23, 2024 7:00 PM Richard Sandiford wrote: > Seconded. :) Thanks also for the very clear organisation of the series, and for > commonising code rather than cut-&-pasting it. Thank you, Richard, for the valuable feedback. It is great to hear that the series structure is easy to review. That work has been done before submitting v1. > FWIW, I agree with all the comments posted so far, and just sent some other > comments too. I think my main high-level comments are: > > - Could you double-check that all the code in the common files are > used on both aarch64 and x86? I think it's OK to move code outside > of x86 even if aarch64 doesn't want to use it, provided that it makes > conceptual target-independent sense. But it's not clear whether > unused code is deliberate or not (e.g. the EXTRA_OS_CPP_BUILTINS > thing I mentioned in the part 2 review). All files from the mingw folder are used by the aarch64 target. Some of them are used partially as mingw.cc. As mentioned in the cover letter, the current contribution covers only the C scope. EXTRA_OS_CPP_BUILTINS is one example which is not used. > - Could you test with all languages enabled, and say what languages > are supported? Some languages require an existing compiler for > the same language and so are more difficult to bootstrap for > a new port. I suppose you'd need a cross-host build first, > then use the cross-compiled compilers to bootstrap. > > Thanks, > Richard Our CI for the current contribution uses and tests only the C language for the aarch64-w64-mingw32 target. Regards, Evgeny
Monday, February 26, 2024 2:30 AM NightStrike wrote: > To be clear, because of the refactoring, it will affect x86/x64 Windows targets. > Can you do a testsuite run before and after and see that it doesn't get worse? > The full testsuite for all languages for Windows isn't in great shape, but it's not > awful. Some languages, like Rust and Fortran, have ~10 FAILs. C and C++ have > several thousand. > > In particular, there are quite a few testsuite test FAILs regarding MS ABI that > hopefully do not get worse. > Thank you for bringing it up! Our CI will be extended to test the x64 mingw target and calculate a delta, starting from patch series v2. > Lastly, I don't think I see in the current patch series where you add new > testsuite coverage for aarch64-specific bits. I probably missed it, so feel free to > helpfully correct me there :) I'd be curious to see how the tests were written to > take into account target differences (using for example the dejagnu feature > procs) and other nuances. Tests have not been added yet. This does not mean they do not exist or are not used. They are implemented and used in our CI, and will be contributed to the aarch64-w64-mingw32 target in the next patch series. https://github.com/Windows-on-ARM-Experiments/mingw-woarm64-build/tree/main/tests Regards, Evgeny
On Thu, Feb 29, 2024 at 11:26 AM Evgeny Karpov <Evgeny.Karpov@microsoft.com> wrote: > > Monday, February 26, 2024 2:30 AM > NightStrike wrote: > > > To be clear, because of the refactoring, it will affect x86/x64 Windows targets. > > Can you do a testsuite run before and after and see that it doesn't get worse? > > The full testsuite for all languages for Windows isn't in great shape, but it's not > > awful. Some languages, like Rust and Fortran, have ~10 FAILs. C and C++ have > > several thousand. > > > > In particular, there are quite a few testsuite test FAILs regarding MS ABI that > > hopefully do not get worse. > > > > Thank you for bringing it up! Our CI will be extended to test the x64 > mingw target and calculate a delta, starting from patch series v2. Thanks. You should probably include x86 also, at least for all the areas that overlap. I would like to compare my own test results with yours when you have that ready. You can send test results to the gcc mailing list setup for this purpose: https://gcc.gnu.org/mailman/listinfo/gcc-testresults, and there are scripts in contrib/ to help automate the process. I personally stopped, because the clusters I used had their mail sending capabilities cut off, but I'm working on fixing that. > > Lastly, I don't think I see in the current patch series where you add new > > testsuite coverage for aarch64-specific bits. I probably missed it, so feel free to > > helpfully correct me there :) I'd be curious to see how the tests were written to > > take into account target differences (using for example the dejagnu feature > > procs) and other nuances. > > Tests have not been added yet. This does not mean they do not exist > or are not used. They are implemented and used in our CI, and will be > contributed to the aarch64-w64-mingw32 target in the next patch > series. > https://github.com/Windows-on-ARM-Experiments/mingw-woarm64-build/tree/main/tests Awesome! These tests look like they are handled by your own custom test harness, so hopefully it won't be too difficult to convert it all to dejagnu. Honestly, the sooner you do that, the better, because the task is going to balloon. You'll find that Deja offers all kinds of neat and useful features that allow you to test all kinds of things, so it'll result in better coverage in the end.
Thank you for the initial review for v1! Work on refactoring, rebasing, and validating "[PATCH v2] Add aarch64-w64-mingw32 target" is in progress. The v2 x64 mingw target will also be fully tested to avoid regression due to refactoring. Please provide feedback if anything is missing. Changes from v1 to v2: Adjust the target name to aarch64-*-mingw* to exclude the big-endian target from support. Exclude 64-bit ISA. Rename enum calling_abi to aarch64_calling_abi. Move AARCH64 MS ABI definitions FIXED_REGISTERS, CALL_REALLY_USED_REGISTERS, and STATIC_CHAIN_REGNUM from aarch64.h to aarch64-abi-ms.h. Rename TARGET_ARM64_MS_ABI to TARGET_AARCH64_MS_ABI. Exclude TARGET_64BIT from the aarch64 target. Exclude HAVE_GAS_WEAK. Set HAVE_GAS_ALIGNED_COMM to 1 by default. Use a reference from "x86 Windows Options" to "Cygwin and MinGW Options". Update commit descriptions to follow standard style. Regards, Evgeny