From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by sourceware.org (Postfix) with ESMTPS id D34433858D37 for ; Mon, 18 Mar 2024 13:26:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D34433858D37 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D34433858D37 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::52f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710768412; cv=none; b=UIZ/WtEYeVIHJN6i2m3pyhn/tESRni62j7EOkEeu//ajTocbaa9HItDVygwyjbUwcbvUxPn7kIfL1FzrzeCvVFHuAL2KGSDhUzuZLtl0lSjipJRb7h00hFClEbRS8xeqZc5lFW6YjzTZ2yGgaaRpF7wM8Tsxg4NAa8f10tI+Kc0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710768412; c=relaxed/simple; bh=2IlEisZ60npFFdiIA22ddpMHEFLC2+sv1TYkDdwE5CY=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=ms80Qc3K8XdUglbRAFC2g9sHlJCUc9qe71a8pCIsDuyjOMzoXX4Md1o8VvW0hgtcJAC43MBLCBVTPA7Tytk4x7YTL4GBtkJy/Ga3xpMvgUdpQSBnfrj5lpNyQx08WhfzLLpmydeb1+w06D9LmIzto9WIoxNovLLY8q7CuOKhK3E= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-56b0af675deso802697a12.1 for ; Mon, 18 Mar 2024 06:26:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710768408; x=1711373208; darn=gcc.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=tECIJhOImLZ7NMYtty+yxbcjuLJVU3u+6sNHFmQq0Yw=; b=I5DH0bkVA+PYJlrx1wuOcU8x6SXTTC66nwYDKwm/HNHr+KB7AWNtdrJf+4FGWGlPfd 9IM3XmXmv/LyVFcLnoEaEsUG7sYpJwcKD9NihmB2s9Zu0Mn0TVkMcSgxDkB3dYwf1CHu PKPogFYHOiEqQjlLaxWYNbApWmDWXx09SRr6fUaFhn+i0Nw6JO7995fDFbrb5G/r/nuS A/ua8kjNp7g/5rRISWLsr48WYWvnroq6MXVO2uehzWwRknpzS87cxhUYHoQq9OinR1e6 qo7Fi1H5kXflW2dI7ZOC0mwTIA0PIvANaJQgxGkr7p8XBzrgK8j2lX49/3ojFRBCP4Uk jA1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710768408; x=1711373208; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=tECIJhOImLZ7NMYtty+yxbcjuLJVU3u+6sNHFmQq0Yw=; b=JHr9tLEXVp4ei6cBOuIkNWIYx/Dd/S6W733/peKwD4XKXGtI9SvOPaH5PwIfzhR8Dz Xkx2GqBjrYSsFAcdRGmoIiS0qXsuRYPX68wjrhnKrhQDh/MdZN/z9qK7kOO6okn2jDpq JDyoilpWSqtPVR2hstfjEEKRGIuWcpGO3LDN8vTYaNfvAdP3+z1H3d29c7uFdS/6B7xe +9d6ouZLP/zcd1eo5pyQFY92Ub5Vlk8vYG/Vkgkdp5YWZ86LByzdwYDX4OaNkviUyFRv ONBCO37PqhZAa2iST+wJCNHaRY4J4RImtABHRVo4IALwJmEnVUHzs5fySwq6HTJbyf+W dKgQ== X-Gm-Message-State: AOJu0Yx9/Sm6v0r12kP/0/L5dBppaeOw04t1tV+7A1Vs9m9S9EkieJ8/ dpk4+zNVCflD+2sw6SiVEPzsiGG9/pOknaF5kkEICmUP3WuJO+PbFTPvqr30kbkl+Y7ZImg2I0Y q9Sp0W/qnE++9EC99q6x7HbeKKK7NxRe6+keABw== X-Google-Smtp-Source: AGHT+IG9DXQD7dHDqp71JDCCHH2Zqm98jsiXgy1edBblZMTNMZdYVAfNogF99iRrXjqX2q7C1GpDg9bJBfagdwphuoU= X-Received: by 2002:a05:6402:4142:b0:565:faf5:225d with SMTP id x2-20020a056402414200b00565faf5225dmr9915541eda.29.1710768408387; Mon, 18 Mar 2024 06:26:48 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Christophe Lyon Date: Mon, 18 Mar 2024 14:26:37 +0100 Message-ID: Subject: Re: [PATCH v2 08/13] aarch64: Add Cygwin and MinGW environments for AArch64 To: Evgeny Karpov Cc: "gcc-patches@gcc.gnu.org" , "richard.sandiford@arm.com" , "Richard Earnshaw (lists)" , "Andrew Pinski (QUIC)" , Maxim Kuvyrkov , Radek Barton Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_NUMSUBJECT,KAM_SHORT,KAM_STOCKGEN,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: Hi! On Mon, 4 Mar 2024 at 18:44, Evgeny Karpov wrote: > > From: Zac Walker > Date: Fri, 1 Mar 2024 10:49:28 +0100 > Subject: [PATCH v2 08/13] aarch64: Add Cygwin and MinGW environments for > AArch64 > > Define Cygwin and MinGW environment such as types, SEH definitions, > shared libraries, etc. > > gcc/ChangeLog: > > * config.gcc: Add Cygwin and MinGW difinitions. > * config/aarch64/aarch64-protos.h > (mingw_pe_maybe_record_exported_symbol): Declare functions > which are used in Cygwin and MinGW environment. > (mingw_pe_section_type_flags): Likewise. > (mingw_pe_unique_section): Likewise. > (mingw_pe_encode_section_info): Likewise. > * config/aarch64/cygming.h: New file. > --- > gcc/config.gcc | 4 + > gcc/config/aarch64/aarch64-protos.h | 5 + > gcc/config/aarch64/cygming.h | 175 ++++++++++++++++++++++++++++ > 3 files changed, 184 insertions(+) > create mode 100644 gcc/config/aarch64/cygming.h > > diff --git a/gcc/config.gcc b/gcc/config.gcc > index 3aca257c322..4471599454b 100644 > --- a/gcc/config.gcc > +++ b/gcc/config.gcc > @@ -1267,7 +1267,11 @@ aarch64*-*-linux*) > aarch64-*-mingw*) > tm_file="${tm_file} aarch64/aarch64-abi-ms.h" > tm_file="${tm_file} aarch64/aarch64-coff.h" > + tm_file="${tm_file} aarch64/cygming.h" > + tm_file="${tm_file} mingw/mingw32.h" > + tm_file="${tm_file} mingw/mingw-stdint.h" > tmake_file="${tmake_file} aarch64/t-aarch64" > + target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc" > case ${enable_threads} in > "" | yes | win32) > thread_file='win32' > diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h > index bd719b992a5..759e1a0f9da 100644 > --- a/gcc/config/aarch64/aarch64-protos.h > +++ b/gcc/config/aarch64/aarch64-protos.h > @@ -1110,6 +1110,11 @@ extern void aarch64_output_patchable_area (unsigned int, bool); > > extern void aarch64_adjust_reg_alloc_order (); > > +extern void mingw_pe_maybe_record_exported_symbol (tree, const char *, int); > +extern unsigned int mingw_pe_section_type_flags (tree, const char *, int); > +extern void mingw_pe_unique_section (tree, int); > +extern void mingw_pe_encode_section_info (tree, rtx, int); > + > bool aarch64_optimize_mode_switching (aarch64_mode_entity); > void aarch64_restore_za (rtx); > > diff --git a/gcc/config/aarch64/cygming.h b/gcc/config/aarch64/cygming.h > new file mode 100644 > index 00000000000..2f239c42a89 > --- /dev/null > +++ b/gcc/config/aarch64/cygming.h > @@ -0,0 +1,175 @@ > +/* Operating system specific defines to be used when targeting GCC for > + hosting on Windows32, using a Unix style C library and tools. > + Copyright (C) 1995-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_CYGMING_H > +#define GCC_AARCH64_CYGMING_H > + > +#undef PREFERRED_DEBUGGING_TYPE > +#define PREFERRED_DEBUGGING_TYPE DINFO_TYPE_NONE > + > +#define FASTCALL_PREFIX '@' > + > +#define print_reg(rtx, code, file) > + > +#define SYMBOL_FLAG_DLLIMPORT 0 > +#define SYMBOL_FLAG_DLLEXPORT 0 > + > +#define SYMBOL_REF_DLLEXPORT_P(X) \ > + ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_DLLEXPORT) != 0) > + > +/* Disable SEH and declare the required SEH-related macros that are > +still needed for compilation. */ > +#undef TARGET_SEH > +#define TARGET_SEH 0 > + > +#define SSE_REGNO_P(N) 0 > +#define GENERAL_REGNO_P(N) 0 I think you forgot to add a comment to explain the above two lines. (it was requested during v1 review) Thanks, Christophe > +#define SEH_MAX_FRAME_SIZE 0 > + > +#undef DEFAULT_ABI > +#define DEFAULT_ABI AARCH64_CALLING_ABI_MS > + > +#undef TARGET_PECOFF > +#define TARGET_PECOFF 1 > + > +#include > +#ifdef __MINGW32__ > +#include > +#endif > + > +extern void mingw_pe_asm_named_section (const char *, unsigned int, tree); > +extern void mingw_pe_declare_function_type (FILE *file, const char *name, > + int pub); > + > +#define TARGET_ASM_NAMED_SECTION mingw_pe_asm_named_section > + > +/* Select attributes for named sections. */ > +#define TARGET_SECTION_TYPE_FLAGS mingw_pe_section_type_flags > + > +#define TARGET_ASM_UNIQUE_SECTION mingw_pe_unique_section > +#define TARGET_ENCODE_SECTION_INFO mingw_pe_encode_section_info > + > +/* Declare the type properly for any external libcall. */ > +#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ > + mingw_pe_declare_function_type (FILE, XSTR (FUN, 0), 1) > + > +#define TARGET_OS_CPP_BUILTINS() \ > + do \ > + { \ > + builtin_define ("__MSVCRT__"); \ > + builtin_define ("__MINGW32__"); \ > + builtin_define ("_WIN32"); \ > + builtin_define_std ("WIN32"); \ > + builtin_define_std ("WINNT"); \ > + builtin_define_with_int_value ("_INTEGRAL_MAX_BITS", \ > + TYPE_PRECISION (intmax_type_node)); \ > + builtin_define ("__MINGW64__"); \ > + builtin_define_std ("WIN64"); \ > + builtin_define ("_WIN64"); \ > + builtin_define ("__stdcall=__attribute__((__stdcall__))"); \ > + builtin_define ("__fastcall=__attribute__((__fastcall__))"); \ > + builtin_define ("__thiscall=__attribute__((__thiscall__))"); \ > + builtin_define ("__cdecl=__attribute__((__cdecl__))"); \ > + } \ > + while (0) > + > +/* Windows64 continues to use a 32-bit long type. */ > +#undef LONG_TYPE_SIZE > +#define LONG_TYPE_SIZE 32 > + > +#undef DEFAULT_SIGNED_CHAR > +#define DEFAULT_SIGNED_CHAR 1 > + > +#undef SIZE_TYPE > +#undef PTRDIFF_TYPE > +#define SIZE_TYPE "long long unsigned int" > +#define PTRDIFF_TYPE "long long int" > + > +#undef WCHAR_TYPE_SIZE > +#undef WCHAR_TYPE > +#define WCHAR_TYPE_SIZE 16 > +#define WCHAR_TYPE "short unsigned int" > + > +#define drectve_section() \ > + (fprintf (asm_out_file, "\t.section\t.drectve\n"), \ > + in_section = NULL) > + > + > +/* Enable alias attribute support. */ > +#ifndef SET_ASM_OP > +#define SET_ASM_OP "\t.set\t" > +#endif > + > +/* GNU as supports weak symbols on PECOFF. */ > +#define ASM_WEAKEN_LABEL(FILE, NAME) \ > + do \ > + { \ > + fputs ("\t.weak\t", (FILE)); \ > + assemble_name ((FILE), (NAME)); \ > + fputc ('\n', (FILE)); \ > + } \ > + while (0) > + > +/* Get tree.cc to declare a target-specific specialization of > + merge_decl_attributes. */ > +#define TARGET_DLLIMPORT_DECL_ATTRIBUTES 1 > + > +#define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \ > + do { \ > + switch (GET_MODE (BODY)) \ > + { \ > + case E_QImode: \ > + asm_fprintf (STREAM, "\t.byte\t(%LL%d - %LLrtx%d) / 4\n", \ > + VALUE, REL); \ > + break; \ > + case E_HImode: \ > + asm_fprintf (STREAM, "\t.2byte\t(%LL%d - %LLrtx%d) / 4\n", \ > + VALUE, REL); \ > + break; \ > + case E_SImode: \ > + case E_DImode: /* See comment in aarch64_output_casesi. */ \ > + asm_fprintf (STREAM, "\t.word\t(%LL%d - %LLrtx%d) / 4\n", \ > + VALUE, REL); \ > + break; \ > + default: \ > + gcc_unreachable (); \ > + } \ > + } while (0) > + > +#define READONLY_DATA_SECTION_ASM_OP "\t.section\t.rdata,\"dr\"" > + > +#undef SUBTARGET_OVERRIDE_OPTIONS > +#define SUBTARGET_OVERRIDE_OPTIONS \ > + do { \ > + flag_stack_check = STATIC_BUILTIN_STACK_CHECK; \ > + } while (0) > + > + > +#define SUPPORTS_ONE_ONLY 1 > + > +/* Define this to be nonzero if static stack checking is supported. */ > +#define STACK_CHECK_STATIC_BUILTIN 1 > + > +#define HAVE_GAS_ALIGNED_COMM 1 > + > +#undef MAX_OFILE_ALIGNMENT > +#define MAX_OFILE_ALIGNMENT (8192 * 8) > + > +#endif > -- > 2.25.1 >