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 <zacwal...@microsoft.com>,
Mark Harmstone <m...@harmstone.com>  and
Ron Riddle <ron.rid...@microsoft.com>

Refactored, prepared, and validated by 
Radek Barton <radek.bar...@microsoft.com> and 
Evgeny Karpov <evgeny.kar...@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

Reply via email to