From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id A2D5A3858D1E for ; Fri, 23 Feb 2024 18:00:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A2D5A3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A2D5A3858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708711216; cv=none; b=agaLr2TkpdbXwTOv5CEWUJughAEWCafjYUWogIdfBDopkQ+Tbk7GlZln4w5W6C6MqUnKQpmM+0q8U3F82vFgOhe6DCYBRBVc7bbpRMlRh7LE68ggjZiKWZY4Zb10Te7fI9v09B1GQC1p7Zdol3J40PQJJCiL8UG4n+yg4O+jqY4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708711216; c=relaxed/simple; bh=Xrg4jpU69iBylUpROIpNH4ezEMQn+KY2Xjr6nZv8izc=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=d1AuGal0nQO/q15WN9SaYgXkc+ZkzII8Utq0RKg3cgVSVX54x5wWn3ZG+3zRWGfvzYro+DOOqWUYIrleWhIPPczGCUWF/DCQuCVOrPf4RMYhG166PdMiHV6o/oBOdbnlgXnaAlbNkN5MH6tE52DmMDyDNxKwPaTCS3kOmfUqRG0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0B4DDDA7; Fri, 23 Feb 2024 10:00:53 -0800 (PST) Received: from localhost (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 172423F762; Fri, 23 Feb 2024 10:00:12 -0800 (PST) From: Richard Sandiford To: "Richard Earnshaw \(lists\)" Mail-Followup-To: "Richard Earnshaw \(lists\)" ,Evgeny Karpov , "gcc-patches\@gcc.gnu.org" , "10walls\@gmail.com" <10walls@gmail.com>, Maxim Kuvyrkov , "mark\@harmstone.com" , Zac Walker , Ron Riddle , Radek Barton , richard.sandiford@arm.com Cc: Evgeny Karpov , "gcc-patches\@gcc.gnu.org" , "10walls\@gmail.com" <10walls@gmail.com>, Maxim Kuvyrkov , "mark\@harmstone.com" , Zac Walker , Ron Riddle , Radek Barton Subject: Re: [PATCH v1 00/13] Add aarch64-w64-mingw32 target References: Date: Fri, 23 Feb 2024 18:00:11 +0000 In-Reply-To: (Richard Earnshaw's message of "Thu, 22 Feb 2024 13:39:30 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-14.8 required=5.0 tests=BAYES_00,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_NONE,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 List-Id: "Richard Earnshaw (lists)" 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 >> 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 , >> Mark Harmstone and >> Ron Riddle >> >> Refactored, prepared, and validated by >> Radek Barton and >> Evgeny Karpov >> >> 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