From patchwork Thu Apr 18 21:41:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Karpov X-Patchwork-Id: 88690 Return-Path: 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 DE28B3858288 for ; Thu, 18 Apr 2024 21:41:55 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2093.outbound.protection.outlook.com [40.107.22.93]) by sourceware.org (Postfix) with ESMTPS id A81BA3858D33 for ; Thu, 18 Apr 2024 21:41:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A81BA3858D33 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 A81BA3858D33 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.22.93 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1713476492; cv=pass; b=G87kP9wcdzqEP7aRHAWAWoddsaxEoQJwaYGMhEvMYRKh7+fBlWIaj0B4oIloMWv7JsxLtFdrN0dBMVZbu8KbG0WKuAJVqo0s42iLQibd+Vkcf1jPy/sup3HtpOwcwkRLz68cW+wtCo04NlGJzMCfkZfSX447/5o789C8+iYEQA4= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1713476492; c=relaxed/simple; bh=s72Lw+ZYUWX4wiSYyTM1blCUXhN9HMVOaCa7yNZDPu0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=o5VtFh0A4IRiRaa5G943f9Yyz8m+Yc6Bot7CJhhSh2xxYNPQH2ZU9f95vlwD3q4vcp5idXT6LN8MiyixADTMEKiaiLTIVUKBlzewDMiOC86wdtorY2RZhdXhKufCUUDoXuUfaHuLhbxbZg0EahZL/i426z/IY4B+ipX9YDJY5VI= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VhRWMNyIEx8XVJUJWrR+9cu+42yI/05YQ5+gLIzrH+peUojso86P0c9pt4Uw/KEkZbMu8HFJhMbJn+uvdqkm8M2kut2nh/nDZNlk/J/JhKEWTr25kY54p2cy9LzAUqIDpbB6BYKRzBpVTyZwI0yWClHoEwj53ZfjNSFFtli8dDu+ZNcOr+aQSHw9Tg/5tZBF3VwjOdfgJWKUEEkSnDDaudlIZb8g9reOhYadT9XaXItfH+DcYZqbDpU8/yGEAkswl6bEt0NErP+pOUlxgSDGugGXKQvAhEUpSzLfWrHS5bzpOwHd9r/MxVM6MPI+gH0isY8CCw8Ag+LuKjqV2l5f7Q== 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=glaReWSTg4JDg2M7aM1lfLVW5Gl5unVatCYm8TYv9K0=; b=A5chOkn51oiJ6ukKwF8LZq1tPCnQt+Mb51yr7GykdIfCZtf/fRBU+clIDFWuTq3XaNJx59eK3bTKMHyW1GB54juay4Bt14kZ4ilo9o7kzEqluH3c6YdPPTVWmtkw3WzFEmHiqUCXU2TQQIuOc3rks84pyvbBSfk2BaXTwtFvKEdul+V/foC2KIz4AKlif396cYW8wMI1LDC9k4pwFXwRMpn2YfZbRdFI6nQPJ/9DXKa/v6AZ8jo5eiwAibf3JAXG96sc8JhxImlAch/tGIryD6lbFFN/gXnuzcYF/huzeOmfIHoYtPGwtWH9aMOxkfJesKGoQcEPbkFiZgnuEgUiSg== 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=glaReWSTg4JDg2M7aM1lfLVW5Gl5unVatCYm8TYv9K0=; b=IVHy+lPIemae0GXjaXHMxZzkWAHjOEX1uaXFCanncuzSwdH8GshfIpNeFqoIx3+I7WS8elfuie3xVElycNejcad6du/ndzjhLL9mmTfSzv33Rh0c0gFiUuUJrWn/FlVsIKn53gWw684Mx33eQK/HGhWviN9XA46AG22aruge9zo= Received: from PR3PR83MB0425.EURPRD83.prod.outlook.com (2603:10a6:102:5f::21) by DBBPR83MB0563.EURPRD83.prod.outlook.com (2603:10a6:10:533::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.12; Thu, 18 Apr 2024 21:41:28 +0000 Received: from PR3PR83MB0425.EURPRD83.prod.outlook.com ([fe80::2303:5667:fa24:79c2]) by PR3PR83MB0425.EURPRD83.prod.outlook.com ([fe80::2303:5667:fa24:79c2%7]) with mapi id 15.20.7519.014; Thu, 18 Apr 2024 21:41:27 +0000 From: Evgeny Karpov To: Evgeny Karpov , "gcc-patches@gcc.gnu.org" CC: "richard.sandiford@arm.com" , "Richard Earnshaw (lists)" , Maxim Kuvyrkov , Radek Barton Subject: [PATCH v1 1/6] Move mingw_* declarations to the mingw folder Thread-Topic: [PATCH v1 1/6] Move mingw_* declarations to the mingw folder Thread-Index: AQHakdkqL+XajJOv10mQMEB9fUzsFg== Date: Thu, 18 Apr 2024 21:41:27 +0000 Message-ID: References: In-Reply-To: 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=7edbbdf7-0382-4215-8fdf-996305ff5b5e; 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-04-18T21:26:39Z; 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: PR3PR83MB0425:EE_|DBBPR83MB0563:EE_ x-ms-office365-filtering-correlation-id: fd3b9460-f2ce-450c-86d2-08dc5ff04d71 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|1800799015|376005|366007|38070700009; x-microsoft-antispam-message-info: mqqKFp/Gl9V9qExMhv+nH2UsemanyWqw1M4vpKv9xfikr0jGrIN19qVMqJ9v7k7deYJT21kETjxgOnzwrgkiSLYKxCTOuQy8BHOjq/nN3wsVfNKmgoSYBUArT9ePdO+OFOWhCMl4mHLM8V+lhPk9Axb9NCtjFJ8bRBWLkqlaYZcVt7bc48J+fNwO4AG/vXr9j2UBakkmQcNC+bh62hleiFDr3hvZ6AoeW8inRJoV81SE8XZ3s2CAUrYqp8443YMZasUqriVDn3h0mymUiWwipTbdj2o4KQ8QuwPTdr7IPj5G6IJAFe/iMLi1zEi7U3WHIKjhrZZjMRNHecHXRpQHPRG1cmUtq/PFqkUfCNpniO9SjjleQ/70PCGNjZ+buRf+lHzY1XQdeurfB8PIfh4qMSwTptcIFbSVUEeWwbTR0+szycXBYW9TnpKDcjQcH82bb43LDpqjqafGRLFEm2Z4altpe8toEsDRWVdy3YMsOFEAXMjG9w51joCpB986FCiZTdEWP1H637ur7q/zEYdXOBn6tyQ60u3Kn7TXOW9vCkNr1eTjae8eJY5bQxnEqHmNV060a8TlCkAmflRApjLAI5aV1bU2miyDgqgiKsDskrsFxflRO5VYjPp5TR04vpBMypw7VCjldmUqghRED7KxRrrrhgbqWH61TP7a2CDv0MHh8oINU0PXC81qc3xvwdDDVGuq/effRO0dYa/fF6AlLp190yG+bFXMGPhsjTfa12776NP5CsMtXX0Oa8bQKu0UpoL59dVqEtD8swjhkVTRQE/WT6kBUnuIcM6XCArABDJX8ko2YMn5J8e0cdIY89AqJ0k4T7kKRCy2IdVc9EBpw7+SghdtF8R5ygDlOHI6G7zH8+A7tr7YCqAU2V/zw2HT3LmtInWHGdKnbdu8e3oEeN5gXiX+kG13jFJ6s+TZmhN4oERtnH3m/qGQs6SOrc7YfPYJIsrJOZqP8/vlzq9a2WAbB2Q780QJkqe/I0bDVUKrRVy0FR6QcLwqVx6Br9X+OuMWZZ7phsJTCYLvLP4VgL9xMi+IfH8bq4XMmZqkf3HYagGLrhkXCB04OJOi3wQe71tDFTxYgWtOA6LDhUXRCFPOnN0ugt3gRrYHXxxyDwaY6uFYZMuyP+UEJJEcz23GSxH/gVWijtuxnzEU4AeviE48AcWJWLNBsshf8cqdpz7kiaS5sGhjgsvroHh6sdeuyorkXu7aD3RBJQVN/my33pWdUEMe/UIcQ8h+iaA6wsppl4D3xNhIDSRdNH2XGpp1wvOy0AqR0TFVvzN/fGYF5A== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PR3PR83MB0425.EURPRD83.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(1800799015)(376005)(366007)(38070700009); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: 3N4LpspaWZGzq3VO6BVSYO8hehstRLE9M4K95XzGHmnjLSzM8wA7eyDRFdCLIPaJOMMW3cJDXD6o209lXCZXHg+tJOggna7e4vS+VQyTx+k+11IW4nsG6y5fR3CUUA5xUmDk35TIGJPA90JaH1QLU4UXbeBRw/YyFAq7d3xpPutCksY42ecNHjVwPxcmC3oIyfpXILDQb+0HJRyYAVZ6stTgqhNhi7YGPGpcKWYuFqGFTB9gBWmwlzieEDbijnDMz7LSoxVZ42wybVrCWVZtyXwsjjetO9IUx7bGRVzD2rKqtYfLbSoHO2RPAgKc1FIzuGsYfggAeYG92TTQsYKMBZ1PWBjHi+KVCt6UP0bZouErarAm4Sl5vkTSvsormB8HFM7psaDhDYLycPdp9+xJfuXvYSqebIuOHH4hyOIKPEv3jMAF1emBFCNS3tizzwbrKAoIvXf9CScKMJP68P67pfMZT0XPKt1q+op2eh8cpnf/UIgkFFkXLFUJt1hJheob3DOlATXIrLAudR7lAmxPmCN5kbfJETtbAi5OhZahrFUjSZCvHsVyBtc5hm854v5BqB+2KcN6uIN7LlKUscaIO8o9DPrufvcn1B6UO5aZ2sgNct+f/tpQQobRqcyk9mPhfO670Gvtpr8HHdqvmrgcGQLBiHVsHaVeA7H2SxtI+TrESOZAh4IjP+DF5CpZDbPcwaqHKxmM7Jp2NGEL+J4CiualN3tGkh/IMShabCbT7hW9w7plyYDVE9D9ZKcuKbxiccsSsb25pjVT3+rIBSReuI63n+4MmHc5v14MZTP8298YtM4pA25Uj8DjSY08394tpQJ5/DsmfeewvrxSdI0kp4/vNsf92hE9vpNZiKjO8UrbIZliDNbYC+ukq7JK/1rhQzsu/sAlsouU6756OFTkYwHEouVXOWSbM3G2v3ZKnr4GLoGy0JwgKJpE5oFKwfEnjXeU1k8KacU0mnbloPVuqK5TbQuYWcsP1r/sZi7xTcvOH2jBQYRn4gibVtvS5zWHRNyJUnpQDtFGQmG8CM0qBVdZXSM67X+49th4N1JbsBgQkoYIOeU/SumdKQ3XP/u4qWeQTYXSmRFLUAFDmtwRj4rowwEMt4DMKDzWhbF/myeh0KQhd+yAZXM1VpXqT7oBMMq3urDBpUr5ytLFcv30zhILliqlApw2QZ7GmflUdmjmpw5BrtPM6fYciRgzPpcr/QmY4on3yb5m8o8ElO1A/gfdrMY2lKLBGNC6worjZjQJH3hKjBPP7ErVRL1DDWgcdKCpXaHUVhtHWh1Wx268WQj+9uQzey3ib8gQkc6SStolKbbkYpm9lKUOmNV+6jMqiBaf6Ai0/ECK90hOzTVAl3+VlJb8i99B4t/JvV/EObusiBpBcp04SJRk2QW+DQr2iacLLZWYuk65CD5rDDMW0qTuE8UGalJAuTCi9dZABNwQ6vw4eEzksyO/ruJheYaWxhTX2Tww+8WnHJb/GF97/ZEa4ygoH0R6S2QLKWRT7WFFEGgw4MWyp0fQmKdhfwBsfxgUzhotiuzLw1AENImOMV1aV5/PuF1Ua5U/gpp/4ve6j6zO7iCwcgdXSoL/2PAI MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PR3PR83MB0425.EURPRD83.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fd3b9460-f2ce-450c-86d2-08dc5ff04d71 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Apr 2024 21:41:27.5321 (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: M9KzWqM4+3fa5eL87gbqyZeWjpkTlpMVXXJS/mt3AkCvBDv/PMzXdpVrIMjzuC5OqbWckINhu49dYUyFJmq9zw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR83MB0563 X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, KAM_SHORT, KAM_STOCKGEN, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org This patch refactors recent changes to move mingw-related functionality to the mingw folder. More renamings to the mingw_ prefix will be done in follow-up commits. This is the first commit in the second patch series to add DLL import/export implementation to AArch64. Coauthors: Zac Walker , Mark Harmstone and Ron Riddle Refactored, prepared, and validated by Radek Barton and Evgeny Karpov gcc/ChangeLog: * config/aarch64/aarch64-protos.h (mingw_pe_maybe_record_exported_symbol): Move mingw_* declarations to mingw. (mingw_pe_section_type_flags): Likewise. (mingw_pe_unique_section): Likewise. (mingw_pe_encode_section_info): Likewise. * config/aarch64/cygming.h (mingw_pe_asm_named_section): Likewise. (mingw_pe_declare_function_type): Likewise. * config/i386/i386-protos.h (mingw_pe_unique_section): Likewise. (mingw_pe_declare_function_type): Likewise. (mingw_pe_maybe_record_exported_symbol): Likewise. (mingw_pe_encode_section_info): Likewise. (mingw_pe_section_type_flags): Likewise. (mingw_pe_asm_named_section): Likewise. * config/mingw/winnt.h: New file. --- gcc/config/aarch64/aarch64-protos.h | 6 +----- gcc/config/aarch64/cygming.h | 4 ---- gcc/config/i386/i386-protos.h | 8 ++------ gcc/config/mingw/winnt.h | 29 +++++++++++++++++++++++++++++ 4 files changed, 32 insertions(+), 15 deletions(-) create mode 100644 gcc/config/mingw/winnt.h diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h index 1d3f94c813e..95972556c56 100644 --- a/gcc/config/aarch64/aarch64-protos.h +++ b/gcc/config/aarch64/aarch64-protos.h @@ -24,6 +24,7 @@ #include "input.h" #include "config/arm/aarch-common.h" +#include "config/mingw/winnt.h" /* SYMBOL_SMALL_ABSOLUTE: Generate symbol accesses through high and lo relocs that calculate the base address using a PC @@ -1110,11 +1111,6 @@ 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 index 2e7b01feb76..0d048879311 100644 --- a/gcc/config/aarch64/cygming.h +++ b/gcc/config/aarch64/cygming.h @@ -51,10 +51,6 @@ still needed for compilation. */ #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. */ diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h index dbc861fb1ea..96368521380 100644 --- a/gcc/config/i386/i386-protos.h +++ b/gcc/config/i386/i386-protos.h @@ -17,6 +17,8 @@ You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see . */ +#include "config/mingw/winnt.h" + /* In i386-common.cc. */ extern bool ix86_handle_option (struct gcc_options *opts, struct gcc_options *opts_set ATTRIBUTE_UNUSED, @@ -295,16 +297,10 @@ extern void ix86_target_macros (void); extern void ix86_register_pragmas (void); /* In winnt.cc */ -extern void mingw_pe_unique_section (tree, int); -extern void mingw_pe_declare_function_type (FILE *, const char *, int); extern void i386_pe_record_external_function (tree, const char *); -extern void mingw_pe_maybe_record_exported_symbol (tree, const char *, int); -extern void mingw_pe_encode_section_info (tree, rtx, int); extern bool i386_pe_binds_local_p (const_tree); extern const char *i386_pe_strip_name_encoding_full (const char *); extern bool i386_pe_valid_dllimport_attribute_p (const_tree); -extern unsigned int mingw_pe_section_type_flags (tree, const char *, int); -extern void mingw_pe_asm_named_section (const char *, unsigned int, tree); extern void i386_pe_asm_output_aligned_decl_common (FILE *, tree, const char *, HOST_WIDE_INT, diff --git a/gcc/config/mingw/winnt.h b/gcc/config/mingw/winnt.h new file mode 100644 index 00000000000..da8445904ce --- /dev/null +++ b/gcc/config/mingw/winnt.h @@ -0,0 +1,29 @@ +/* Subroutines for targets on Windows. +Copyright (C) 2024 Free Software Foundation, Inc. + +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 +http://www.gnu.org/licenses/. */ + +#ifndef GCC_MINGW_WINNT_H +#define GCC_MINGW_WINNT_H + +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); +extern void mingw_pe_encode_section_info (tree, rtx, int); +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); + +#endif From patchwork Thu Apr 18 21:43:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Karpov X-Patchwork-Id: 88691 Return-Path: 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 27120384AB49 for ; Thu, 18 Apr 2024 21:44:17 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2132.outbound.protection.outlook.com [40.107.13.132]) by sourceware.org (Postfix) with ESMTPS id 805333858D33 for ; Thu, 18 Apr 2024 21:43:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 805333858D33 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 805333858D33 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.13.132 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1713476625; cv=pass; b=Y1eJ3oQEUO0dhE03+GgyzO/mmcf3lr761YMhNJFxivj96fQWTKkZ0eHt5AU2FKmlLoNYmWdftPkF83+HE3+/htSD1CuAiMjOxhJ0BIIYsST3Y2C7p1hf4RfP1/XXE6yWft+3XsxZ9HgsNhTAGu+SBOvYZkf8Iq7ymaV3fSWN0rE= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1713476625; c=relaxed/simple; bh=MHa1BZYgv9M9KhgbWujVBy9/XLXrfhy17Yn8LrqQIwI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=UAJXI4P10IVj6h/41QTUW0gSqnl7vr6j6+H1sbM75dvta/QD/GByGuJpMG4l6/oXwybPajG61u/5Z22abiue0cGXuZ7YvW67LKzFZMF/iGAZHKljZxVsd6tcLf3BcYk9E4UcfldV5Z6pN1ziuLfNt2ZYNdzSNbsLsXczokKX7LU= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZYSRhz9CmzlH21QANeIXvSXyfrQNq+Xz+nCt2BElcTSu+kDEHJSZdbFASlVGdJ2zMRAWaKdaMOFFGTliue3MvjvWjPp4cFOjfgss8Vz5Un3x/U+d6fgptPF+9B9kgfuBFx5ClG5bS2R1+QXuwFG1l8rcE/+mx8O/kUTxHkoMTFK8Sve4/Hda7e5//9qxss2STaw6a1+5HXMSZLCy528Avdx62vdX579HWj07E/svJnZGCsKzFpIC9cAAEDUiaaDl9CLjOyzrxIb5B9yp89CDuN+BMmt38LBMqKWJeEuM3zFvZrM6+Sl445SaspXqQXwIMW7IigQkwhO/awixYCgo0g== 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=w2U2t0GtLfSeT99WIQClUT8VjvqPlG12wpdQIo727kI=; b=JmtSMrchiazCa01h0h8chVLNt2IH+5WZNLSwGeF/Z1i+cNiIDZwJn29LJpBBnKAxJKUcHq0wssRWuCzbkBPKS8w60+NXsiumlH+O+IS8Q7RUQK4oO0qkQUj1t6YrocYhX9z8ySjV7OT6LG4xSN6UTi8EMU6EojOKFwdO+XgymOjpu/WdVWL7erXjmhUd/nNabpwAQOJu33gmplZbQwCu6ZdBgerZ2m3nWumrBvrGVRX+3tk7TSvnbuSsGPr5/alT0Tuf0c49BUEfWSoT3bghAasyd669eF8g2zDGmc2V3LSbbEKhpu3Gm1Su7B+C7qYGHFN9k5oph30ugh9E76T3mA== 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=w2U2t0GtLfSeT99WIQClUT8VjvqPlG12wpdQIo727kI=; b=OKTUF225ECbHxg6Jya3peH+tdGo40O/w2EcZ3rS/39HMh4gABvs8LJMsErLmnFOyXBiKn4jPYlxQoCJVu0uEUvD6djn0TjOg8IPsLRu/uSTPpyzEe4xhYzTPWglv+EEqkZT5yy4i/eNI0kT8F64xolcpMb5B0fmU115UjB1sBZg= Received: from PR3PR83MB0425.EURPRD83.prod.outlook.com (2603:10a6:102:5f::21) by DBBPR83MB0563.EURPRD83.prod.outlook.com (2603:10a6:10:533::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.12; Thu, 18 Apr 2024 21:43:37 +0000 Received: from PR3PR83MB0425.EURPRD83.prod.outlook.com ([fe80::2303:5667:fa24:79c2]) by PR3PR83MB0425.EURPRD83.prod.outlook.com ([fe80::2303:5667:fa24:79c2%7]) with mapi id 15.20.7519.014; Thu, 18 Apr 2024 21:43:37 +0000 From: Evgeny Karpov To: Evgeny Karpov , "gcc-patches@gcc.gnu.org" CC: "richard.sandiford@arm.com" , "Richard Earnshaw (lists)" , Maxim Kuvyrkov , Radek Barton Subject: [PATCH v1 2/6] Extract ix86 dllimport implementation to mingw Thread-Topic: [PATCH v1 2/6] Extract ix86 dllimport implementation to mingw Thread-Index: AQHakdl4yBd50+i1eUKP8VeuXhZlmg== Date: Thu, 18 Apr 2024 21:43:37 +0000 Message-ID: References: In-Reply-To: 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=7edbbdf7-0382-4215-8fdf-996305ff5b5e; 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-04-18T21:26:39Z; 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: PR3PR83MB0425:EE_|DBBPR83MB0563:EE_ x-ms-office365-filtering-correlation-id: 7adad307-a0e6-4d22-c545-08dc5ff09aa9 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|1800799015|376005|366007|38070700009; x-microsoft-antispam-message-info: +HnKQ7yCjEuOKFBwnJLDgPOgsYzxOygP8ZBtAAsZ3/tpQBTyQCOBNkbVJWU2OJzB1XUfscYtkpnbBB/n3zZcUYfsjzl9RaNFveMwoAJWgfSh+f+w+nioXngfhx42iFREmYT3ABFG31ytOfEgrwbT4peASzxvTmND7vca6TEA/asG9lm5tR0TjlVIdDdz4JWpZo16fJ/fsXK/KMapy5N3NsAgxvJw4sc7gbHTMLTJusp1B3zVTK4Uw+pnrsxXG07NzJla3fzRj4eqLJCHuMRTjO+aCXsWR7VtGllnRhyjbWn34fG7OJS750TRkWmjsmkWbrOpvDss8wkxffqOW82PG5uekIue20buyj6tTiqXmYSK714RhuaqGfHTMye1TlDqGjzhETZcesar+a9XljDVowJTEsSF5cBifQYFwcmHPdI6wr7CnvHlEEzMqhYWErwhgRJrjDKp6k4RZyOkr0TTQL4U4C8uR7n95r1q9I67iZWNi+hpCH4o7W0NALT10tYisVLZLEEI9uP2/qdiaVHqLns1tttVnK/G56FJy0l7sOKn40S/KKzmsFnnyxwrsqjWkYRwX0Xops6ktwD+okrhBS21ORp+i9j2kTaeYXTY1rwEfqSipkimd9jNBFcC2mg1OYqFTH4BJCeIicR1cBEoD0cSHbHyq7j/jklHGPpvYWSg+46jsVinhjRnEYRC1LmWHBUM+EefaK8DT6LlvMsfGiy0aGLgJtt33gnr7SdBO6A4x3N9owOb0GG8U1tNHaRlpmX+KzIiFt4yEI1EpY0Mrp9j1JSUppU10llyTHMmRTt0OfaHRNJhqybck4SnXEQnDE/FjY+FN+iTCD0hQ+MDwGYkP95O4N/VE1SPIAhUWbozwVeBJVwCni6yyALPW5MOIrWfSzEVnZRNJ9imuULw2OoNmO0Pds5YK6tBIoPfpxyD007ZlGkBpRPgD5E9tH4Kpbyw8D6ZHD88YPbHeNoKZl9apUZLo0xEACbD34syizSx82EKgEocARa7t+tpM+ba9rnoPPQxyr/dXolDFXK5ZxX/f+yHo5rFqD4CJ8uOZVApSXlVwz1YZV6Je3SZVFAsjofaTQOj7joVmNjx4HJfRAlNGbjX1jdycE0lNd3T9t++6j+fFm+FTiNdSC0TV58sDHnX9hf30RiNORYtkS1LgMlqybpB0oG3jsf83HzRZuI7OtpdUyqSotqVOfZMf49jWVq4h9VuURnlhg901LdUSVtLEqnoxNg9SGswOQQdeAb3E09na+T5bfqjY7RejKvxhEVV7gcZzZIM+DGgBD+GBA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PR3PR83MB0425.EURPRD83.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(1800799015)(376005)(366007)(38070700009); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: tkjY2ZP3hKzjy12BfKbjuuxcAbNTH787xV4CyNhMKHqJXCjUfxr3wdbxmCqsAUNaimbzxSA71H16lIaFFLFGJ0ozN/ijPOIjv9K30mF25BaijwyrAtyKMUlBBhYe2YGIBWLT97ac2QBlUQgPnMMvklT1xMkCTTPUt+yMOxJoQcwLI6EJwYij+woOvUCYaQ4GZH9ewvL+f7g8DP7C3U2++/WJ5OdoCbwhWBhvbEgmXIban/JCTAoUcQszArERpOtqOzY3Bhn5wO90g3YclJFNO+Nh3AUOEnkJT29OsXj630ybtWkqSBKrN2zrIYVHkXhazt4Ba2CuGKuaeTj7Cly+YirkJ0ymiyqQl5Z86FJsm+OouFzYw0oagO545Z8lVmLgbaF78eNgeehon1gQokO/GDjDd0Regd+G1bhkp7zfvZTH0Qs3QW2WxbXdyIcW0bDsJLLonZyHlvmHNUyVpA3wjsy/t0fi122dW7NSxP8jT7vphjFZvTUm7ftAT+Ve0Wi9l3ewIdw/7z2iRXfn/r1Gl1ODsICBv8x9C4ynfd676VVlSXzhd5oG2bqzNDVjHo27AgaVXPRxRiyFE4KHr/sejIa7+6DxZa7WA9ED4hD9cXnyGA90uoduOkEFq3SS1+/BDP6DWYfa3aAby+0OaE2GBkh/COyyamOEL97CSBTsotMzKK1aS90y//qWTJmb+0Fta6b3rsYHH4xMISYAW6c1RSgEJnBe8SVgDQu5DMmHzSAig4L17IQoWFoLJ2pmFevdXeVKkUW5UZLnz0Qe9Hz9PfXsuQnTSmVvQyxp9ZbzNNlhsQtht4ubaRrjc4TH1bMHJKNMTReQbvcGzG0Lnviqe9PONNlZMys8J+6sWIRzBw6mn3586D/QjACGOmZRS5Xl1IRgw8fSW34JYCby/kK4JC9J5CWzXifZ+1O2dYlu6JDi/7MOUtIl1UnSpQhrbM9U2QVs/zfbV4I/YqsW8u2oYtZ4KfozPTrZAxQTcryPa4liFmitNY6YUcLyYf9qftuHpJ8uVBUbzc3l3ukhWPLefDf9zh1tvyJxzChAT3tH12nldhMjbYdGPqDpOtu0A6fQTefh0MyQ9lZTUe9oIUoVnwl/1XNM8uQ3kmThf95zUnuuVG4wWhyY0lxHGvUfoz7iR6UqCce5eGRTIWH9ZfgYMJkWq6DYHrX2VD3uzsPj3HjSc5J88t3EmSCOK925m86reQ5mDhEPjFAWmn3B2Ux2DnCac6+U7+j53dL6LL/zz1VUZ++nU1jNzwvTPx/KiGHP7V6wHs1yX3Pe38j871f3vh3UgYLJEHZanII6UCLPxV6GcT9m9GtNBeWtBBTKbn68PmEAWwBO31R5NmuAzvuTalQ2rDaeKw5JqBRO47NYe7B95RlbGEB1+5GSaZ2PKXgtHaw64X7jul10KFT2Hj5v2Ufp7pxPrPfrwHz18MAOBMmGKP/brzUz2Stx8mxbjWHWcOm3HAuYqmgor1soZSuMvusnooV9SbRz+EUCTDc8DSZeC81xKpVGhjnZUuDC/amHF91avBvPOWGXN5mIQlswT7ho50mjhIPf+51i4ZEGNOeZKhT7btRIzzM3NjmbjRkY MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PR3PR83MB0425.EURPRD83.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7adad307-a0e6-4d22-c545-08dc5ff09aa9 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Apr 2024 21:43:37.0785 (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: j/gWwa+Xj2pImx0ySdx1TW/O3eo3gNhefvAgnU4R8kEj/rHGqeFlpIpO8MvSk1Z53MqE1U7F+oQ6Y/FSR3JH4g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR83MB0563 X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, KAM_SHORT, KAM_STOCKGEN, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org This patch extracts the ix86 implementation for expanding a SYMBOL into its corresponding dllimport, far-address, or refptr symbol. It will be reused in the aarch64-w64-mingw32 target. The implementation is copied as is from i386/i386.cc with minor changes to follow to the code style. Also this patch replaces the original DLL import/export implementation in ix86 with mingw. gcc/ChangeLog: * config.gcc: Add winnt-dll.o, which contains the DLL import/export implementation. * config/i386/cygming.h (SUB_TARGET_RECORD_STUB): Remove the old implementation. Rename the required function to MinGW. Rename it to a conditional function that will reuse the MinGW implementation for COFF and nothing otherwise. * config/i386/i386-expand.cc (ix86_expand_move): Likewise. * config/i386/i386-expand.h (is_imported_p): Likewise. (mingw_GOT_alias_set): Likewise. (ix86_legitimize_pe_coff_symbol): Likewise. * config/i386/i386-protos.h: Likewise. * config/i386/i386.cc (is_imported_p): Likewise. (ix86_legitimize_pe_coff_symbol): Likewise. (ix86_GOT_alias_set): Likewise. (legitimize_pic_address): Likewise. (struct dllimport_hasher): (GTY): Likewise. (get_dllimport_decl): Likewise. (legitimize_pe_coff_extern_decl): Likewise. (legitimize_dllimport_symbol): Likewise. (legitimize_pe_coff_symbol): Likewise. (ix86_legitimize_address): Likewise. * config/mingw/winnt.h (mingw_pe_record_stub): Likewise. * config/mingw/winnt.cc (i386_pe_record_stub): Likewise. (mingw_pe_record_stub): Likewise. * config/mingw/t-cygming: Add the winnt-dll.o compilation. * config/mingw/winnt-dll.cc: New file. --- gcc/config.gcc | 6 +- gcc/config/i386/cygming.h | 2 +- gcc/config/i386/i386-expand.cc | 2 +- gcc/config/i386/i386-expand.h | 2 +- gcc/config/i386/i386-protos.h | 2 +- gcc/config/i386/i386.cc | 211 ++++-------------------------- gcc/config/mingw/t-cygming | 6 + gcc/config/mingw/winnt-dll.cc | 229 +++++++++++++++++++++++++++++++++ gcc/config/mingw/winnt-dll.h | 26 ++++ gcc/config/mingw/winnt.cc | 2 +- gcc/config/mingw/winnt.h | 1 + 11 files changed, 292 insertions(+), 197 deletions(-) create mode 100644 gcc/config/mingw/winnt-dll.cc create mode 100644 gcc/config/mingw/winnt-dll.h diff --git a/gcc/config.gcc b/gcc/config.gcc index ef7f854735a..be2b20a155c 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -2181,7 +2181,7 @@ i[34567]86-*-cygwin*) tmake_file="${tmake_file} mingw/t-cygming t-slibgcc" target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc" extra_options="${extra_options} mingw/cygming.opt i386/cygwin.opt" - extra_objs="${extra_objs} winnt.o winnt-stubs.o" + extra_objs="${extra_objs} winnt.o winnt-stubs.o winnt-dll.o" c_target_objs="${c_target_objs} msformat-c.o" cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o" d_target_objs="${d_target_objs} cygwin-d.o" @@ -2199,7 +2199,7 @@ x86_64-*-cygwin*) tmake_file="${tmake_file} mingw/t-cygming t-slibgcc" target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc" extra_options="${extra_options} mingw/cygming.opt i386/cygwin.opt" - extra_objs="${extra_objs} winnt.o winnt-stubs.o" + extra_objs="${extra_objs} winnt.o winnt-stubs.o winnt-dll.o" c_target_objs="${c_target_objs} msformat-c.o" cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o" d_target_objs="${d_target_objs} cygwin-d.o" @@ -2283,7 +2283,7 @@ i[34567]86-*-mingw* | x86_64-*-mingw*) *) ;; esac - extra_objs="${extra_objs} winnt.o winnt-stubs.o" + extra_objs="${extra_objs} winnt.o winnt-stubs.o winnt-dll.o" c_target_objs="${c_target_objs} msformat-c.o" cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o" gas=yes diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h index beedf7c398a..4110ceab824 100644 --- a/gcc/config/i386/cygming.h +++ b/gcc/config/i386/cygming.h @@ -459,7 +459,7 @@ do { \ #define TARGET_ASM_ASSEMBLE_VISIBILITY i386_pe_assemble_visibility #undef SUB_TARGET_RECORD_STUB -#define SUB_TARGET_RECORD_STUB i386_pe_record_stub +#define SUB_TARGET_RECORD_STUB mingw_pe_record_stub /* Static stack checking is supported by means of probes. */ #define STACK_CHECK_STATIC_BUILTIN 1 diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc index 8bb8f21e686..77bf4433aa8 100644 --- a/gcc/config/i386/i386-expand.cc +++ b/gcc/config/i386/i386-expand.cc @@ -412,7 +412,7 @@ ix86_expand_move (machine_mode mode, rtx operands[]) } else { - tmp = legitimize_pe_coff_symbol (op1, addend != NULL_RTX); + tmp = ix86_legitimize_pe_coff_symbol (op1, addend != NULL_RTX); if (tmp) { op1 = tmp; diff --git a/gcc/config/i386/i386-expand.h b/gcc/config/i386/i386-expand.h index 65cb49c921c..a8c20993954 100644 --- a/gcc/config/i386/i386-expand.h +++ b/gcc/config/i386/i386-expand.h @@ -36,7 +36,7 @@ struct expand_vec_perm_d rtx legitimize_tls_address (rtx x, enum tls_model model, bool for_mov); alias_set_type ix86_GOT_alias_set (void); rtx legitimize_pic_address (rtx orig, rtx reg); -rtx legitimize_pe_coff_symbol (rtx addr, bool inreg); +rtx ix86_legitimize_pe_coff_symbol (rtx addr, bool inreg); bool insn_defines_reg (unsigned int regno1, unsigned int regno2, rtx_insn *insn); diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h index 96368521380..dbced12f8d4 100644 --- a/gcc/config/i386/i386-protos.h +++ b/gcc/config/i386/i386-protos.h @@ -18,6 +18,7 @@ along with GCC; see the file COPYING3. If not see . */ #include "config/mingw/winnt.h" +#include "config/mingw/winnt-dll.h" /* In i386-common.cc. */ extern bool ix86_handle_option (struct gcc_options *opts, @@ -314,7 +315,6 @@ extern void i386_pe_end_cold_function (FILE *, const char *, tree); extern void i386_pe_assemble_visibility (tree, int); extern tree i386_pe_mangle_decl_assembler_name (tree, tree); extern tree i386_pe_mangle_assembler_name (const char *); -extern void i386_pe_record_stub (const char *); extern void i386_pe_seh_init (FILE *); extern void i386_pe_seh_end_prologue (FILE *); diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index 4d6b2b98761..a17e819602a 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -11230,20 +11230,6 @@ ix86_cannot_force_const_mem (machine_mode mode, rtx x) return !ix86_legitimate_constant_p (mode, x); } -/* Nonzero if the symbol is marked as dllimport, or as stub-variable, - otherwise zero. */ - -static bool -is_imported_p (rtx x) -{ - if (!TARGET_DLLIMPORT_DECL_ATTRIBUTES - || GET_CODE (x) != SYMBOL_REF) - return false; - - return SYMBOL_REF_DLLIMPORT_P (x) || SYMBOL_REF_STUBVAR_P (x); -} - - /* Nonzero if the constant value X is a legitimate general operand when generating PIC code. It is given that flag_pic is on and that X satisfies CONSTANT_P. */ @@ -11822,17 +11808,31 @@ constant_address_p (rtx x) return CONSTANT_P (x) && ix86_legitimate_address_p (Pmode, x, 1); } -/* Return a unique alias set for the GOT. */ + +#if TARGET_PECOFF +rtx ix86_legitimize_pe_coff_symbol (rtx addr, bool inreg) +{ + return legitimize_pe_coff_symbol (addr, inreg); +} alias_set_type ix86_GOT_alias_set (void) { - static alias_set_type set = -1; - if (set == -1) - set = new_alias_set (); - return set; + return mingw_GOT_alias_set (); +} +#else +rtx ix86_legitimize_pe_coff_symbol (rtx addr, bool inreg) +{ + return NULL_RTX; } +alias_set_type +ix86_GOT_alias_set (void) +{ + return -1; +} +#endif + /* Return a legitimate reference for ORIG (an address) using the register REG. If REG is 0, a new pseudo is generated. @@ -11869,7 +11869,7 @@ legitimize_pic_address (rtx orig, rtx reg) if (TARGET_64BIT && TARGET_DLLIMPORT_DECL_ATTRIBUTES) { - rtx tmp = legitimize_pe_coff_symbol (addr, true); + rtx tmp = ix86_legitimize_pe_coff_symbol (addr, true); if (tmp) return tmp; } @@ -11914,7 +11914,7 @@ legitimize_pic_address (rtx orig, rtx reg) on VxWorks, see gotoff_operand. */ || (TARGET_VXWORKS_RTP && GET_CODE (addr) == LABEL_REF)) { - rtx tmp = legitimize_pe_coff_symbol (addr, true); + rtx tmp = ix86_legitimize_pe_coff_symbol (addr, true); if (tmp) return tmp; @@ -12489,173 +12489,6 @@ ix86_rewrite_tls_address (rtx pattern) return pattern; } -/* Create or return the unique __imp_DECL dllimport symbol corresponding - to symbol DECL if BEIMPORT is true. Otherwise create or return the - unique refptr-DECL symbol corresponding to symbol DECL. */ - -struct dllimport_hasher : ggc_cache_ptr_hash -{ - static inline hashval_t hash (tree_map *m) { return m->hash; } - static inline bool - equal (tree_map *a, tree_map *b) - { - return a->base.from == b->base.from; - } - - static int - keep_cache_entry (tree_map *&m) - { - return ggc_marked_p (m->base.from); - } -}; - -static GTY((cache)) hash_table *dllimport_map; - -static tree -get_dllimport_decl (tree decl, bool beimport) -{ - struct tree_map *h, in; - const char *name; - const char *prefix; - size_t namelen, prefixlen; - char *imp_name; - tree to; - rtx rtl; - - if (!dllimport_map) - dllimport_map = hash_table::create_ggc (512); - - in.hash = htab_hash_pointer (decl); - in.base.from = decl; - tree_map **loc = dllimport_map->find_slot_with_hash (&in, in.hash, INSERT); - h = *loc; - if (h) - return h->to; - - *loc = h = ggc_alloc (); - h->hash = in.hash; - h->base.from = decl; - h->to = to = build_decl (DECL_SOURCE_LOCATION (decl), - VAR_DECL, NULL, ptr_type_node); - DECL_ARTIFICIAL (to) = 1; - DECL_IGNORED_P (to) = 1; - DECL_EXTERNAL (to) = 1; - TREE_READONLY (to) = 1; - - name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); - name = targetm.strip_name_encoding (name); - if (beimport) - prefix = name[0] == FASTCALL_PREFIX || user_label_prefix[0] == 0 - ? "*__imp_" : "*__imp__"; - else - prefix = user_label_prefix[0] == 0 ? "*.refptr." : "*refptr."; - namelen = strlen (name); - prefixlen = strlen (prefix); - imp_name = (char *) alloca (namelen + prefixlen + 1); - memcpy (imp_name, prefix, prefixlen); - memcpy (imp_name + prefixlen, name, namelen + 1); - - name = ggc_alloc_string (imp_name, namelen + prefixlen); - rtl = gen_rtx_SYMBOL_REF (Pmode, name); - SET_SYMBOL_REF_DECL (rtl, to); - SYMBOL_REF_FLAGS (rtl) = SYMBOL_FLAG_LOCAL | SYMBOL_FLAG_STUBVAR; - if (!beimport) - { - SYMBOL_REF_FLAGS (rtl) |= SYMBOL_FLAG_EXTERNAL; -#ifdef SUB_TARGET_RECORD_STUB - SUB_TARGET_RECORD_STUB (name); -#endif - } - - rtl = gen_const_mem (Pmode, rtl); - set_mem_alias_set (rtl, ix86_GOT_alias_set ()); - - SET_DECL_RTL (to, rtl); - SET_DECL_ASSEMBLER_NAME (to, get_identifier (name)); - - return to; -} - -/* Expand SYMBOL into its corresponding far-address symbol. - WANT_REG is true if we require the result be a register. */ - -static rtx -legitimize_pe_coff_extern_decl (rtx symbol, bool want_reg) -{ - tree imp_decl; - rtx x; - - gcc_assert (SYMBOL_REF_DECL (symbol)); - imp_decl = get_dllimport_decl (SYMBOL_REF_DECL (symbol), false); - - x = DECL_RTL (imp_decl); - if (want_reg) - x = force_reg (Pmode, x); - return x; -} - -/* Expand SYMBOL into its corresponding dllimport symbol. WANT_REG is - true if we require the result be a register. */ - -static rtx -legitimize_dllimport_symbol (rtx symbol, bool want_reg) -{ - tree imp_decl; - rtx x; - - gcc_assert (SYMBOL_REF_DECL (symbol)); - imp_decl = get_dllimport_decl (SYMBOL_REF_DECL (symbol), true); - - x = DECL_RTL (imp_decl); - if (want_reg) - x = force_reg (Pmode, x); - return x; -} - -/* Expand SYMBOL into its corresponding dllimport or refptr symbol. WANT_REG - is true if we require the result be a register. */ - -rtx -legitimize_pe_coff_symbol (rtx addr, bool inreg) -{ - if (!TARGET_PECOFF) - return NULL_RTX; - - if (TARGET_DLLIMPORT_DECL_ATTRIBUTES) - { - if (GET_CODE (addr) == SYMBOL_REF && SYMBOL_REF_DLLIMPORT_P (addr)) - return legitimize_dllimport_symbol (addr, inreg); - if (GET_CODE (addr) == CONST - && GET_CODE (XEXP (addr, 0)) == PLUS - && GET_CODE (XEXP (XEXP (addr, 0), 0)) == SYMBOL_REF - && SYMBOL_REF_DLLIMPORT_P (XEXP (XEXP (addr, 0), 0))) - { - rtx t = legitimize_dllimport_symbol (XEXP (XEXP (addr, 0), 0), inreg); - return gen_rtx_PLUS (Pmode, t, XEXP (XEXP (addr, 0), 1)); - } - } - - if (ix86_cmodel != CM_LARGE_PIC && ix86_cmodel != CM_MEDIUM_PIC) - return NULL_RTX; - if (GET_CODE (addr) == SYMBOL_REF - && !is_imported_p (addr) - && SYMBOL_REF_EXTERNAL_P (addr) - && SYMBOL_REF_DECL (addr)) - return legitimize_pe_coff_extern_decl (addr, inreg); - - if (GET_CODE (addr) == CONST - && GET_CODE (XEXP (addr, 0)) == PLUS - && GET_CODE (XEXP (XEXP (addr, 0), 0)) == SYMBOL_REF - && !is_imported_p (XEXP (XEXP (addr, 0), 0)) - && SYMBOL_REF_EXTERNAL_P (XEXP (XEXP (addr, 0), 0)) - && SYMBOL_REF_DECL (XEXP (XEXP (addr, 0), 0))) - { - rtx t = legitimize_pe_coff_extern_decl (XEXP (XEXP (addr, 0), 0), inreg); - return gen_rtx_PLUS (Pmode, t, XEXP (XEXP (addr, 0), 1)); - } - return NULL_RTX; -} - /* Try machine-dependent ways of modifying an illegitimate address to be legitimate. If we find one, return the new, valid address. This macro is used in only one place: `memory_address' in explow.cc. @@ -12695,7 +12528,7 @@ ix86_legitimize_address (rtx x, rtx, machine_mode mode) if (TARGET_DLLIMPORT_DECL_ATTRIBUTES) { - rtx tmp = legitimize_pe_coff_symbol (x, true); + rtx tmp = ix86_legitimize_pe_coff_symbol (x, true); if (tmp) return tmp; } diff --git a/gcc/config/mingw/t-cygming b/gcc/config/mingw/t-cygming index f5de941c8e5..73679a9d6c0 100644 --- a/gcc/config/mingw/t-cygming +++ b/gcc/config/mingw/t-cygming @@ -33,6 +33,12 @@ winnt-cxx.o: $(srcdir)/config/mingw/winnt-cxx.cc $(CONFIG_H) $(SYSTEM_H) \ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ $(srcdir)/config/mingw/winnt-cxx.cc +winnt-dll.o: $(srcdir)/config/mingw/winnt-dll.cc $(CONFIG_H) $(SYSTEM_H) \ + coretypes.h \ + $(TM_H) $(TREE_H) flags.h \ + $(TM_P_H) $(HASHTAB_H) $(GGC_H) + $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ + $(srcdir)/config/mingw/winnt-dll.cc winnt-stubs.o: $(srcdir)/config/mingw/winnt-stubs.cc $(CONFIG_H) $(SYSTEM_H) \ coretypes.h \ diff --git a/gcc/config/mingw/winnt-dll.cc b/gcc/config/mingw/winnt-dll.cc new file mode 100644 index 00000000000..349ade6f5c0 --- /dev/null +++ b/gcc/config/mingw/winnt-dll.cc @@ -0,0 +1,229 @@ +/* Expand a SYMBOL into its corresponding dllimport, far-address, +or refptr symbol. +Copyright (C) 2024 Free Software Foundation, Inc. + +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 +http://www.gnu.org/licenses/. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "backend.h" +#include "target.h" +#include "rtl.h" +#include "tree.h" +#include "memmodel.h" +#include "stringpool.h" +#include "emit-rtl.h" +#include "alias.h" +#include "varasm.h" +#include "output.h" +#include "explow.h" +#include "winnt.h" + +/* Create or return the unique __imp_DECL dllimport symbol corresponding + to symbol DECL if BEIMPORT is true. Otherwise create or return the + unique refptr-DECL symbol corresponding to symbol DECL. */ + +struct dllimport_hasher : ggc_cache_ptr_hash +{ + static inline hashval_t hash (tree_map *m) + { + return m->hash; + } + + static inline bool + equal (tree_map *a, tree_map *b) + { + return a->base.from == b->base.from; + } + + static int + keep_cache_entry (tree_map *&m) + { + return ggc_marked_p (m->base.from); + } +}; + +static GTY ((cache)) hash_table *dllimport_map; + +/* Nonzero if the symbol is marked as dllimport, or as stub-variable, + otherwise zero. */ + +bool +is_imported_p (rtx x) +{ + if (!TARGET_DLLIMPORT_DECL_ATTRIBUTES + || GET_CODE (x) != SYMBOL_REF) + return false; + + return SYMBOL_REF_DLLIMPORT_P (x) || SYMBOL_REF_STUBVAR_P (x); +} + +/* Return a unique alias set for the GOT. */ + +alias_set_type +mingw_GOT_alias_set (void) +{ + static alias_set_type set = -1; + if (set == -1) + set = new_alias_set (); + return set; +} + +static tree +get_dllimport_decl (tree decl, bool beimport) +{ + struct tree_map *h, in; + const char *name; + const char *prefix; + size_t namelen, prefixlen; + char *imp_name; + tree to; + rtx rtl; + + if (!dllimport_map) + dllimport_map = hash_table::create_ggc (512); + + in.hash = htab_hash_pointer (decl); + in.base.from = decl; + tree_map **loc = dllimport_map->find_slot_with_hash (&in, in.hash, INSERT); + h = *loc; + if (h) + return h->to; + + *loc = h = ggc_alloc (); + h->hash = in.hash; + h->base.from = decl; + h->to = to = build_decl (DECL_SOURCE_LOCATION (decl), + VAR_DECL, NULL, ptr_type_node); + DECL_ARTIFICIAL (to) = 1; + DECL_IGNORED_P (to) = 1; + DECL_EXTERNAL (to) = 1; + TREE_READONLY (to) = 1; + + name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); + name = targetm.strip_name_encoding (name); + if (beimport) + prefix = name[0] == FASTCALL_PREFIX || user_label_prefix[0] == 0 + ? "*__imp_" : "*__imp__"; + else + prefix = user_label_prefix[0] == 0 ? "*.refptr." : "*refptr."; + namelen = strlen (name); + prefixlen = strlen (prefix); + imp_name = (char *) alloca (namelen + prefixlen + 1); + memcpy (imp_name, prefix, prefixlen); + memcpy (imp_name + prefixlen, name, namelen + 1); + + name = ggc_alloc_string (imp_name, namelen + prefixlen); + rtl = gen_rtx_SYMBOL_REF (Pmode, name); + SET_SYMBOL_REF_DECL (rtl, to); + SYMBOL_REF_FLAGS (rtl) = SYMBOL_FLAG_LOCAL | SYMBOL_FLAG_STUBVAR; + if (!beimport) + { + SYMBOL_REF_FLAGS (rtl) |= SYMBOL_FLAG_EXTERNAL; +#ifdef SUB_TARGET_RECORD_STUB + SUB_TARGET_RECORD_STUB (name); +#endif + } + + rtl = gen_const_mem (Pmode, rtl); + set_mem_alias_set (rtl, mingw_GOT_alias_set ()); + + SET_DECL_RTL (to, rtl); + SET_DECL_ASSEMBLER_NAME (to, get_identifier (name)); + + return to; +} + +/* Expand SYMBOL into its corresponding far-address symbol. + WANT_REG is true if we require the result be a register. */ + +static rtx +legitimize_pe_coff_extern_decl (rtx symbol, bool want_reg) +{ + tree imp_decl; + rtx x; + + gcc_assert (SYMBOL_REF_DECL (symbol)); + imp_decl = get_dllimport_decl (SYMBOL_REF_DECL (symbol), false); + + x = DECL_RTL (imp_decl); + if (want_reg) + x = force_reg (Pmode, x); + return x; +} + +/* Expand SYMBOL into its corresponding dllimport symbol. WANT_REG is + true if we require the result be a register. */ + +static rtx +legitimize_dllimport_symbol (rtx symbol, bool want_reg) +{ + tree imp_decl; + rtx x; + + gcc_assert (SYMBOL_REF_DECL (symbol)); + imp_decl = get_dllimport_decl (SYMBOL_REF_DECL (symbol), true); + + x = DECL_RTL (imp_decl); + if (want_reg) + x = force_reg (Pmode, x); + return x; +} + +/* Expand SYMBOL into its corresponding dllimport or refptr symbol. WANT_REG + is true if we require the result be a register. */ + +rtx +legitimize_pe_coff_symbol (rtx addr, bool inreg) +{ + if (!TARGET_PECOFF) + return NULL_RTX; + + if (TARGET_DLLIMPORT_DECL_ATTRIBUTES) + { + if (GET_CODE (addr) == SYMBOL_REF && SYMBOL_REF_DLLIMPORT_P (addr)) + return legitimize_dllimport_symbol (addr, inreg); + if (GET_CODE (addr) == CONST + && GET_CODE (XEXP (addr, 0)) == PLUS + && GET_CODE (XEXP (XEXP (addr, 0), 0)) == SYMBOL_REF + && SYMBOL_REF_DLLIMPORT_P (XEXP (XEXP (addr, 0), 0))) + { + rtx t = legitimize_dllimport_symbol (XEXP (XEXP (addr, 0), 0), inreg); + return gen_rtx_PLUS (Pmode, t, XEXP (XEXP (addr, 0), 1)); + } + } + + if (ix86_cmodel != CM_LARGE_PIC && ix86_cmodel != CM_MEDIUM_PIC) + return NULL_RTX; + + if (GET_CODE (addr) == SYMBOL_REF + && !is_imported_p (addr) + && SYMBOL_REF_EXTERNAL_P (addr) + && SYMBOL_REF_DECL (addr)) + return legitimize_pe_coff_extern_decl (addr, inreg); + + if (GET_CODE (addr) == CONST + && GET_CODE (XEXP (addr, 0)) == PLUS + && GET_CODE (XEXP (XEXP (addr, 0), 0)) == SYMBOL_REF + && !is_imported_p (XEXP (XEXP (addr, 0), 0)) + && SYMBOL_REF_EXTERNAL_P (XEXP (XEXP (addr, 0), 0)) + && SYMBOL_REF_DECL (XEXP (XEXP (addr, 0), 0))) + { + rtx t = legitimize_pe_coff_extern_decl (XEXP (XEXP (addr, 0), 0), inreg); + return gen_rtx_PLUS (Pmode, t, XEXP (XEXP (addr, 0), 1)); + } + return NULL_RTX; +} diff --git a/gcc/config/mingw/winnt-dll.h b/gcc/config/mingw/winnt-dll.h new file mode 100644 index 00000000000..19c16e747a2 --- /dev/null +++ b/gcc/config/mingw/winnt-dll.h @@ -0,0 +1,26 @@ +/* Expand a SYMBOL into its corresponding dllimport, far-address, +or refptr symbol. +Copyright (C) 2024 Free Software Foundation, Inc. + +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 +http://www.gnu.org/licenses/. */ + +#ifndef GCC_MINGW_WINNT_DLL_H +#define GCC_MINGW_WINNT_DLL_H + +extern bool is_imported_p (rtx x); +extern alias_set_type mingw_GOT_alias_set (void); +extern rtx legitimize_pe_coff_symbol (rtx addr, bool inreg); + +#endif \ No newline at end of file diff --git a/gcc/config/mingw/winnt.cc b/gcc/config/mingw/winnt.cc index 2a4fc03fc56..9901576ade0 100644 --- a/gcc/config/mingw/winnt.cc +++ b/gcc/config/mingw/winnt.cc @@ -672,7 +672,7 @@ mingw_pe_maybe_record_exported_symbol (tree decl, const char *name, int is_data) } void -i386_pe_record_stub (const char *name) +mingw_pe_record_stub (const char *name) { struct stub_list *p; diff --git a/gcc/config/mingw/winnt.h b/gcc/config/mingw/winnt.h index da8445904ce..646654e872d 100644 --- a/gcc/config/mingw/winnt.h +++ b/gcc/config/mingw/winnt.h @@ -23,6 +23,7 @@ extern void mingw_pe_declare_function_type (FILE *file, const char *name, int pub); extern void mingw_pe_encode_section_info (tree, rtx, int); extern void mingw_pe_maybe_record_exported_symbol (tree, const char *, int); +extern void mingw_pe_record_stub (const char *name); extern unsigned int mingw_pe_section_type_flags (tree, const char *, int); extern void mingw_pe_unique_section (tree, int); From patchwork Thu Apr 18 21:45:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Karpov X-Patchwork-Id: 88692 Return-Path: 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 B34ED385842A for ; Thu, 18 Apr 2024 21:46:32 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2099.outbound.protection.outlook.com [40.107.105.99]) by sourceware.org (Postfix) with ESMTPS id 390EF3858D33 for ; Thu, 18 Apr 2024 21:46:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 390EF3858D33 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 390EF3858D33 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.105.99 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1713476764; cv=pass; b=og+imNledEfLw1kfdwggNS+StXFdvG+itFSFuApWU+crR8bdftUJEJc3YDAIkIHOws/wSt6aMR/w6KSfl4fzMcDGERI6ukFR8ZZFcgx6/n7E174n1tNHI0qBi+pjCoLw+Sfp6VcTMyE4WnLU6wkR5lRuitQvDnJRkVa5evGxFi4= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1713476764; c=relaxed/simple; bh=IDZy4KF/b5DoAqhMuxTh35Mh3LJpDrO1gWufHQexBV0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=kOc4eQuxNgBiDOH+Yb/35sKkEiTrXK2tVPbwpg7kMvIvI2SqgU1tzaQbA8g5R8HlsU9/G2oWRXnQWtAosxglRpqiesEWN6NeSUNfu3BHjm/AkU6AEw2jVPkUEw8P+GbzPEjqmOyrO7z/Zwx1WRXIzahJVIk3UNc1laGltlTG/AM= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C4x/rZdjh+sOEdE+XlwhKI2ZfbJ/9Pbxar5VzVV1S4sKQReRfFmaDs1mq2d1FiAeuerrnHEjlrJLvZyYGS/92ihvn6g+knvZTtcRkUJIjIAYNjskXFzMzRjgeo/1Mff55OQcLHbxSBZELU9TNHD5uCLc0evQRLhVoKgdKRTxArTJIslPOPlRurPGGqCDmiEDMkRODqXF/cU4kLjfE3prTIJoeQ30VtJ4XV/jwpUsws72BkGGJ+MCwUFTbIcLoo8fW/hXXJ2kNl5XowupmAih4wJduqSM5IeQ7UG+pEa4mRDvAJH4vpQfpMGFdlbh6jRhtoh5sMgDEaexvb3lB3Rtqg== 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=jwf1Y2+3XONqf712qFIxbZcR0PCxLfLMgQN+b/m+HcE=; b=HTk/eE6lW035Oq5bbF4P7q7Gm5dazGTJN6oU3mHiExIK7g7Y5CNV8Ldl3YSd7B2AkaCr7cDl8lg+t/GVPj9uuaQqaw1R4QUCGN5D1jiCp6xddB4E20XSRfDz83mQ63U9o/mNImdaCQLjnyOX4mZCfPzDrTYDU1yEhUu9hFoMKn3HhRyTVbVIDBKhb1QzHGa2A3uBQTbOjvSrMf08vFnJXaoXMqbYxP1uFAvL6kYzHvx9E59l950sl9a1u5vN2Fa60+iUClGsWk+eQbrEM7WUaklUH4UF7aRFWVWuvtx6xXOvMoqs1CsLwe+6qTjzEtIztgZou/l3DXqRs1DY7daRuQ== 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=jwf1Y2+3XONqf712qFIxbZcR0PCxLfLMgQN+b/m+HcE=; b=Djc2UYCcIX4dY6GKaX9LbinMUCPd1hn11+5YP0fOJmlBLbXOeERaJLwk3TG4zvDPmchY0L7lZKRXeR8aFlJwv5gexS5gzjGcGwoNeuxyIO+1Ga060sU6N9DQltdi3P/YWbeeqJHCktwigFQNRvJohJzENu0PfBF2J7B/kvqCUXQ= Received: from PR3PR83MB0425.EURPRD83.prod.outlook.com (2603:10a6:102:5f::21) by VI0PR83MB0695.EURPRD83.prod.outlook.com (2603:10a6:800:218::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.14; Thu, 18 Apr 2024 21:45:58 +0000 Received: from PR3PR83MB0425.EURPRD83.prod.outlook.com ([fe80::2303:5667:fa24:79c2]) by PR3PR83MB0425.EURPRD83.prod.outlook.com ([fe80::2303:5667:fa24:79c2%7]) with mapi id 15.20.7519.014; Thu, 18 Apr 2024 21:45:57 +0000 From: Evgeny Karpov To: Evgeny Karpov , "gcc-patches@gcc.gnu.org" CC: "richard.sandiford@arm.com" , "Richard Earnshaw (lists)" , Maxim Kuvyrkov , Radek Barton Subject: [PATCH v1 3/6] Rename functions for reuse in AArch64 Thread-Topic: [PATCH v1 3/6] Rename functions for reuse in AArch64 Thread-Index: AQHakdnMy7uWoP5YA0ObgFPmF8HNqQ== Date: Thu, 18 Apr 2024 21:45:57 +0000 Message-ID: References: In-Reply-To: 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=7edbbdf7-0382-4215-8fdf-996305ff5b5e; 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-04-18T21:26:39Z; 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: PR3PR83MB0425:EE_|VI0PR83MB0695:EE_ x-ms-office365-filtering-correlation-id: f621738a-48df-4368-49e1-08dc5ff0ee7c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|376005|1800799015|366007|38070700009; x-microsoft-antispam-message-info: 5lMV578aZU5fBQh7hR4eU3BIV8ezbv+wuHJX/UrPD3dSUOEpl/HxqfdiuVa7pSXrfXjICzRuuq9gZ49vXMLbVWSdc2k7VM49qaejpiBORz044Ey+/6s+QaMc2B+RqzubK+/xFZjl5q2PSOZ8FF3gqJh4ZFku1N0V4KXiwbwhncxvfRzaSbX4NDmnpe0sXmnfiVfZiYj2+Lar0h5ItlvnxS+TZA364RczZnJGH1snew4cMWaxUe95Mo/iN+KrpkntlhQn5QOTqW+JBJ9Lvtxdg4QJWT1mIqth3uBJt69c1ABEABxuM/lKEe9KNi0jcXAGGDhTG+cRoYDO6jzT1HBxhUO18EsQE9ReccO1LO/ZWUFMOA/1l7KG4A9Iakg8d4DkjjAfVcUOrhobK8sQX76Xis/ya70A8+4hEht9Ib8b+mwFqw9AIbhrTg/6wxDNr673id7oYwgKBko2+pTNRfKSBwfbIOr51iEWtE5hZeFr82Fukl2erqON1IKVcGbcgFvqYFLx4EB2mmaLGC0tGvQ7takqruNszkGjnCFeG174GNq7vEgoG3nNzsS6J9ZpYBvjQXfbQjwzlkD7TWDIYlJyTzfFNoDS8zBRVwnkjmU7XKswwosYKuvaJZjyA+itpK8nXjUeQd9Eerf7h2E4ziYNJK0IBV1gIUJ1R4kz0Iv4e9ikljTrgl7H6MyE/iq8aicl6w52divfPhsURosQgqmOddfpqXqUFZ8iSEioZwu7dP3R+NIw95vwBs2C/5/qVcPEy5g8kGTqCxVD8e9feLfuA2eL8qQ8jWidLNs0MM0cxfwaFn7Jar+5gQwA4mJ6Do9wU/6R1GgOrPVmKAiYIeHoQmP5qoPGZS5UfzXuruSY60x2HgD3IVrkpr8nt/6nKzHpHvJsmQrgFg76qbf2tkJki6Gcv5iOh9meMPs5Bhkz4xbNsyyTa8gSDD7TkswV2ELeQDpa3kVnTcfeOpE1zVDOLbYmepY6ZZu5vNQGl0+xLcxzykNhNFstuAmOTbzJhmCoKMPdIcwqV3snh3Svvnybfn99c0BOLipDr1DgjUTVBigmo8oNhu+ilX+hQOzI6ACnxCf/GZ7Hyr4SVY7l5HIM7riwr2Rkf+7DyzBi+6EFTaTl7XUUgE/21A4PAL0lTSeV1SZ/CZXjIDb4mfgMIrBh90BQCdMrtjwcoCxMCNbCNghpUssL6Rp5pJZbamY2zuIeYS1oZlfFYb+ovNBBKvB5zZHRQC3S2ZxGkwBYavJcseCBlle3/IHh/zFiseu3WeIUnXXDQRirc9GI8US5U1go3A== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PR3PR83MB0425.EURPRD83.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(1800799015)(366007)(38070700009); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: NcFQbwvMcJIXQywP2wWZhy10Td9OLUhhCr4dBs/JGavgVtc9yzdxrdO+NhsJIRaT+9F5Df/4RtVcbqf6j1zwjJN3bf8XY31GyM4//SHzmBVJFXuEKfoDXy3cWhxkEpcB42Rh2xWfVoKY/XPzIy2sx4AaCUUYKUDkSwQA0qdLY8zMcnDtGKbYJTtBb6HmcRoO2YyIqiYWspTqSmO5R5p4OH4K93VY3CaKkykG0q1UXJt2CPcikFQrh7JgP8YRMGV9+SE35pkhJRKFnjPazyneHq53zU7w0HdWnrLXzfowrbtk5L01Rph8WY1rM70RouSo22ZesYvzHJqB74+bFz692ULQ7BcOuJqEFUjhD/CLApaTuJOYCzHRCX1GfgOj/Zr2ZgPL7KIYUhmdSmfZ2dUKUub/z/8k3g2xST5xtZhqRwMagB46jIS6Tzh8j0J7FQAgifr6r8y32JfZ5MkbFFrsdEZGgXhSxpZipnZaQGYRaiRLn9qjWWGLXuzNZiGyF8gYEpmRlMDJcfMgFfsh/XkTvOLdkktS0OJTyTEWCpwNRb1TcDGbue8P4gpyeNLBGdBwyz+7rX5i7k5cOcRF3LW8OSLxIBgN+dJa35XqD26VcbHm2LMG9tGKjwneCB/t5VEQBucKRCNajqfi3aPwDdtqto6GkhwvMKLuIecQmO1R/g9UXuevGqhBXaIaqlSvxVaDvL2VNMuVGeTj+SDxgcAiZ6ZEsB0EUq8bxj5Mu1Wl6ZgBwihHvnOmnjsijeHul2XJM3ZHW8UGyGSFPqel/Y/5ddU4X8vyg0+9T/q7jGQiDojDjPwqnIe4QjVik4v+ugtf8NF6GGKt/cuM+Ma/wqnf14szke3x/+SETElWdAMjk8e8Km6dH9JNB+kqduLEI4dYv3JjFU9ruvPtbtiLG13WKi5QcwymAhY9EYm/Mhk9baoilMzdz27y9TgukvRDUXlNI1/DWheAqkI3iH3z8LQaH2HNgGVEGnFJCj8jQyHCOdWLlG7rHuXS9QCzu8DlCmzpohPYOI7bM57UQVccd7ptHGrwlQK0hSt8TcpmLCWn0hwPDsY/qxKfX8c6oxWsj2N624F9t+fQ6Bomc50+B6bL3DKlJrnFUEPU5NYJ8PeXQbD8Aopz2Zpp1MuGguP5nPteYFgKCv75fNJCUEbWHHUU5e1pkf6lJ94/g0jIzwgK7y5ugsNgbLbqaGaNiq67cjNuzKAUlWywQ9HB2RypfRozCNlcTGWLGaZy6UV47qR3GLkvPccChmdkEyON9wf7p+GirljHmxdsq9jRFf07o9czfTIsFdMEBPAsdrccU5iNwcpTNoVjIIL7MDS0TUSobe8LgwZTSp4ldEgdQKxnM3SzFRotJoeg4ZLfJ8Twkec1pjRAZXmtgcYrBTUm21ZGzs6fqtCjyED58Mv06/iyCFC1diK+2PLPdIpjItBFNOfFwEB/WksltdY0tzJsCZ20jiIX79n4XWxCeesfz81ye0jJgkKiYr8dZJrpQtUeB9JMFOgNEvLVd0G1T7wfRhOvXGHwXgZ7FsMALMYYE2dqqT4L23fmiDMQZ8Uew96xbM2xvY8I0z3NKZMTYXhBrgulam58 MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PR3PR83MB0425.EURPRD83.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f621738a-48df-4368-49e1-08dc5ff0ee7c X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Apr 2024 21:45:57.7597 (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: CgcBsyV9xi6rXPM3xAppgXv+zqziZom6mb5d6FwinfIXWEtOdXz7caxrlO1/Txv7VdhbTq6N5SdCWZILoFrLpA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR83MB0695 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, KAM_NUMSUBJECT, KAM_SHORT, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org This patch renames functions related to dllimport/dllexport and selectany functionality. These functions will be reused in the aarch64-w64-mingw32 target. gcc/ChangeLog: * config/i386/cygming.h (mingw_pe_record_stub): Rename functions in mingw folder which will be reused for aarch64. (TARGET_ASM_FILE_END): Update to new target-independent name. (SUBTARGET_ATTRIBUTE_TABLE): Likewise. (TARGET_VALID_DLLIMPORT_ATTRIBUTE_P): Likewise. (SUB_TARGET_RECORD_STUB): Likewise. * config/i386/i386-protos.h (ix86_handle_selectany_attribute): Likewise. (mingw_handle_selectany_attribute): Likewise. (i386_pe_valid_dllimport_attribute_p): Likewise. (mingw_pe_valid_dllimport_attribute_p): Likewise. (i386_pe_file_end): Likewise. (mingw_pe_file_end): Likewise. (i386_pe_record_stub): Likewise. (mingw_pe_record_stub): Likewise. * config/mingw/winnt.cc (ix86_handle_selectany_attribute): Likewise. (mingw_handle_selectany_attribute): Likewise. (i386_pe_valid_dllimport_attribute_p): Likewise. (mingw_pe_valid_dllimport_attribute_p): Likewise. (i386_pe_record_stub): Likewise. (mingw_pe_record_stub): Likewise. (i386_pe_file_end): Likewise. (mingw_pe_file_end): Likewise. * config/mingw/winnt.h (mingw_handle_selectany_attribute): Declate functionality that will be reused by multiple targets. (mingw_pe_file_end): Likewise. (mingw_pe_record_stub): Likewise. (mingw_pe_valid_dllimport_attribute_p): Likewise. --- gcc/config/i386/cygming.h | 6 +++--- gcc/config/i386/i386-protos.h | 3 --- gcc/config/mingw/winnt.cc | 6 +++--- gcc/config/mingw/winnt.h | 6 +++++- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h index 4110ceab824..061136efa0a 100644 --- a/gcc/config/i386/cygming.h +++ b/gcc/config/i386/cygming.h @@ -342,7 +342,7 @@ do { \ /* Output function declarations at the end of the file. */ #undef TARGET_ASM_FILE_END -#define TARGET_ASM_FILE_END i386_pe_file_end +#define TARGET_ASM_FILE_END mingw_pe_file_end /* Kludge because of missing PE-COFF support for early LTO debug. */ #undef TARGET_ASM_LTO_START @@ -443,7 +443,7 @@ do { \ #define SUBTARGET_ATTRIBUTE_TABLE \ { "selectany", 0, 0, true, false, false, false, \ - ix86_handle_selectany_attribute, NULL } + mingw_handle_selectany_attribute, NULL } /* { name, min_len, max_len, decl_req, type_req, fn_type_req, affects_type_identity, handler, exclude } */ @@ -451,7 +451,7 @@ do { \ #undef NO_PROFILE_COUNTERS #define NO_PROFILE_COUNTERS 1 -#define TARGET_VALID_DLLIMPORT_ATTRIBUTE_P i386_pe_valid_dllimport_attribute_p +#define TARGET_VALID_DLLIMPORT_ATTRIBUTE_P mingw_pe_valid_dllimport_attribute_p #define TARGET_CXX_ADJUST_CLASS_AT_DEFINITION i386_pe_adjust_class_at_definition #define SUBTARGET_MANGLE_DECL_ASSEMBLER_NAME i386_pe_mangle_decl_assembler_name diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h index dbced12f8d4..4dc90179b9b 100644 --- a/gcc/config/i386/i386-protos.h +++ b/gcc/config/i386/i386-protos.h @@ -261,7 +261,6 @@ extern unsigned int ix86_local_alignment (tree, machine_mode, extern unsigned int ix86_minimum_alignment (tree, machine_mode, unsigned int); extern tree ix86_handle_shared_attribute (tree *, tree, tree, int, bool *); -extern tree ix86_handle_selectany_attribute (tree *, tree, tree, int, bool *); extern int x86_field_alignment (tree, int); extern tree ix86_valid_target_attribute_tree (tree, tree, struct gcc_options *, @@ -301,12 +300,10 @@ extern void ix86_register_pragmas (void); extern void i386_pe_record_external_function (tree, const char *); extern bool i386_pe_binds_local_p (const_tree); extern const char *i386_pe_strip_name_encoding_full (const char *); -extern bool i386_pe_valid_dllimport_attribute_p (const_tree); extern void i386_pe_asm_output_aligned_decl_common (FILE *, tree, const char *, HOST_WIDE_INT, HOST_WIDE_INT); -extern void i386_pe_file_end (void); extern void i386_pe_asm_lto_start (void); extern void i386_pe_asm_lto_end (void); extern void i386_pe_start_function (FILE *, const char *, tree); diff --git a/gcc/config/mingw/winnt.cc b/gcc/config/mingw/winnt.cc index 9901576ade0..a0b5950be2e 100644 --- a/gcc/config/mingw/winnt.cc +++ b/gcc/config/mingw/winnt.cc @@ -71,7 +71,7 @@ ix86_handle_shared_attribute (tree *node, tree name, tree, int, /* Handle a "selectany" attribute; arguments as in struct attribute_spec.handler. */ tree -ix86_handle_selectany_attribute (tree *node, tree name, tree, int, +mingw_handle_selectany_attribute (tree *node, tree name, tree, int, bool *no_add_attrs) { tree decl = *node; @@ -162,7 +162,7 @@ i386_pe_determine_dllimport_p (tree decl) /* Handle the -mno-fun-dllimport target switch. */ bool -i386_pe_valid_dllimport_attribute_p (const_tree decl) +mingw_pe_valid_dllimport_attribute_p (const_tree decl) { if (TARGET_NOP_FUN_DLLIMPORT && TREE_CODE (decl) == FUNCTION_DECL) return false; @@ -749,7 +749,7 @@ i386_find_on_wrapper_list (const char *target) output the .drectve section. */ void -i386_pe_file_end (void) +mingw_pe_file_end (void) { struct extern_list *p; diff --git a/gcc/config/mingw/winnt.h b/gcc/config/mingw/winnt.h index 646654e872d..e02546e8ac2 100644 --- a/gcc/config/mingw/winnt.h +++ b/gcc/config/mingw/winnt.h @@ -18,13 +18,17 @@ http://www.gnu.org/licenses/. */ #ifndef GCC_MINGW_WINNT_H #define GCC_MINGW_WINNT_H +extern tree mingw_handle_selectany_attribute (tree *, tree, tree, int, bool *); + 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); extern void mingw_pe_encode_section_info (tree, rtx, int); +extern void mingw_pe_file_end (void); extern void mingw_pe_maybe_record_exported_symbol (tree, const char *, int); -extern void mingw_pe_record_stub (const char *name); +extern void mingw_pe_record_stub (const char *); extern unsigned int mingw_pe_section_type_flags (tree, const char *, int); extern void mingw_pe_unique_section (tree, int); +extern bool mingw_pe_valid_dllimport_attribute_p (const_tree); #endif From patchwork Thu Apr 18 21:46:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Karpov X-Patchwork-Id: 88693 Return-Path: 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 62604384AB42 for ; Thu, 18 Apr 2024 21:47:42 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2125.outbound.protection.outlook.com [40.107.105.125]) by sourceware.org (Postfix) with ESMTPS id 8375A3858D33 for ; Thu, 18 Apr 2024 21:47:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8375A3858D33 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 8375A3858D33 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.105.125 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1713476838; cv=pass; b=lWPI3bdz7UOpWfekS6LRLP8X1tKpcVkdT9qDCTIyYzH8b7BT8K+pMJHsasbdl7xNuiSHMUIfZUTV6V3mMraaguE/tajvkV+Q7/WGSZpk9cAcsPxL4G+j1VgcWYHJy487JHxiBxCZTnrY9uDc+0zyTLjK4HHKN+3/lvEJFFX1LhM= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1713476838; c=relaxed/simple; bh=0eM1J76vBzK2onECXaJTMKweVgqEidx062GhPuPjfjo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=kJ6YcZsP6bt2hMiJdk9IS9YdpFQVKQpdQWp9AwX2CKLuI80OroVU9eTkTwaPuHbAg3yu5Qe4MfbYwzX9/3juIHcHrHoRHWYbTLQ1vW4t66zpF4WLfbKlTV+wFyQ/1vPAUViObi3k1qtecHZ4KBtuC2WDXqP0VIXesYvjvL/PA9g= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aN8YlRzTSgB0xZNy6JVxqU3QwfbhreDoppwhgzjUhMFLjixhMgiQtDWS1QidpNgBVltjRHZQk60K1hJkT1hRXReAveD2FZQZGz/FiDSF0MRuSWaXfAUTvfD1qbGOJv1SdyC8tl30aC/ibPQhx4+6UDlYDQowo6wm3xQdC+fuxOQi37SWWH1Qlsl7e3gLzEku0nF/63faHd6+FSOb36z/6eX+07DVBZogdLvRLkTtbC4s42e3EoOcRH9FKYaO/yIHUCM5DiSSdqbUppMT7EDuvRd1rzKkUN4/ga2l0spw/if0EFXChbpVOZ2mhlvc1CM/n8/RdvzxaZ/iOEea1lP3Jw== 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=PlUTZgRD7F1kFJakvMS17cXrr+blf9jvUzbupMrubZU=; b=nbYT/cN9jV2eV4q/bLB0GPzoVqVeYI8mytGNV+oHf4lpMu08WikVrSwT5xXEEiZEWK7d0rUZNvPVVgLn9eplRiyrmLm/0XyiMpuKrEasusVAzq7rl19Hav6NicYtJaskv0xLWgSw2TDx/QhvHomdD4Gb1ZKZI8oiM2xwKCAsqV8B1siKe//NPSvax+wc99iJHHpo+5cO3EGoQ3KOSfIEos32Hwa/c5qB3VlzWHyTtckx5Jaz3tyxAmFK3Z+2zTnbKRMKKiGTck9VHXGrrG75hXYJ93ojYFiEEytGl7BxYwABdtfim6VIx98Xhew6+gpHGfZhFxZFbTIAG4zXDYay5A== 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=PlUTZgRD7F1kFJakvMS17cXrr+blf9jvUzbupMrubZU=; b=gD3cs7VDXHllTed/JqPAYuaxkvo8nosMleQPi8CnKfa+IWs6YpU5Q5rIawBLpigkZlhQIuc9Kw8JfzsorGdLq1LwjHDEcMXTagD8Sec3t/36yILJk3cuMjmxBsFkAHtiGP92l3UWS00T4IrOAuMcjC1/T8arS2X8/hwpeRCZSdw= Received: from PR3PR83MB0425.EURPRD83.prod.outlook.com (2603:10a6:102:5f::21) by VI0PR83MB0695.EURPRD83.prod.outlook.com (2603:10a6:800:218::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.14; Thu, 18 Apr 2024 21:47:00 +0000 Received: from PR3PR83MB0425.EURPRD83.prod.outlook.com ([fe80::2303:5667:fa24:79c2]) by PR3PR83MB0425.EURPRD83.prod.outlook.com ([fe80::2303:5667:fa24:79c2%7]) with mapi id 15.20.7519.014; Thu, 18 Apr 2024 21:47:00 +0000 From: Evgeny Karpov To: Evgeny Karpov , "gcc-patches@gcc.gnu.org" CC: "richard.sandiford@arm.com" , "Richard Earnshaw (lists)" , Maxim Kuvyrkov , Radek Barton Subject: [PATCH v1 4/6] aarch64: Add selectany attribute handling Thread-Topic: [PATCH v1 4/6] aarch64: Add selectany attribute handling Thread-Index: AQHakdnxy90bRy9jmEumgLgBUcKuQw== Date: Thu, 18 Apr 2024 21:46:59 +0000 Message-ID: References: In-Reply-To: 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=7edbbdf7-0382-4215-8fdf-996305ff5b5e; 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-04-18T21:26:39Z; 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: PR3PR83MB0425:EE_|VI0PR83MB0695:EE_ x-ms-office365-filtering-correlation-id: 12c0f076-6da8-4cf4-e516-08dc5ff11394 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|376005|1800799015|366007|38070700009; x-microsoft-antispam-message-info: j6g9op8TZP2xwpbn9OA5Kluopp6twTNPo8TSWkYNHaWsXGnlKUhn33DhbGkHesP6ZRtRjcIVoUyaParfu1kEVZ47XyQgO4L/mgv9Qdcb7XH9VVkoF/FajYAiB2j8s5HxHcgAOP+9C6G7mFL5ftOBJj8TNrrRGQRl6GYD2pyiBa/KrwUNs0QRYlIFckGQXUFUi8Dm2iKYpWIiS15W6mRX7ec2cPlrWkAZHMZSXcCw7aRo1x8lxhHBD1qicf9Q58g1MgNZVZyM1Khcv9FiCkZzdrHH/vXst/NF6ahI1d5wNN3dTHj+pIFkPhZ7Xy+e2rbeR19+lJR8wjBZZC/JB2+hx9XzKkoapUk+UvYL7thE/xvhO9dOH9AGIsEg2xn9+8xNG2NBRZbW5K4LyFPa9W8/J2nj62ep0hamCSMqsPKi6Csnt7Dp0rtn/m0olLvuCodVdkNobzpkbUvCET2sBklLvjFiFTJLgHjhSLz3HAGiO0yPce+t+ut0JFAO5FSS3R9wET71wHkZU0X32yLEoejt2b0SsXd2/q/Bxj8c9YjCeua6VXyDkrsk5bbaWF8k7Ni2/PsPqn//AJF0z5/cqLhpYm0TRugHo0/OvH+KlGFD0OLlbGk1wPV40y/Ru+FUmZb2f0hxD/9mvie51/qaHBM2FFeoFOescMOZsC+MtAExYqJBaNyyBVD9T4BZQRHnE/NZP963IPZPNO1tIcuGC5oFgYxmWVcaSBrufLg8XkJeT6rBcu8reFaaz3U06/fzk1KfzB8B9LCGRSo7sFfc67cDAjmet4ne8Uyk1L0Wd6n/R21NIavnVW7BYqTKSP5umGAEDqaoscB4ObvKvCXrzJ+hj4i/Dlc7ivG5qqkzoF5W2DxsRMWIsrW6CaecsCcb/M7Isw4dQ8xNbSWPPNv/7sS7TY5zNwy2ZrkZSExl53Lx+PBZhgqcm2ftsXfExgfXO9a9BPJoUpZY755cP58wkQcsOgvy7DRAskUObFWn572QcBgZuV6vqoFZXM7cQe90FlEjkf1bTFrw+EqlyGQQ3NuO5FWMn9kKClgv2MpR7saNMS4jdPaG7SoRcYqFBNjwLaGkaVailryRvVsEaaGeiaHPKOVuDw72UNRhfOlU95tjfEEP3wWRT1k0PEBxafYv+DOVou1XDxTUl6NrSysQLEaTfPCSMaueeGX24IkoQEkbmp3dQm6zPw8SzOzCYiZ/KAlx7PW5PMGfP4f2yGXZSYeZ0IeCUfKWwNTvJ4zbG0qn655yO2LE9P73Bw+QUh2tiTDo8VhAx+Rf0uGHAGWg38GTbdZ7mCWvgyPwibWhI4iPpCBr5DQxjb4Hb3D5K64jRZgjDELRGfONEhoKndA9N2rY0g== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PR3PR83MB0425.EURPRD83.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(1800799015)(366007)(38070700009); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: htmoh/NBkuSc6+r1HG/VvaKi8ClwC9acMXoM6nz4HXxb0sOVYPr9WXS3yfRBwtn2k2R1nEIlat/N12U4KJo0RgkAK9RWs6X/4LaKk/GI1wWJXO9OVreQeO1tu5nU3fBWFfK73nTDKtWYepZK4HoHMqDG/AfjnNASAmH8HtqlrWW9xSvzzsScbMEw/XwAxCe2j4QkUoYTdBNnaajHXuUZaT63iJA6rQCHtQoaTphUszv0nt0fSSEJhiR69EACLQrnEKP8+OCnfTseCvGC/aZ6RylVYj20XBzuJNiiWtE9MH3Er++QGCcACUzyOwGmdP8mtsH6YipnkVUZjsUEjS2oejPEWGUZnEANuTRHfHOHKLb/qYjIm6hmbanic/ly9WrNW2srLH1qkjW+aTR/Co/aE/hHQDGFjjTbUP9OhQltmoI0yGWnqgq03tr8I0JTLRSWs6VNGGht0bTrZIrciB/k6KIPISPaDIqhc8VJ5akhlwWQYTGpKFrUHaXrGIcufQ9UGyHZ5Ub2vZxnNZ9Itlpib2KZGYC685ro9M2kMyv0Uwomx0GtQwaMzuOmAFoDj+NkgHXP4eFCRqwbIFbM+g7MzdXVugskCC4Pqg2+6tWVF83RSaHZhuiG1qfERXXXUEv2ArDQoob85hGXdZSy+IotNIIa1Uqu6nldLj9pGvhJ/81E2LaiANgDbFK2as2ThZz52m5fupTQ1yALaWrCbP0f8gyR2VQy/bUS+m53ewaL0q+ZnoSaE07bk0g8x2Xvnoxi/OnPno19G0PZxE+sQhOVVsqrFT4JDKdxSzzkPTM9/rQggow55k+lHBceClJv3PmJDU7yAkCBJIqbwatB0XjI05ozzgXnVj8ywxPm7rBfYqGkWYz/ocH9xtwVvghqzb45KY73QZ52QRHNB5hRES9U58+R8Sy2TUWZGCTkCt5YnOosMFxFM9naC62La0rx4SqiXX5jBrXEp0EYPRo7LMrHJS9MeqnJB7cj7fae9BsuXuFhqyoOf2uva42UErkdy0wXr3jVRzZk4jjTV53qi6xviqFevXgpR9HmS8Kw6ButBwm8znx65tf5ONV090KKWoJf8PFuMgqBLzoAV+I4ebrIg3zfcU28Wn/IHpueecB7jKstYbQ6MUBXnLH2611RPU9TgyFa+zX+oT2nDgqQTTDShtoJu2PkXU9w4YykXV9it3fdUJVdkUmxw8V45C0v8h6kEiLg1xHyX7vzV5ZwQYJrZM5gtxh7IxCe/k1NLxXUsyOKrovanJ0rOxwtJay29JZ1OkCoQgsPgwcAep6dVc3OyyxYNbvtt/FRcI9g4De+XWHHQ4Su2xXCCCZmcM0xXejEAIUrQOJBG/Visp6Sd+nFg8HYLLfNMCMuMdOIWLeKoEqLYmIr1vQBOx2uC7G9ATWrF3Khhg0ivKpjoBvS32KQfT9HOMev7faBhf/MEUqjNmWJ/6ZUIlRdozEACoMDag1lYHK9rcZgcUk0lipAcyrdUNwxoh6R4WKCVhNorm7ALTL3G7Fx+a+2qzW01wZIf5MEqUtcYJ2mONzR8j4Hl7/Ci7rnn4olSatCCJpQgoeaNo5g+ec6tD2yW3u+FcIhWex5 MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PR3PR83MB0425.EURPRD83.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 12c0f076-6da8-4cf4-e516-08dc5ff11394 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Apr 2024 21:46:59.9809 (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: rHAaOq26GtHY+IMa9sguXue827lobE9QJF6/rzJ2DNduSGgk7u3zzLFYjLl+U1WPJiq8mkoQTW6j64xCzYiJCA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR83MB0695 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org This patch extends the aarch64 attributes list with the selectany attribute for the aarch64-w64-mingw32 target and reuses the mingw implementation to handle it. * config/aarch64/aarch64.cc: Extend the aarch64 attributes list. * config/aarch64/cygming.h (SUBTARGET_ATTRIBUTE_TABLE): Define the selectany attribute. --- gcc/config/aarch64/aarch64.cc | 5 ++++- gcc/config/aarch64/cygming.h | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index c763a8a6298..19205927430 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -855,7 +855,10 @@ static const attribute_spec aarch64_gnu_attributes[] = NULL }, { "Advanced SIMD type", 1, 1, false, true, false, true, NULL, NULL }, { "SVE type", 3, 3, false, true, false, true, NULL, NULL }, - { "SVE sizeless type", 0, 0, false, true, false, true, NULL, NULL } + { "SVE sizeless type", 0, 0, false, true, false, true, NULL, NULL }, +#ifdef SUBTARGET_ATTRIBUTE_TABLE + SUBTARGET_ATTRIBUTE_TABLE +#endif }; static const scoped_attribute_specs aarch64_gnu_attribute_table = diff --git a/gcc/config/aarch64/cygming.h b/gcc/config/aarch64/cygming.h index 0d048879311..76623153080 100644 --- a/gcc/config/aarch64/cygming.h +++ b/gcc/config/aarch64/cygming.h @@ -154,6 +154,9 @@ still needed for compilation. */ flag_stack_check = STATIC_BUILTIN_STACK_CHECK; \ } while (0) +#define SUBTARGET_ATTRIBUTE_TABLE \ + { "selectany", 0, 0, true, false, false, false, \ + mingw_handle_selectany_attribute, NULL } #define SUPPORTS_ONE_ONLY 1 From patchwork Thu Apr 18 21:48:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Karpov X-Patchwork-Id: 88694 Return-Path: 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 CAB593858CDB for ; Thu, 18 Apr 2024 21:48:46 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2116.outbound.protection.outlook.com [40.107.105.116]) by sourceware.org (Postfix) with ESMTPS id 5ECDD386101D for ; Thu, 18 Apr 2024 21:48:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5ECDD386101D 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 5ECDD386101D Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.105.116 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1713476891; cv=pass; b=Vv8hKvhJz6VW/d4MwCsBq0KJkINZ+oLDYxxe74+43/Jwn6lqOnrnHrKC/lX4VEEMkCTDHc1AGpk/Fze3W9tbpr6AXZtEMDDX9/pBHQHJQTWR7W3LGgfgfYrHEMkyFNJL1hc0WXlqGO77lmjYYLzW6qA6Mk8RKV+dg68KAFVHaPg= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1713476891; c=relaxed/simple; bh=rA8Tzjicg+9am7K+FHhcGSDq/8dMvU8qLABpYt9tCoM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=GdVwpfE9CqefgetVUZGDyfmohgzv2yyXY2sZZn+QkIDKL+or+pmXo5qlvf8Uu7A+oBPZ0OOF/zLwTC3Yo2ruRr+sk3SHCX5BUePexXXeqShwV9zWL5yZXFygQT6yg4Lrnd1r139B2jMV9VtRAK9MXwjRB3ifyPxgxp7zhIxvEw0= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RjbHDVD8UTPdY60gaj/xDq0kCdnvteVNtdfpSng7l9gzCem3HP4E6mgF7TqjXck+9yNeAZHEyPqO0dg5xyb9QnVhFXV/fsOrZoZl7bsBJwCdZNf+j3AeIYkgOPXrFKtO+D9V24J5t3C/CAUPDOM2N35fGbyVVeuU9svC4H+JDnOd9MB/9HB8oUZ2mBWSER6ouaOTter+PsSTCiUzHF0lUhZ9BrBJWkdhq2PKQv9RtoacH+jHT1LEZGhxjU/IcO152JBvlJYCYJuE4CZ5m7ULiz+8ZjAr3bPrmiQzav2NLVgKnlyWLkSM3NzqxoAGrwOyW+gDs5/rfr69pYDiYyBs0w== 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=Oem8EmIK0B/WV0aE79239FBJm4m7GF2ChLgXmZ50Gyk=; b=hvQ3iqJ7Oj1OgU6247nuHm9Ccho+Pfi0avpH/7+v6nmMTaKLoyXznDf1k1qKe++yubEPYgLVO0SlkBJkc3IPdPuI/MRfbE22iiiOK2okxcEvBxYjf4NxWnmIAK9QPdhpLJdgTHu4u/ZANBLq6G6b/YeULUBTmRB4w6hWJQ6QNg+MuHmgy/fiFS7YwKIdgdMFGCEFz+tHQefq2u6uoHjy/C+sL9S+/oo25jS78COggdt742Y0oqfu5P12gKS+y+VOXfG0WuYnVZuOmZxoEGwfCXXdy4xYh21LkZXV3diOsurb93VNw9XB9kvBHtbVo+JYb2mnwod+uS3YD8yy86LpaQ== 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=Oem8EmIK0B/WV0aE79239FBJm4m7GF2ChLgXmZ50Gyk=; b=hoptd/+iJv/PUm/IYtZZPFMW09EWRgRYbAKbkZ+iHUT6pyCvDXPmmtoGMZaw4NYwsOve+wmlpZyhw9evQbAYcMlM4GVDuCuH5lzKuiEgAEvBvQRm05sZo1OtljeASUhI1gQH3cXtKzXliAvVzhgqrKxYbxQyXzFsGk5sWZzIstI= Received: from PR3PR83MB0425.EURPRD83.prod.outlook.com (2603:10a6:102:5f::21) by VI0PR83MB0695.EURPRD83.prod.outlook.com (2603:10a6:800:218::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.14; Thu, 18 Apr 2024 21:48:07 +0000 Received: from PR3PR83MB0425.EURPRD83.prod.outlook.com ([fe80::2303:5667:fa24:79c2]) by PR3PR83MB0425.EURPRD83.prod.outlook.com ([fe80::2303:5667:fa24:79c2%7]) with mapi id 15.20.7519.014; Thu, 18 Apr 2024 21:48:06 +0000 From: Evgeny Karpov To: Evgeny Karpov , "gcc-patches@gcc.gnu.org" CC: "richard.sandiford@arm.com" , "Richard Earnshaw (lists)" , Maxim Kuvyrkov , Radek Barton Subject: [PATCH v1 5/6] Adjust DLL import/export implementation for AArch64 Thread-Topic: [PATCH v1 5/6] Adjust DLL import/export implementation for AArch64 Thread-Index: AQHakdoYSatMVzxJ50qI6vjj4Kv9cw== Date: Thu, 18 Apr 2024 21:48:06 +0000 Message-ID: References: In-Reply-To: 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=7edbbdf7-0382-4215-8fdf-996305ff5b5e; 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-04-18T21:26:39Z; 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: PR3PR83MB0425:EE_|VI0PR83MB0695:EE_ x-ms-office365-filtering-correlation-id: 76307a13-041a-4b94-d74f-08dc5ff13b48 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|376005|1800799015|366007|38070700009; x-microsoft-antispam-message-info: xfW37JUIFSJaUdiRv4Pu1aAOnzm/gHlRfteWN1aGjg3G6AWNbrf3F8WEQCEq/s/ezilBzRyQqYxur+ceJdDv7HvwfziKi4vIpx2YUNcaykxRgA6lY0qgQy6Fk2ghdFal475h088tVk2WKIzS7A2XV0uklaG5iivS95Wb0Nye136+jHnZKRNIoyCUS6z8faXFQ7lyWxxKqPH7Nu6X5ThA08+YtR5HmpcnyQHuUBfpMRpxIURcGRxVOpxWDAo0JR4RGJLsImROFQLcpHoUKVnf7sWEc14KFYxB3/qNO60aaHhJQ26UpXnkrH6mQtzwWB9FhreEGGuRDNeYhuV0gcK/Gk4q9S9MmuMqQO/Zh4Zhu8cCmCRkZhJvpFBKWdA7LVlcgNH87KkeCVd6ZON8b/9UQb0J2amLxkk8iN9EO7TmQSApyFlqBl2yJEt3DM88Fm88iDb1YoN3IO3WnCfTcD6wM+aUEHOsZ4/yRedCMZJCZaxJQtaEucLm+2NzjKbbcHIpcQTm+tt4Co/FQPidW+jIAXrn9iRgd9dh4EGiBzK0K1DODK38aqXMtsjlnoaUkhEnArePYquA3vUSmnw+bCsPvvbEpAYngR99hlL0LEMN9d5wTw0glKbZdu2uitEg267GZD0fUY2Tl6oTs+t0W4Vl1L5qfe6hHhX8FOGStmDdDQjBdAwepXk7MK/kWfiu5y8/s9JRtEw6KTAay8e4pRjuY+CogqUJ8XO3ZVpCZtRRBz22CeS5ws6qMSKEHfnmewqtWEAq/eDSdxth0xc0k0t20l5+5NtBUnfWDZLghWSiLiwi2ZwniDTrbd4D5R5wlnjnCZGqcgn+Ewr2iU0FXpPaZzTH5+eVQ3VdRoYQhpxjlWQY/5CZw0PYBQMhGS3jkoq4IYifVfO36N96WC+ykX9xecgqFgKSoAKs4TtjfoPzmPZpRTMUmP9dIAeawCY67+7kznzQyIJvZkRigFc1dBYF+CsjQFsEwzQRmA+otEMLZWAhAe/ZsVban4ogTPQ8OF7fsCtzh3fB6NLr+7Epw6tpnYrtglD8hke0PynVtn/wzgXtfvOSInOTmAi9wYt5l+cQnmS8wDmMM6TDCpa6bMhJL5Skpa1I+o80JP3Ix5kVbKZmlXM+ulPycBGAVEH01FiWsrekrv2tduwc+98M4DEpPfHhcqR0QP7gD4z5PbUm1bWbf6Vhg/YITRcyOg5p84NOV45NaOzJTDY33tPaTj4O+FvUAsQ71BDjZVC2t03w7n45QYRUpu9XrHVCgHgxdKmEDZYHtCzBtMmphG7CKY1Y3Epnfj92enYuDrbSdffzCeD94/52sUn4LVfdLO0I9HIcRGC6MNQapr4iSZlExBD33Q== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PR3PR83MB0425.EURPRD83.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(1800799015)(366007)(38070700009); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: 5LEqYSw0AaOzAYuKJuaV8CzA8zizBdILvfEn17Zk2+6DMn0b4h9Xo5pnViZlAAbRfL/4zKObxIfpetEmD4MnOTgZzwoOFX1EAtylm/XZJfGlmeIr8LiyARtBsd1rEkL0flb83G09S1S0skE9Fwl9G5+vuzEr2mhN+pX2uHZKR+2OFVi074xHoSac6yYNVred75g+YApbSnEsNgfzggsIPahXQeScAtHh7eLpRiFNH619k7fbEn4zy+yb26insojkzGTL3mRoqV1YHyZ8XNVYqlB1czMbv9pP6fZ+fZXUdGhd8loaXhDd47j4WkDA8uCvQ4TTiE59DrhqV+IUhpdWXA+98dhuNobnDBhke6MQVqV2TOlu+nFJe7S0aMAE+715oQya/6nm0sh/B4RD7AXda0rTKj0tl8T1eJ7lCvabnU2iX6Mi7Ep3rIkKCFvkciUAtvmZe2hsolkslX/LHeOvlaUON/EX8lMvodFCBfOPxUo3pBlTozdQl3nzUK3Xk8LBSx8NhQpgxPAIpmjW0Z48VO4RoJIcFvSDMxuBawlllDVjXmcgcliUKYnYmHv0OEJWYh8XzuUa2NVpfn/sJN+x0S89gp+qNXGIPwu0vsF06HSwMxrukahYRhszRzFYKUKrQi1rBSOpHOoOR45a7tRWXfVh6m/Xfn1LKQ7tqZdftMj6etwlBbzE5oyNTw+BuwHIoeRqqWStK5h2tMq1BkJlKOb0bH159j5qurUZwTajKqgCjix7wmDLyhSJoiA5ZkGOnbQmpHN0ZWMyAHKbeG/a7Gl/wAY2nU/Eq2e8SdyT47r1+IkFCAVJdunHPdNgcuaeD9Fss5ZSGprgHkL3zI2pXj8kHdsiX1I/ZQSYapHoE49RO4gpM4rN1DB6TNM6nevGeHOnoM9h5718DKtdsRxUKNca1Spe8JJTjOkqZ37qQ5f4WNvj7dlN1GQmSBCcUiuW667CjSj0Ie6hMHRTelaXgSNNU7gV+QnFrgLfdaA7cesxJiqKpGhWYRflwJNm4FMbJden3GQ9aFKtyDVE1LrbzsTQ3DNrzKk9h5fsGpGIWkWl67UkBEvpxhh8yo17WqMlXEk11mkPHXhBSmrTSarSHKjBU4GU6pdxn8Lhli/R+oF1p+HFwhqEZgH032BIiDjzOBBEYDnMKhkdoyhegRzQ9zk6th7UDbHXXH18viYyFwYowPyn2BZOHy783P1sDn+uoqTChP7lfrEcVdAjLu8SUm0ImiiotgkBQacI9n+HSqBl9Of7OxXLI12TZTYTRQgnr7c0STyO4lzwkhcTRAfJa8MupUBlQrDnE07zz2UWANQbt4LB1ytr0ZN7EzqRT0JWQs04X9HGSpa7qzRWQx/VBpP1S5xDf9BiRfB4mzUJT3NSS6wkgasgArrGIjGPG+4AKaXSd6VyGmV5xGtzKUKGhvUDxM5WQHhuv6mSVS4YJSsMK9cRQ1wnnA0KzS4QNmT9joCK9RuViJP8fYtT6lQ1paZWyQN+Mh5udvikvLTHDdZYxPUwX6nWCa89PM9PLy+uZXXnkkrIltnbzNFjS5cmVXtgZDles37SAs91DaHG3aqotHo3DVn+ttJA06uo6AX1 MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PR3PR83MB0425.EURPRD83.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 76307a13-041a-4b94-d74f-08dc5ff13b48 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Apr 2024 21:48:06.5970 (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: rSBLtCYRmYWC8H3Tkl6AhGEmpB7RH39c/hJgBi8Lvd2TsBt5drD53WENI8I0GkkpQTBVU/VLPXdT4XjcDf7Oog== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR83MB0695 X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, KAM_NUMSUBJECT, KAM_STOCKGEN, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org The DLL import/export mingw implementation, originally from ix86, requires minor adjustments to be compatible with AArch64. gcc/ChangeLog: * config/mingw/mingw32.h (defined): Use the correct DllMainCRTStartup entry function. * config/mingw/winnt-dll.cc (defined): Exclude ix86-related code. --- gcc/config/mingw/mingw32.h | 2 +- gcc/config/mingw/winnt-dll.cc | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/config/mingw/mingw32.h b/gcc/config/mingw/mingw32.h index 08f1b5f0696..efe777051b4 100644 --- a/gcc/config/mingw/mingw32.h +++ b/gcc/config/mingw/mingw32.h @@ -79,7 +79,7 @@ along with GCC; see the file COPYING3. If not see #endif #undef SUB_LINK_ENTRY -#if TARGET_64BIT_DEFAULT +#if TARGET_64BIT_DEFAULT || defined (TARGET_AARCH64_MS_ABI) #define SUB_LINK_ENTRY SUB_LINK_ENTRY64 #else #define SUB_LINK_ENTRY SUB_LINK_ENTRY32 diff --git a/gcc/config/mingw/winnt-dll.cc b/gcc/config/mingw/winnt-dll.cc index 349ade6f5c0..294361fab4c 100644 --- a/gcc/config/mingw/winnt-dll.cc +++ b/gcc/config/mingw/winnt-dll.cc @@ -206,9 +206,13 @@ legitimize_pe_coff_symbol (rtx addr, bool inreg) } } +#if !defined (TARGET_AARCH64_MS_ABI) + if (ix86_cmodel != CM_LARGE_PIC && ix86_cmodel != CM_MEDIUM_PIC) return NULL_RTX; +#endif + if (GET_CODE (addr) == SYMBOL_REF && !is_imported_p (addr) && SYMBOL_REF_EXTERNAL_P (addr) From patchwork Thu Apr 18 21:49:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Karpov X-Patchwork-Id: 88695 Return-Path: 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 583203861870 for ; Thu, 18 Apr 2024 21:49:38 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2100.outbound.protection.outlook.com [40.107.15.100]) by sourceware.org (Postfix) with ESMTPS id DAC47384AB42 for ; Thu, 18 Apr 2024 21:49:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DAC47384AB42 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 DAC47384AB42 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.15.100 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1713476947; cv=pass; b=D9PTEA2BAvILboS4uADHDEMJpfn19rjmiaMqselfr7Dk3OTnJ24jNuA5Ymq7J/wt1P+unt/4Hc2D01TU0qhbMq7kdXAgw3+mXaBpCEfF2TtFdiOGfWnkZbsA56FecG3l3SAcAKG3sCSeglVjvIYx65KspzumI5cdMw1RhFWfdj4= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1713476947; c=relaxed/simple; bh=QwH46wzk/dE4LOApJtCpIE3Xq9j/G3ekiEz9YejC93g=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=lFWD8uIx1ncx5xMQTjbIv3BKBvvwD9pNEwK2d9Ee+xNrCcKCYwB9RM1hNurrQzZH64jbeOrU0WdDZHpRu3IeZmniUSbXVvmslm4cOzC/1L2xt5e+ABrN+MOgSSf6x9+NT5OhGDGRBaw8lf5vG8RlCLh30yY52X1pUTo8MEdxJCk= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FZXqO3i2prIq1ZySg8K0V40Kjd/IyzUzDUvaCsdXrRmv8wkR/Ee9AXR6cM3CO57mDEyDVax0hdDwU1bHpVGHVYnEEMOp+dq+dhI7xI5ej9LupWJHCymqZXNapyNVHEhoiO1qhEy1klwrblQU8botmbc3P34CMxIwtxESG9INZn4hAC9LPMUKdcsurUcidnzHpE0JJUJWiLnZyyfcqcvZk+Ev6PT8UBdt9T+/hzCvNJYsY1g1T8KvImRYKCkooCq830K4NV5ydnxmnQ+xya9YPfoZBo52VcDH5w9n2I1VoVlzjeC99uXRr7GsCBxufEXlylq5v7eCE6Qn/LJzanMa3w== 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=WF4Ojr1HevNTzlRIQ2GKaaSBZVrkaGdt+UUbrqo/zxY=; b=fyYfLFcq9UQOsSAHxfQ/NaSuNn3Loe+T26rgM0Rpfa/QhwWRc1vKj2Dnly7l1ToqhjJscw1IIBZkvu/j29Ohd/sLxDb0Ws19VB0mTu8gwMgGlrTcEKVfPiqctaWrSNazr37AH1pzEXxi8gRDn45+17vRgf8lIIFIL+B5GMZU4oeZSI7KumkCRqywjXD9d7hvMIZHVqjJIf8FsdsF03fDDLSWy60Qhvt3oxkn+0r8MDr96CLJZ0jy+BpNoBknu0vRKg/3duwG/IohyMd7N3DI8aszKs5A+dGusIhC1dEcB67c82s9A4vyk4G4tpUqhgBF8g9MlNXrP7a7pbn4Tu/Cyw== 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=WF4Ojr1HevNTzlRIQ2GKaaSBZVrkaGdt+UUbrqo/zxY=; b=gV0sDPGOuEY35JALMZ8aQ1IfU/setuuVAwRAiIkqGTmZiZ6Cfr9jJamVZNp8dwyLPfR7sNq4yKQKxIZjQlN33nLrGEXM2T3IFQzQRZRjG/SZl+QfC9Sln0DadpMDlYi889MxPWxqQydRcAMxp7ToZTDSYYmpkmmLplt/fbIdzdg= Received: from PR3PR83MB0425.EURPRD83.prod.outlook.com (2603:10a6:102:5f::21) by VI0PR83MB0695.EURPRD83.prod.outlook.com (2603:10a6:800:218::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.14; Thu, 18 Apr 2024 21:49:00 +0000 Received: from PR3PR83MB0425.EURPRD83.prod.outlook.com ([fe80::2303:5667:fa24:79c2]) by PR3PR83MB0425.EURPRD83.prod.outlook.com ([fe80::2303:5667:fa24:79c2%7]) with mapi id 15.20.7519.014; Thu, 18 Apr 2024 21:49:00 +0000 From: Evgeny Karpov To: Evgeny Karpov , "gcc-patches@gcc.gnu.org" CC: "richard.sandiford@arm.com" , "Richard Earnshaw (lists)" , Maxim Kuvyrkov , Radek Barton Subject: [PATCH v1 6/6] aarch64: Add DLL import/export to AArch64 target Thread-Topic: [PATCH v1 6/6] aarch64: Add DLL import/export to AArch64 target Thread-Index: AQHakdo4qVa7NUNdHUCLYGVXx5V1eg== Date: Thu, 18 Apr 2024 21:49:00 +0000 Message-ID: References: In-Reply-To: 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=7edbbdf7-0382-4215-8fdf-996305ff5b5e; 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-04-18T21:26:39Z; 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: PR3PR83MB0425:EE_|VI0PR83MB0695:EE_ x-ms-office365-filtering-correlation-id: 6ee267d3-63f9-43e4-9eb7-08dc5ff15b3f x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|376005|1800799015|366007|38070700009; x-microsoft-antispam-message-info: QURbZ5PAuh3hDAWid50N2Xr42XGWeK+43s+O0GsUmBUMk51E6ajVEtuJni3kWKe2CXwrycnhIvanLvgbXhD+eqaS6/zKDTz+dDCTS2s4U8ZziLDyGuXH5PWHQPvpIWur1TqvcvDkzT75tlkW7Joie4CnOhUe+AXdvg4evT4i4VM/PuUh7+Rb2wGMIVgyNKCSfZPg/YSkKyhJ0he9N9M915epDaoi75OX4H8RwWo9f1W9kIshUzVSaiTKG3t4z2k/ijA25EqN47dFopWKIYSky1LXb1saglDuh2jiU20p/ke53MKGn7fNSnaLJAv4UaqRI5KHlagr2ciCxi93RxbFnZKDW/QTVYRuWD0/rKUJkN0HN2A7V0nOXxeAWZvF8HW2FV7n7WU0pNJ5Wf/LsbVg9LAxJfTxwnSw+Vzb3uEQhiz1oMr1Yallaza58WW7h0a/gJ69XfOj87Af0rgB5DQD0yvN2PGbXkqb7FArnsNH6B54FHc7fBIjUkd/0lZsDGE7omZ6xYR0cj3FEjxBw0iGsduZhfAGYH7lah11eyASD0ISzGvtUdNZJjyn4LzKdCnRC13tJ9eii9WHYZHUCyByOdapqw9GyGJoDBjxmbxZGsO24JbtopemEynNlsMg38Y6PYUlSlwQx0o3ZnA9rsNICaOb0zIkVI2uHIP8wdwnP59S4gaf2uKXQzFzBN0oaH7+g3G21Gu+kS/qSRp3h65EQF3BMvgIkMlCtKursAsE9ep9YjQh8vS/ga40JlKq/j7/7Blc+ImmHtqRUnCp9ycx/wLqAPFjXR23y6a5hVnzTdyBmYLEkJtx7D/N0xoLqoHPsHE8vcN3gZn5CNdDSP+vJMi4sch2r9eu8np+FyAp+CutaQ1yM/uZCgke9rm1EJ1owlCExT6xhAgyr0zFkqt1JIexvv9Et2Mag3ZCnU9sN+zsmJOUDPlODCF8x7wiOCCG2Wz++Cd3lY1zWGQ21LAc/lR5FSXWJfuXW2bsn3PrUETaEAoPTqsPXbztANZvlDGooAsaHTFFcunnDR6hg7HMaPO4HjeC2FsJHiNDrQGdYodr7COnpmFCFsLxnXLXll0n7QRof/A6XEuGp/1M+VJhIUyHfIFznw8PbgoBwslcMKvovaUhhJdFirBCUaQ5WdEDHmVnbtoMhsuejlb1wm7GJGDReAhLAmdGATfnSVePV5ZpZIHyY52Qgpct0Ya2nJus/et5yNMEg7LCpeuTfbQSZ+zkvFgOYxkJoHuaUIp5QebHWt+6VTIhlFIvMgCqUnAPt8OX4UKfZUcpTJFSOZbSaMAh4h4S12In4ISjm8VHl+evf2da78iTjGrCRgTmgzFdzJDyRRKeZYo35hMMHzvWng== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PR3PR83MB0425.EURPRD83.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(1800799015)(366007)(38070700009); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: ysEZy8J4Vbxc4pLl/gx0qXz9ey7Z4vGkUbnk/LLlnkAsFYdfPEA9wmjeG1+SSXtjWsfRASurtVgb6nCHt1obgEDK+oKRlSNMbPzWMOmO9EymvrqFgW38I92r4g5MzTgZvCKec1YAqYfe/bmyAcRH9+2orWHI+4hvwW5yDWYbJk2/hGHQx3v3Vgbt/H8dscPI/xVWGvIN0+IIyg1OLxf2HX0pF053+jGdY9Riq6ePeKASu8A05UoyplPoIRveYNfModxf9w215G3xKBHzDcOAH/AhP3Ukf6Qx8gR36F9Biwh7pG/yihhXkVb7YRS/Jwj26ZzJNZEBO9g5WokgYcIjRcKkzpc6SI2m5GMHu7ukXTnAtdiMLVaEzyhKpY/AQQPoYaRwoSS0AlxzV8t7sXeKMRKizVNtja/WLQKJ4vItIZHCZjYuZT7qrnPGoyG1YrZM3owfppnmXeKZ/wnqUPb4lU9mgbEcErtLbn89AkBbINnnVswmKaAcb/JxQKVFHjZmcGCWhxpTJf/O4Qs2OpcnQhBHyHIyYzn+bVrGD5Gt39iQahjrXspwI4L9/aFNrYA7B2p3H46G1GSJYHqxHSeQC78lyJOb5A8evyLR3ZyIlpXEiiIz5sjIUQJ2ZWUdb+8gepuF3S/9yy6hsUFamm47v7f9vxRG/h7kPXvHPNwf16I6JT7ZM0vTieg9ZYSvZP5mVtwD+Uh+S06SqWlti3cpKvmcWcT7EcIml743tKoZ64KkNyk3L3S+BtNqojvlc/nT4sOXlvNDgjeqSdg1UU0xxICXzFLSd324GU5tO11gsKs0nOA6rSzID2yfMM+TvVP5Dp9StbJaLlbFEccSyIPl+NVWHO8KdR2Tc6w1TX+hP0bfnKWhFGbJshSy3A6PGCyowCyv1kMVPVD+BnpsDpt77C3bkbueFvTZzCzUC6hZMDNY9F2mApvAqkpttsHGpO8cx4Ei8OgUTQFo58tP1hmsTSaxRS64gCwWZYrgEeH2AktWgkAIsYt674jjihOOOJ0iYvb8swGC4mYBSzNsvq7MsoOOnYAaY2ES0I8XYPE+PyG3RuEWL6QhFfOX1+CCEWamA7aQNFqkcas60K2qNYshrPgqqqLPw5ApAA1JARaj9OeNRa3c4j7npxYCatW83y96k15CUvic/sqg3k6mt3ln4nAZOZkN/WAvfVwpKUtf/I7k6YTPKQ1wXYwzMcBj4f9oFIThf4M/LVA0fxWjiaapipfrcbsymM2V+A6JnI1OEOpg8KnPn0m1CfiCyfMdiHFzY5kbNoHKXT7kl/nGV7MoODOz7pIWqIqbMHeLBKqrm3jMvYGVzlWsJXjjVCT6ytovn4LkYY1LJXNj0eDSjJ0CMV87Graqzh3ugUBMONfFvmvA/17LbTJQDxBAU5Qr7zLdRkppDq2pNfnvgED0rH8lbubWh4F08xocceGqZf4jRMPjJHbL6Dvny2Vc1zviYjVbu3Fl92oX00ySCHLpXhHHfHFf9cepkJCGZ1t40Lhlk/TJVk4xtORxcUW8cZ+S0kAt+RMAue9rQjK9Gxkji35+UeLZocuA51R8EpF7gSotpD5GW8gJlL8pmAs3LyrDO6Vu MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PR3PR83MB0425.EURPRD83.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6ee267d3-63f9-43e4-9eb7-08dc5ff15b3f X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Apr 2024 21:49:00.1928 (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: GHho7bRigCX5yicLHv+D0uyPFET7K1gFGDyyUaU44pRZkJ+75S09XHmQietDCwdbLGHaWeEwlvjj4xy2799KDA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR83MB0695 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, KAM_STOCKGEN, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org This patch reuses the MinGW implementation to enable DLL import/export functionality for the aarch64-w64-mingw32 target. It also modifies environment configurations for MinGW. gcc/ChangeLog: * config.gcc: Add winnt-dll.o, which contains the DLL import/export implementation. * config/aarch64/aarch64-protos.h (legitimize_pe_coff_symbol): Declare a MinGW function for expanding a symbol for COFF. * config/aarch64/aarch64.cc (aarch64_legitimize_pe_coff_symbol): Add a conditional function that reuses the MinGW implementation for COFF and does nothing otherwise. (aarch64_load_symref_appropriately): Add dllimport implementation. (aarch64_expand_call): Likewise. (aarch64_legitimize_address): Likewise. * config/aarch64/cygming.h (SYMBOL_FLAG_DLLIMPORT): Modify MinGW environment to support DLL import/export. (SYMBOL_FLAG_DLLEXPORT): Likewise. (SYMBOL_REF_DLLIMPORT_P): Likewise. (SYMBOL_FLAG_STUBVAR): Likewise. (SYMBOL_REF_STUBVAR_P): Likewise. (mingw_pe_valid_dllimport_attribute_p): Likewise. (mingw_pe_file_end): Likewise. (mingw_pe_record_stub): Likewise. (TARGET_VALID_DLLIMPORT_ATTRIBUTE_P): Likewise. (TARGET_ASM_FILE_END): Likewise. (SUB_TARGET_RECORD_STUB): Likewise. --- gcc/config.gcc | 2 +- gcc/config/aarch64/aarch64-protos.h | 1 + gcc/config/aarch64/aarch64.cc | 37 +++++++++++++++++++++++++++++ gcc/config/aarch64/cygming.h | 19 +++++++++++++-- 4 files changed, 56 insertions(+), 3 deletions(-) diff --git a/gcc/config.gcc b/gcc/config.gcc index be2b20a155c..dce3a422daf 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1280,7 +1280,7 @@ aarch64-*-mingw*) tmake_file="${tmake_file} aarch64/t-aarch64" target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc" extra_options="${extra_options} mingw/cygming.opt mingw/mingw.opt" - extra_objs="${extra_objs} winnt.o" + extra_objs="${extra_objs} winnt.o winnt-dll.o" c_target_objs="${c_target_objs} msformat-c.o" d_target_objs="${d_target_objs} winnt-d.o" tmake_file="${tmake_file} mingw/t-cygming" diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h index 95972556c56..996acb60d61 100644 --- a/gcc/config/aarch64/aarch64-protos.h +++ b/gcc/config/aarch64/aarch64-protos.h @@ -25,6 +25,7 @@ #include "input.h" #include "config/arm/aarch-common.h" #include "config/mingw/winnt.h" +#include "config/mingw/winnt-dll.h" /* SYMBOL_SMALL_ABSOLUTE: Generate symbol accesses through high and lo relocs that calculate the base address using a PC diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 19205927430..7e28b5f0c08 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -856,6 +856,10 @@ static const attribute_spec aarch64_gnu_attributes[] = { "Advanced SIMD type", 1, 1, false, true, false, true, NULL, NULL }, { "SVE type", 3, 3, false, true, false, true, NULL, NULL }, { "SVE sizeless type", 0, 0, false, true, false, true, NULL, NULL }, +#if TARGET_DLLIMPORT_DECL_ATTRIBUTES + { "dllimport", 0, 0, false, false, false, false, handle_dll_attribute, NULL }, + { "dllexport", 0, 0, false, false, false, false, handle_dll_attribute, NULL }, +#endif #ifdef SUBTARGET_ATTRIBUTE_TABLE SUBTARGET_ATTRIBUTE_TABLE #endif @@ -2815,6 +2819,15 @@ tls_symbolic_operand_type (rtx addr) return tls_kind; } +rtx aarch64_legitimize_pe_coff_symbol (rtx addr, bool inreg) +{ +#if TARGET_PECOFF + return legitimize_pe_coff_symbol (addr, inreg); +#else + return NULL_RTX; +#endif +} + /* We'll allow lo_sum's in addresses in our legitimate addresses so that combine would take care of combining addresses where necessary, but for generation purposes, we'll generate the address @@ -2861,6 +2874,17 @@ static void aarch64_load_symref_appropriately (rtx dest, rtx imm, enum aarch64_symbol_type type) { + /* If legitimize returns a value + copy it directly to the destination and return. */ + + rtx tmp = aarch64_legitimize_pe_coff_symbol (imm, true); + + if (tmp) + { + emit_insn (gen_rtx_SET (dest, tmp)); + return; + } + switch (type) { case SYMBOL_SMALL_ABSOLUTE: @@ -11231,6 +11255,12 @@ aarch64_expand_call (rtx result, rtx mem, rtx cookie, bool sibcall) gcc_assert (MEM_P (mem)); callee = XEXP (mem, 0); + + tmp = aarch64_legitimize_pe_coff_symbol (callee, false); + + if (tmp) + callee = tmp; + mode = GET_MODE (callee); gcc_assert (mode == Pmode); @@ -12707,6 +12737,13 @@ aarch64_anchor_offset (HOST_WIDE_INT offset, HOST_WIDE_INT size, static rtx aarch64_legitimize_address (rtx x, rtx /* orig_x */, machine_mode mode) { + if (TARGET_DLLIMPORT_DECL_ATTRIBUTES) + { + rtx tmp = aarch64_legitimize_pe_coff_symbol (x, true); + if (tmp) + return tmp; + } + /* Try to split X+CONST into Y=X+(CONST & ~mask), Y+(CONST&mask), where mask is selected by alignment and size of the offset. We try to pick as large a range for the offset as possible to diff --git a/gcc/config/aarch64/cygming.h b/gcc/config/aarch64/cygming.h index 76623153080..4beebf9e093 100644 --- a/gcc/config/aarch64/cygming.h +++ b/gcc/config/aarch64/cygming.h @@ -28,12 +28,18 @@ along with GCC; see the file COPYING3. If not see #define print_reg(rtx, code, file) (gcc_unreachable ()) -#define SYMBOL_FLAG_DLLIMPORT 0 -#define SYMBOL_FLAG_DLLEXPORT 0 +#define SYMBOL_FLAG_DLLIMPORT (SYMBOL_FLAG_MACH_DEP << 0) +#define SYMBOL_REF_DLLIMPORT_P(X) \ + ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_DLLIMPORT) != 0) +#define SYMBOL_FLAG_DLLEXPORT (SYMBOL_FLAG_MACH_DEP << 1) #define SYMBOL_REF_DLLEXPORT_P(X) \ ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_DLLEXPORT) != 0) +#define SYMBOL_FLAG_STUBVAR (SYMBOL_FLAG_MACH_DEP << 2) +#define SYMBOL_REF_STUBVAR_P(X) \ + ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_STUBVAR) != 0) + /* Disable SEH and declare the required SEH-related macros that are still needed for compilation. */ #undef TARGET_SEH @@ -59,6 +65,12 @@ still needed for compilation. */ #define TARGET_ASM_UNIQUE_SECTION mingw_pe_unique_section #define TARGET_ENCODE_SECTION_INFO mingw_pe_encode_section_info +#define TARGET_VALID_DLLIMPORT_ATTRIBUTE_P mingw_pe_valid_dllimport_attribute_p + +/* Output function declarations at the end of the file. */ +#undef TARGET_ASM_FILE_END +#define TARGET_ASM_FILE_END mingw_pe_file_end + /* 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) @@ -158,6 +170,9 @@ still needed for compilation. */ { "selectany", 0, 0, true, false, false, false, \ mingw_handle_selectany_attribute, NULL } +#undef SUB_TARGET_RECORD_STUB +#define SUB_TARGET_RECORD_STUB mingw_pe_record_stub + #define SUPPORTS_ONE_ONLY 1 /* Define this to be nonzero if static stack checking is supported. */