Message ID | VI1PR83MB04314E947B1CF296708085DDF8572@VI1PR83MB0431.EURPRD83.prod.outlook.com |
---|---|
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5D8E13858418 for <patchwork@sourceware.org>; Wed, 21 Feb 2024 17:48:06 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2118.outbound.protection.outlook.com [40.107.7.118]) by sourceware.org (Postfix) with ESMTPS id E1EB53858418 for <gcc-patches@gcc.gnu.org>; Wed, 21 Feb 2024 17:47:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E1EB53858418 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=microsoft.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=microsoft.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E1EB53858418 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.7.118 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1708537652; cv=pass; b=WulCR5JPJvkgCb/WvyrcewEMLLL5A+C/R0kaSl5fLAyJkLtO2XcZoaxHJxAPu2h7Ui6ZHt+8H2cfLJxsFp4KkpAwKHbR2jj0XZiAcFLhFXE65Wp4O53rlIaQTGEBCcK1fyaPGw5mgrOoCJayv05XD+KGGK9IlXXYnxtU3nLIZBQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1708537652; c=relaxed/simple; bh=J//1fjLxodJ3K7ldnifsnB1AGpSZhOqgJA8USvmFW0k=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Gu0JYNGLmUvKOmjqGJxjqx2kLM0f6CX9PjXLb3CKM6evTPp5SjC3h/bVhnwEb/EmgoikkRSQPCztGkwmlR95TRZ1UHYUqGVpGqio6yuF0gkNbOrnEl6zZFwF/hZzOIHuhymTxm0jbgm94G29o6kawn/z5pmnABGFNcUy68T95Uk= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=njbksIafyHvMX4ty9JG4+1+L78YZBis8rcJRa0/6egrjiT++BW09/HC3yRkN5hNCNujo+YXW2IbvqG+ebspfRDndcJ8tcgx0HDh34u+bfGVBi0uk2X8Yfhmnsgkgxr9NAEXQN1CldPTllqwv9t6BFw2F9VCcS49ON7/DugIULx/ol+gf7ioPDJfilPHDJN0W8hg0vLYswS9HxlQwiuHCM1WG67qiFfWicCCCcWvFiadfimbi8PwfazBjtwL2bBcSb2IWnTaZTltU9vMjpMS0gmjTz7QxqmtTtU97f48Fi3djyfBzx+QHx/Jbz0bAePuXMXGQFfDFjxrDL8foGI9A1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tfREitcxcr7FOFTlB4wi2W2uCmNmmbiirfNWzn0u/CU=; b=Bwt0ckkI0hAooZ1Xkof9AGlH/vWj5NL72OPOu+Qk/3Pu62rpcDquCFpJyqWGSUL+POzggMF4zq9nuXWY0D0pwwGvEnXUb427aflOFh32OghuvKWENdNTTg7mqXxV2mnI3ijjA8djxb/NNrJZf4PnOOErlJkg9IOH8Xu7ypj0+sfJTkX9G56GXKksNpUxDvuK0ygJlC5fUnyIp0vuCO17m3aOmduwQ+SD7EbtPd0512xpxIjfJMjSGVAWiGwMI5TuK6PuKvWDNqnyQ/MdTtAmltV7HFxn5lmPuULdLQwLrtsI5n41TCPsEnJVgODoaEAs1iLh06yfDbFKFbasy7CLbA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tfREitcxcr7FOFTlB4wi2W2uCmNmmbiirfNWzn0u/CU=; b=el0HHnh9ywjYE/RmxkDDKD+gM8V13DaQnu3KqdKOgGu41aa9ZEeoFNcnTNLhyvLgmVOqHOeLTYCkm91tYngtSyZTjL52g6qs1jTjDOWJolkpH7dQC9+8twYTnYbAi2IFhCB4Hlh6FeHZR6HaAShVz5c+CA36mCYA2vMf8jA7aq4= Received: from VI1PR83MB0431.EURPRD83.prod.outlook.com (2603:10a6:800:17f::6) by GV1PR83MB0619.EURPRD83.prod.outlook.com (2603:10a6:150:164::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.8; Wed, 21 Feb 2024 17:47:26 +0000 Received: from VI1PR83MB0431.EURPRD83.prod.outlook.com ([fe80::7279:eea0:8540:a0f5]) by VI1PR83MB0431.EURPRD83.prod.outlook.com ([fe80::7279:eea0:8540:a0f5%7]) with mapi id 15.20.7339.007; Wed, 21 Feb 2024 17:47:26 +0000 From: Evgeny Karpov <Evgeny.Karpov@microsoft.com> To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org> CC: "richard.sandiford@arm.com" <richard.sandiford@arm.com>, "10walls@gmail.com" <10walls@gmail.com>, Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org>, "mark@harmstone.com" <mark@harmstone.com>, Zac Walker <zacwalker@microsoft.com>, Ron Riddle <Ron.Riddle@microsoft.com>, Radek Barton <radek.barton@microsoft.com> Subject: [PATCH v1 00/13] Add aarch64-w64-mingw32 target Thread-Topic: [PATCH v1 00/13] Add aarch64-w64-mingw32 target Thread-Index: Adpk6aoQbbytWq7qQVWIQFWuvVNZog== Date: Wed, 21 Feb 2024 17:47:25 +0000 Message-ID: <VI1PR83MB04314E947B1CF296708085DDF8572@VI1PR83MB0431.EURPRD83.prod.outlook.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=57576bd1-751e-4189-ac11-c600ca5b612b; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2024-02-21T17:14:30Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: VI1PR83MB0431:EE_|GV1PR83MB0619:EE_ x-ms-office365-filtering-correlation-id: 3ffccaad-8085-4b21-788b-08dc33052a60 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 9W4r2NaFYyVQ+i8bfA49wt9+znGR29vRdD4LRw04py8sCp/XcvNWfrOODuROq1BRRaALkWaPUm6X3FgbqAemHcdWWzfrT4Iot7GpF4OesAuuMTHCpV/bAgPy8/aaU9XEz3wnaK98xF73yourSePd1MbHj4H4etanxn+XMPKvfW60JpApxVBQv374aIkHZU14WI6tOZJiUSHhUlDc/nDVnQ5F8mwg3HkUscAc/ErJaCOZ5UPbGg+4F6Q7MmydKWXuuiucZczr6YOXfvOYOy6s1qMNEWGqCKip3cO5zuQX3iwRe57umXAaGUlrmd+tHI6mevzqrRnZoIlP2f2vxZeoNo8DM9Sj1sWwSfc++GTrtK63n1JktoR4hQFLl7qO+h5/yryosZoqn0A6Kg9gtHrT4WkB6tmlsIA8XKL35snTDilWtdB/ZAmjAr3Fo6gFbthrDORhytbDwEmd4qDyaAaCDUigskRhbR0HaHshNcc0usnG02qR9eZwUIHzAsBElQlY5zz2uAl/rXO77XY0Q1/T64qd61XzdJE8MUUFrF5KSt5F4fLFVf8zQK0MCoP+zRgRi22hMih60DxVkyAcSqrS+U5PHQISANWvpLyn0ehvd/yXdsvPi+Se+oL0fs6sa2PS x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR83MB0431.EURPRD83.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(38070700009); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: qBezxBKj0LyC2AT2pvBPLmeWsK9C+eARzlBK6MknOgtAeqtXSYv4YjJqWdxU1az6PzWJ1BW75wuFdCliWah+evbiXeUDNp7sSZJ2nnrpkseruHUuS6vSZM2q5udtJ88cVKbWWBz0wm2QL47iI+ZM27KHugjNL9/2EuqARo2wzz1ulhXBoEMEEgiTtUZBaaR8QofOkirAKY+h3Cl0g5/cLlXSuu20EY1I8dJ1g98FowUgw+zI9k1rhHfCeJDDrGHUN8+zL0+iWZ+Lu5almmvM8tYblboWF+8+fJSgzQhR7k0iuvpRZvkGqpvhJu2XCDpMg03r2In2K1QsG89Q7MAJF9Ujjp67y9s7IpOcww21BQXNsgeGSvvIRuqfQXXAZ5X8yiC+xsm+BphXSATmfOmFyJaFKrX+Jvp8idu7J89QOCgEfFxUMZMfp8k+7Y9zazfN+v88+MoT25OAMnXpN4yjEWqtTTwUqzmiWw/0VP05DRuZCxHmvxnoQok3iBPGSYOUdl4dlc4KTNvWNPAsZTQpc1hhzlBlC4zUHFR1NKJQPHQ1ow2ONFisDr1sX5urNtnFVOKFt+Kh/seWeWohj5si76A9rhv93MKyhDyfM9MLGUdNDfqwGtrNZECXwGdWluLz9nfBcKVyG1r/nnOOhjwtQKIEMBgHxwmPOWnTaRNKKqFcBrR43E+MVvzIARB+oEWtomA8MpHbtzdYqJC7NIUS6MQJyWiOl6TMU8L64n6p1BsXR0uihtl4yCC5xUMEjTD/iwPHr+YpOsaGn+2IbXkyLQ6HtHl0Qtm8rDlVJK3mL0Mb9+7gAYSvMBkDjVZDUN0t5tgTKbv+4yfqEil0H8VAlKsFprbEW3e3e8BaBtrnOkg8UYJ+E2hepZqkp4gP2JC58tPzaYaDWICiAyDZbcV8GiI58012utvAkWVOKOtS/pQJgJ6Q8qHZ4BL4GDB8d7KWpWwem8hf3NVpRuPRRqCPaigZpu0wkOQ2giiNxl6LJdc0xCSaSoYZrSu7/qh/R4thpcyCrPRRruRiVTt7oYIaFyM8TvFQtlF6Gl1bOhmiWmybFqadP5x7PZoHlDhyUkQ0QCKH8JDUo5pXOX8BjzMtt7/5jgzkUfqDqdASiaNh8bUoYnnb1RxedX0GlbRUwAKqfF6EaIzN63FMNhqYDz8Dm2deH6kXYWTXpKg2GhJuEZEF5KyN6D7L/MQt76BEoLsjFhdSilbU53uqUqTLffLkn9+gxdzupAUrBz5Ml3wGO/eYWYeI3Oy9Cht51X26Qpp1Axul9GPz7y2wilpz99DJSNjqfw5BE7l9kMXX/juLk72y/S0dC1o3ckj//xQlRVQe2SueQCCAI/jXFCPoyLSSXMD5DLxf8z2NDffXwxr1ftAA68mH3x0/obZ6SQwbjY50BPVCQqwDN7Xd1pr3f83ESA4+EFz61N+Wu7g0FGGqabaMcoc2auzP8j9C8HnyzPForTtKCpLFXUFnPrwQwvLyuNtu1gJHH95Yf6viNhyDwFJelPSWRaCphAL/fCUBZVxf2VENRvs1aCVTIpZDEXvm/upADiXKhQSn1P4dlVL7A2yfgmirE2egNp4hY/sv93j9 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: VI1PR83MB0431.EURPRD83.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3ffccaad-8085-4b21-788b-08dc33052a60 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Feb 2024 17:47:25.8124 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: zixJeGGEPLRo8mfcQdDxJlEZrwYAmPDxAabSAHuQqMguXQjUhLyybREqflpSQcOlBF+HWZS9XlafI/Hd/uRwvQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR83MB0619 X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org |
Series |
Add aarch64-w64-mingw32 target
|
|
Message
Evgeny Karpov
Feb. 21, 2024, 5:47 p.m. UTC
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%)
Comments
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