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 3E75E38A90BE for ; Wed, 10 Apr 2024 18:31:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3E75E38A90BE 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 3E75E38A90BE 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=1712773880; cv=none; b=Oq5k+58vdPOm17R9g07y6wfTBeRXqL4y+HxnmkQhw2wpq/m9ED5Y2MIe1jiM7fpTSkPhEIjmmubXpOpuF/C1dkEJ/1fmL3BskKulyhkXzKhVwfcPKn0jqAyqejSGRHhkMJEdSYtdm0fSyGQmrruHHn5vBatqVe9OIzMlPWyjHQQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712773880; c=relaxed/simple; bh=8XofJo0VLVXl5ZfFmW5ZlYQngLxNSj2JY0sRUe8mvmg=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=GyXUuW0G6cLFaJtk/33pxj7MUByBijTGoZqD6/Jk2Y+1t7qFhNxZCjGHVBQl2wCdozzAVGVp9GLlSP+bmmfQeAB6sZ1r70ab3/SggMlFZj9w/r2l9AjMFRUNWi5hRCLpGFvqe+PsH2PX2fgQBK7qH11SA78FSomsm8jSIdUPPlw= 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 6F319139F; Wed, 10 Apr 2024 11:31:38 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BED2B3F6C4; Wed, 10 Apr 2024 11:31:07 -0700 (PDT) From: Richard Sandiford To: Evgeny Karpov Mail-Followup-To: Evgeny Karpov ,"gcc-patches\@gcc.gnu.org" , "Richard Earnshaw \(lists\)" , "Andrew Pinski \(QUIC\)" , Maxim Kuvyrkov , Radek Barton , richard.sandiford@arm.com Cc: "gcc-patches\@gcc.gnu.org" , "Richard Earnshaw \(lists\)" , "Andrew Pinski \(QUIC\)" , Maxim Kuvyrkov , Radek Barton Subject: Re: [PATCH v2 04/13] aarch64: Add aarch64-w64-mingw32 COFF References: Date: Wed, 10 Apr 2024 19:31:06 +0100 In-Reply-To: (Evgeny Karpov's message of "Mon, 4 Mar 2024 17:39:08 +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=-20.6 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,KAM_SHORT,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Evgeny Karpov writes: > From: Zac Walker > Date: Fri, 1 Mar 2024 01:55:47 +0100 > Subject: [PATCH v2 04/13] aarch64: Add aarch64-w64-mingw32 COFF > > Define ASM specific for COFF format on AArch64. > > gcc/ChangeLog: > > * config.gcc: Add COFF format support definitions. > * config/aarch64/aarch64-coff.h: New file. > --- > gcc/config.gcc | 1 + > gcc/config/aarch64/aarch64-coff.h | 91 +++++++++++++++++++++++++++++++ > 2 files changed, 92 insertions(+) > create mode 100644 gcc/config/aarch64/aarch64-coff.h > > diff --git a/gcc/config.gcc b/gcc/config.gcc > index b762393b64c..cb6661f44ef 100644 > --- a/gcc/config.gcc > +++ b/gcc/config.gcc > @@ -1266,6 +1266,7 @@ aarch64*-*-linux*) > ;; > aarch64-*-mingw*) > tm_file="${tm_file} aarch64/aarch64-abi-ms.h" > + tm_file="${tm_file} aarch64/aarch64-coff.h" > tmake_file="${tmake_file} aarch64/t-aarch64" > case ${enable_threads} in > "" | yes | win32) > diff --git a/gcc/config/aarch64/aarch64-coff.h b/gcc/config/aarch64/aarch64-coff.h > new file mode 100644 > index 00000000000..79c5a43b970 > --- /dev/null > +++ b/gcc/config/aarch64/aarch64-coff.h > @@ -0,0 +1,91 @@ > +/* Machine description for AArch64 architecture. > + Copyright (C) 2024 Free Software Foundation, Inc. > + > + This file is part of GCC. > + > + GCC is free software; you can redistribute it and/or modify it > + under the terms of the GNU General Public License as published by > + the Free Software Foundation; either version 3, or (at your option) > + any later version. > + > + GCC is distributed in the hope that it will be useful, but > + WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + General Public License for more details. > + > + You should have received a copy of the GNU General Public License > + along with GCC; see the file COPYING3. If not see > + . */ > + > +#ifndef GCC_AARCH64_COFF_H > +#define GCC_AARCH64_COFF_H > + > +#include "aarch64.h" Is this needed? It looks like aarch64-coff.h comes after aarch64.h in the include list, so I'd have expected the #include to be a no-op. If you want to emphasise that this file must be included after aarch64.h then perhaps: #if !defined(GCC_AARCH64_H) #error This file must be included after aarch64.h #endif would work. But it should also be ok just to drop the include without replacing it with anything. > + > +#ifndef LOCAL_LABEL_PREFIX > +# define LOCAL_LABEL_PREFIX "" > +#endif > + > +/* Using long long breaks -ansi and -std=c90, so these will need to be > + made conditional for an LLP64 ABI. */ > +#undef SIZE_TYPE > +#define SIZE_TYPE "long long unsigned int" > + > +#undef PTRDIFF_TYPE > +#define PTRDIFF_TYPE "long long int" > + > +#undef LONG_TYPE_SIZE > +#define LONG_TYPE_SIZE 32 > + > +#ifndef ASM_GENERATE_INTERNAL_LABEL > +# define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \ > + sprintf (STRING, "*%s%s%u", LOCAL_LABEL_PREFIX, PREFIX, (unsigned int)(NUM)) > +#endif > + > +#define ASM_OUTPUT_ALIGN(STREAM, POWER) \ > + fprintf (STREAM, "\t.align\t%d\n", (int)POWER) > + > +/* Output a common block. */ > +#ifndef ASM_OUTPUT_COMMON > +# define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \ > + { \ > + fprintf (STREAM, "\t.comm\t"); \ > + assemble_name (STREAM, NAME); \ > + asm_fprintf (STREAM, ", %d, %d\n", \ > + (int)(ROUNDED), (int)(SIZE)); \ > + } > +#endif > + > +/* Output a local common block. /bin/as can't do this, so hack a > + `.space' into the bss segment. Note that this is *bad* practice, > + which is guaranteed NOT to work since it doesn't define STATIC > + COMMON space but merely STATIC BSS space. */ > +#ifndef ASM_OUTPUT_ALIGNED_LOCAL > +# define ASM_OUTPUT_ALIGNED_LOCAL(STREAM, NAME, SIZE, ALIGN) \ > + { \ > + switch_to_section (bss_section); \ > + ASM_OUTPUT_ALIGN (STREAM, floor_log2 (ALIGN / BITS_PER_UNIT)); \ > + ASM_OUTPUT_LABEL (STREAM, NAME); \ > + fprintf (STREAM, "\t.space\t%d\n", (int)(SIZE)); \ > + } > +#endif > + > +#define ASM_OUTPUT_SKIP(STREAM, NBYTES) \ > + fprintf (STREAM, "\t.space\t%d // skip\n", (int) (NBYTES)) > + > +#define ASM_OUTPUT_TYPE_DIRECTIVE(STREAM, NAME, TYPE) > +#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) Just curious: are these empty definitions the final intended definitions, or are they just temporary? Might be worth a comment either way. Thanks, Richard > + > +#define TEXT_SECTION_ASM_OP "\t.text" > +#define DATA_SECTION_ASM_OP "\t.data" > +#define BSS_SECTION_ASM_OP "\t.bss" > + > +#define CTORS_SECTION_ASM_OP "\t.section\t.ctors, \"aw\"" > +#define DTORS_SECTION_ASM_OP "\t.section\t.dtors, \"aw\"" > + > +#define GLOBAL_ASM_OP "\t.global\t" > + > +#undef SUPPORTS_INIT_PRIORITY > +#define SUPPORTS_INIT_PRIORITY 0 > + > +#endif