From patchwork Sat Jun 8 13:18:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Karpov X-Patchwork-Id: 1945477 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=microsoft.com header.i=@microsoft.com header.a=rsa-sha256 header.s=selector2 header.b=dYNS10hT; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VxJY04TNGz20Py for ; Sat, 8 Jun 2024 23:18:28 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AB8193857000 for ; Sat, 8 Jun 2024 13:18:26 +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-am6eur05on2071e.outbound.protection.outlook.com [IPv6:2a01:111:f403:2612::71e]) by sourceware.org (Postfix) with ESMTPS id A22403858D28 for ; Sat, 8 Jun 2024 13:18:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A22403858D28 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 A22403858D28 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2612::71e ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1717852688; cv=pass; b=VcHJprq8BzLh7MgF2dFY3fJCK6ukYi2oC4cu1vP14wyOt5BIhIJhoknbtMUDc8Tp31ogkavKAJGdkRBhP/cx37pCvUfZ5JMnQDmmmdM7Ro2kI9JZcU/3M268yEKNtn+S1YfVWunMTBY+YrmLI4JbElZspb6r+55ZzTgVpgDRx+M= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1717852688; c=relaxed/simple; bh=mbYJnun67xyVzfYTkSqsMKjyf3j4fGbYoWCoWSLt1yE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=dgqdfpM9TMLM1jgtkyexNr2Btyddw4NcYP2Tsc2vTTYX24FtwoP19BqTMy+8b6T6VqV2Ihyth4K1yp6itOxpdTFotLEQHc5N67SKqwdc4x+sZ/pC6ciPxj2akJ6eCgZDkj4I6ulH0+L+l+VsP+pJtims8jWM0mSR54D8G/t1FA8= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lP1pPNYwRuPj0PNgZnYnzqvulXEzQGWVipQ2tG4ID/QrS8PCwG+ugEuVcNk8LsPQKYNAjubsEJNsREFbI966oaHF4I036tsLUhSWZ9k+/ruQ75wzw3CsiBYVZLkSLZz+cSmTcucOEkEzEqCbTvJyJmq53MYvRtpN+j2dTzWVGTiBgl7BEzwXe9jlNnwqVHKTLACpEPlFx6jaTS9+vq4Ry2nsNIMstV4XFYnO4b+k/4rnBjD4fFWhofzYE7Jedt8v0o4g6PuV0qGtD2Nc8kvJdHKk9AkEeytSWo2iHGaf4e3pD0qBc9QxuGvZuFxY7VCR1abj1lU2TUrvDV7f1OSJPg== 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=aOv6k488kw6aOdSo7YgLRrjpzvLoKuK9SbhEUqZQK5A=; b=gejaPIqDSCM0ECj0zWwdaxBAXc3FXZpmasvMatnEkDgJhJ+QakjGcv7JYIwd0tE1FQpo8DuuMnDUNUYHEhqTV2DnMVy4jP2k3+Zek/i0vNfUqE/fqYXEZapjejPWsSlPnu6FBV42W2kKQOLBGkIdGSRPqIze0vCIocLC99wEjAQHuSyQycmI6lnk1IRmi6TAPa13cMXXRXuJxuAXuHoankygnqK1MxKExflUjxRFROiTLjWiYzHqBc2uHG+hmsHHayCtf6/G6Ouaim9XXf1tUp+pBv4tgJn6FtlMVdHZPW3ZYPyRTbpaECyRpinIWQ8MolHOcqU8YrjV6FrmnqwKUg== 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=aOv6k488kw6aOdSo7YgLRrjpzvLoKuK9SbhEUqZQK5A=; b=dYNS10hTzGrxAHpzoXNSA7M07DUXZ0KXvkehjCYCdIR9eM2HxoatKaP/g05q/0LJRuuvHhqw3Z6Hh7rWkVmdGwZNE1YdYUviE1eA4AArAooX4DRkOh68xPcMoWDyd0hVvmQ5sQqWLvwuLr2w7zf5a3u19LbR0o9TKUE3/qFMD5Y= Received: from DBBPR83MB0613.EURPRD83.prod.outlook.com (2603:10a6:10:533::21) by PA1PR83MB0752.EURPRD83.prod.outlook.com (2603:10a6:102:489::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15; Sat, 8 Jun 2024 13:18:03 +0000 Received: from DBBPR83MB0613.EURPRD83.prod.outlook.com ([fe80::399d:9bfc:1209:af10]) by DBBPR83MB0613.EURPRD83.prod.outlook.com ([fe80::399d:9bfc:1209:af10%7]) with mapi id 15.20.7677.009; Sat, 8 Jun 2024 13:18:03 +0000 From: Evgeny Karpov To: Evgeny Karpov , "gcc-patches@gcc.gnu.org" Subject: [PATCH v3 1/6] Move mingw_* declarations to the mingw folder Thread-Topic: [PATCH v3 1/6] Move mingw_* declarations to the mingw folder Thread-Index: AQHauaZKJZG883qb50ynNtPsRxlVBg== Date: Sat, 8 Jun 2024 13:18:02 +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=4cf5d1f9-3011-4a77-8066-ab2b27e02d44; 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-06-08T13:11:52Z; 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: DBBPR83MB0613:EE_|PA1PR83MB0752:EE_ x-ms-office365-filtering-correlation-id: 3f037286-137c-4dc6-edbb-08dc87bd6d17 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|366007|376005|1800799015|38070700009; x-microsoft-antispam-message-info: ucoML5bciYlcYaPRAu4TpVJ/urxq6o0sv1v5GXQoSJoff/3gHd2SmgrJNwofEbarKuXo/MG7D6icUQPHbloIWhl1PhfJAyCSzGiHYo1pHMOsF0EFXAkHK5aMRHBBU96VhIdL+Qd+YcZS3H3kIbGABhhq6ONL1zuswlyx+hqRqlG0qaPpZCR5OswxjVFaKRV1RClX/KOD81yBfxMnzkgyoOFnsb85SUGwytAk6U2dfg1FT3XlSCDRdSEwz064SWWAqfwVA3mhsBzXmBzZzX9zOb1zXcon7cmsHlgi2bCmxnMgBlYnJE2B8jRRmiHNM01F+PBkWs/OYDlYyYYQUhXXDE6HVxYumARSS0aDS7L6qcBj8lB6xn2vyTh9HD0tIGMi7yEYxt9vqG3nhiSGZux8kiU6RY9ki+rAnum9KOLu5+YI/JnXgrY/YRekBq9g/Mh80a6lkX7POSWrVzt+91CZ1PWacbfdIpj738G6nhMuvF75BF0XrJkylD8CD5e8CJaq1oiJz0PWNwpiEn32MDN/Glg42i4FZO4ViFTQ7D1gXt4HmRIdw3E/32nC2k5ysevCiHsuYargDwGnRSUCWxji010NXBWChynaTzAE5yBswdEV+gPyCVj3uRmFWoLSbQRgbhFtepN8CkQKwl8isDjUUwte+HEO1P6eYySY33R/8vBffaNDF3s+u3FLbbog0Pu4coxRlB6y4f+3v7iTh050Y858vVB/CVepHJUbGW7L1b3b1kOVeFmLuTTeZtz4ZpdugHhNhf7EO8hKNdGUZIjbiw9/Q8IsXn8muWxRVwO8X6dxY7lryjgsTy8wt0MLBQIemn3r4ZEVEM29ldj51HPvI/y0PIm+9jkaKb/hzaDJ16/r/U8SmpHFrndibLk8SuucYqA+gJAxXaDlUvt5pjVuRc92Bj0dgcA1A6A63irEwGIdF68lGAOtC3aNM+V6j6oUo9E+KEhQiTne9AY8Bp0rWDwD0WISqPXWFWcF+GKiCXxcYgYouV1HpEJ9LmLU2rDENBuw9hT35O/765eB7ConLHz+/U7YvHJZJ311pxYyb6QgUL2sBJK2MfIXtThydCRyty23gVYnoMlO4txyq/UUgYxJs2X6qIrn+tejIkr3oJkOgacD42tO1md5xpdiqquQibew76BlVu1qXrvyJyglQDThyjDcFBiIAUlrhFdPYJagk3pW4bOuErdluCuq+2KHtQZE5eQXYeKeoaqJZFdOVO/s9NLJ9FVoSzpWTvmBiG1OO4ZZhs8o92SQnlMB/vOCrg24JHTeil/o7z2sFSDz8k0p8choZ8IjUyZBJf+bV0hHanMvbg0B1MY9clizmrxWcPibN8viSXptNnslT0JAeN6AA7pkmFngQk9jlzW8vnU= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBBPR83MB0613.EURPRD83.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(376005)(1800799015)(38070700009); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: 1IvWJv8UrSeOoTg9P8PluOx2LQxUmt2YMyczKhceN3dDJ+YapLMdtaFauP44wWzIhx2E071Sj1x3ZzjARR6BAIi50snXYVwdsSGGX5ZAvh7x5sqC6vzmfzlF27HRD2izQoDTFHJ2P+HnCw4Fr+slzdX1jCIs7S8xmiHHIQJ7GuHwxlEnPsJ0S/hyC+XWvTRvDLBVzphB7er6KG/EKQEWNxBg1Q8xwjsCjnIKdidWwXU61efcLlgLTvKeTEE8PW+jLNuhHWFckzxOvGYhQNj8ApH7V7dsxCLUEQlEKKzRyrFcJOLOem5lftLzdnFSjOzrIORcMCYxa98k9v65VOZuwcmHY04vNdWw8lEay3vVyorEBqFZiX5YHHNqWRDdhaQ0DRjTYHgwwPg7MeYE7E5FsIeIhVwoVT/48yljKHlAPeYI0QaaB6y8NoCCPdvzKrOFoG3N+f2GAVhPqIvTvoyV4N4s0x8B7FXRxnCeyYxyc7/Eza1vaG5V9ZxDfzSzjeunvIqn2R2gy+0hiOvXm19kkyLebZzP2+kzzuWUiRWJgmhqhC99mpvtTb8T+QIZTkbEtRZzkI6bHLoKhWT1RkjwAHxwlA2yuDhMZO41kutWLbnNXOTVMqr6vTkDlH6qlvrwW6ITemVYKpYqNUreGj6Sv5jW1AoDUT+ZvVnE07TzKndrC60Mn+FC1Lq+1WZyx1p9vv9x6r8nU8DcLoqHCTt5J/KkcMdO4j+XPkkt+NalwFdSyn4yqV+WCBmYz4Usjz+7h9YfUE19hXxdD+j/61Lu3b+FliVm8fiKRGc0pxCPVbX1MlJeq+/Iw8UiwuRms22/TdUg9mV1+A/wzSI6cVNCW2ajkc0BZ29VS61YICTJoJRAmQgxh6DWY2OTW4VhsSW/evj8JyzFFPgGkszptwhdrOfz4Mkq+gsE3mxldqeZ0Qu4K6Hwd1UYGNupvir4/YTCKxgJUgeriZQJN+2FnyLxu01UO63rPEbmp/aPKkamZBZIEmPnzUsWWCkDva9x/kPyKg5zaUKJan6RyFTNTtdLhjUp+9Dji48gCNlv1f/eWEe6tBRZIIoH2JSib/Lzt0wRJqY934oUqnukdyIcpcIDvzl9hGWhWvDE+PFRvqR9boJSqh8XxV/XKntBOpo3tQGA5VG3j7Q3TDE/ZkyTw3pob1uthcBzzdXigMyX/i8Z9qgFIq2K81ZbajQmeti1V8dAg1QcKkkytUcn+mNriha1cSMCmSajBSkVVtrbW3IlozdhRxZbBq0KnczZVFYzXt58Z6GrtdJZP4bbpPP7FlDiOpxJ4smXYYwg+O2dfmG8t3s5rbHydbQ2zZv+FlW+msykq1UmmJFykskyjsz/ZH9zs8+dtcxU5Cwow/u4fhWYYCc9lJZDs9fxpipZHTBZK6BJCBVxQGbOCGVhB6UVoc0NbdhsoUGSxBgErox2fOJh89NSbMpkeNtK3rOkqZgGY3URg5IGPiygvk+26m7DQeC7F4b19Kj+DRBcMujcdLFWHpOvFHnzKLZe99WD4d6P2Uz8ocvYgFDkM76Vyr9kta9gw6GWqnnq+nGR3yNKGaWo5RF7WP5BnP4G5CedJQ61V1KTAezjS5JagRI74zh53XwKe5NuIbN0TpoIqg++UiyB2VZWdUXiuwuAvplyDRkM54Fa MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DBBPR83MB0613.EURPRD83.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3f037286-137c-4dc6-edbb-08dc87bd6d17 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jun 2024 13:18:02.8008 (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: d2EgMgIJ92xRmE1rA2P+5mY2mymc12XUKuTkHa8iYsLFG99jTkxw4n9CanGl8qCrYQoN2PTn+UBH29XB5ZkWwg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA1PR83MB0752 X-Spam-Status: No, score=-10.2 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, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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+incoming=patchwork.ozlabs.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.gcc: Move mingw_* declations to mingw. * config/aarch64/aarch64-protos.h (mingw_pe_maybe_record_exported_symbol): Likewise. (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.gcc | 4 ++++ gcc/config/aarch64/aarch64-protos.h | 5 ----- gcc/config/aarch64/cygming.h | 4 ---- gcc/config/i386/i386-protos.h | 6 ------ gcc/config/mingw/winnt.h | 33 +++++++++++++++++++++++++++++ 5 files changed, 37 insertions(+), 15 deletions(-) create mode 100644 gcc/config/mingw/winnt.h diff --git a/gcc/config.gcc b/gcc/config.gcc index e500ba63e32..553a310f4bd 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1275,6 +1275,7 @@ aarch64-*-mingw*) tm_file="${tm_file} aarch64/cygming.h" tm_file="${tm_file} mingw/mingw32.h" tm_file="${tm_file} mingw/mingw-stdint.h" + tm_file="${tm_file} mingw/winnt.h" 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" @@ -2175,6 +2176,7 @@ i[4567]86-wrs-vxworks*|x86_64-wrs-vxworks7*) ;; i[34567]86-*-cygwin*) tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/cygming.h i386/cygwin.h i386/cygwin-stdint.h" + tm_file="${tm_file} mingw/winnt.h" xm_file=i386/xm-cygwin.h tmake_file="${tmake_file} mingw/t-cygming t-slibgcc" target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc" @@ -2193,6 +2195,7 @@ i[34567]86-*-cygwin*) x86_64-*-cygwin*) need_64bit_isa=yes tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/cygming.h i386/cygwin.h i386/cygwin-w64.h i386/cygwin-stdint.h" + tm_file="${tm_file} mingw/winnt.h" xm_file=i386/xm-cygwin.h tmake_file="${tmake_file} mingw/t-cygming t-slibgcc" target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc" @@ -2262,6 +2265,7 @@ i[34567]86-*-mingw* | x86_64-*-mingw*) ;; esac tm_file="${tm_file} mingw/mingw-stdint.h" + tm_file="${tm_file} mingw/winnt.h" tmake_file="${tmake_file} t-winnt mingw/t-cygming t-slibgcc" case ${target} in x86_64-w64-*) diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h index 1d3f94c813e..42639e9efcf 100644 --- a/gcc/config/aarch64/aarch64-protos.h +++ b/gcc/config/aarch64/aarch64-protos.h @@ -1110,11 +1110,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 f37d207ae64..a924cb3b620 100644 --- a/gcc/config/i386/i386-protos.h +++ b/gcc/config/i386/i386-protos.h @@ -306,16 +306,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..d6202816e8f --- /dev/null +++ b/gcc/config/mingw/winnt.h @@ -0,0 +1,33 @@ +/* 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 + +#ifndef USED_FOR_TARGET + +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 /* not USED_FOR_TARGET. */ + +#endif /* GCC_MINGW_WINNT_H. */ From patchwork Sat Jun 8 13:44:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Karpov X-Patchwork-Id: 1945478 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=microsoft.com header.i=@microsoft.com header.a=rsa-sha256 header.s=selector2 header.b=E1DczONH; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VxK7D2K3gz20KL for ; Sat, 8 Jun 2024 23:44:40 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E4ED5385842C for ; Sat, 8 Jun 2024 13:44:37 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2071a.outbound.protection.outlook.com [IPv6:2a01:111:f403:2606::71a]) by sourceware.org (Postfix) with ESMTPS id 9EF493858D28 for ; Sat, 8 Jun 2024 13:44:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9EF493858D28 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 9EF493858D28 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2606::71a ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1717854257; cv=pass; b=r6KR4tkbFcFdIQTjlEqb+Buo7aZv2myMRLlSMkGFj6RoW3cUjLgXEXM2b/6uRTSyVhZrf6Vmn0tXHoIgE69i4sICByobWY84SXYQ7rkcdQW5LOHCfeXNbU2L2Z3NBXp/PSQKmfgJJ2yY7FmUc41g5AxCM1bGItla5+k76OTlRFA= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1717854257; c=relaxed/simple; bh=sAg90M7pu8v5kfsfFa/XnyA2GBm9rkBk0o9Ro6eI3C8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=mlA+SYlRP2nSklcmqieU2tPM38gWKE1r+sO2wgKf6G1cGyBMMxzCe45wVqXN3Uj8w51vqE1SCzQUzdQ3/snKR/6fIxdb2hGolwYlX9SjO4u4u/R25f2qcUwBkt242vNGVpeFBnPezfQTRC7u9GrAjbH6rPKOOZlcbbW5QhrMXao= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jFyeHZvglERaw8WhtuWJnI3ZrTOP41xOKEpqIJlHR1pAHEUjoN/TlGUT2dbAMAC+B5AuxdrIamNnQvDvEBaKkIW4J4yiYplzl5ztLrvBZ/7UCTQgefFiPY36MNbyWPpZZm5Vo8dE5ry6ocitVr53guww0B0NyimlzS/1vQGUnhtdlp2s9H8B7soT8IRPTnPDvh9kXwy62bsUo5taAN2bDzjrDvOuw0Q33+4BmEpC2mYVnFtBqam/gnr7EzQnyHfw0Utqqyfapf2gCN9jIJqmnlvuxYXfCTvne2YnCWYP/9C/U6r5tfyWuhV4rFe9TcZjCaXqiuxFsZRJAv2Fxm6ymw== 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=xO+tcX2cpQ5tCWdqCMNPQ7qRKkIk4u9F+49eqUpLJk4=; b=YQ8OH8lWq728IbJkh8lNZqSFXAu9BJwKgQdSJRJMkdSpfJMmGSQu1gUuRTbA8EN9pBEtXaOeiwyPRWHqGOzzvP5KPkPgCuoNAitKAQ8LPOyyj+vE+KDvYw0bZtazx7vUaRA9A99WjAMrXBGyboZcgNFqWRbsTpiFKrLHW2Q5ku4U6AaJ75xNN+ECQAvIkMD069sXSZg4RHRmmamUQ5X7iJXIFCgy2ehHHDQQnsVCUXzXqfnP3nF2roKuijNlIdJsOib2w2jnDAjmMar/H/3Sj/RrKpXRXE/6ZaaHvydJujlSY6A+/8fNFb9njdESsV1tDTrPTUy0d1m+mwmsB240Og== 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=xO+tcX2cpQ5tCWdqCMNPQ7qRKkIk4u9F+49eqUpLJk4=; b=E1DczONHoGf4b5pMRbwHC1Ff55W/t2q4lOB7mL2twytwiHthrUYUhGFO1K/HE056KaA6Ur3N/6q8GyCcvTv2iku2An0iKwn+EVtqyL7ok9jVhPtMLLdxX+mRW3XoNkEYkKYrRuy6mxvvJLfpYo5VVUfPkRJRjU935SRbfu89XQM= Received: from DBBPR83MB0613.EURPRD83.prod.outlook.com (2603:10a6:10:533::21) by GV1PR83MB0651.EURPRD83.prod.outlook.com (2603:10a6:150:162::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.13; Sat, 8 Jun 2024 13:44:07 +0000 Received: from DBBPR83MB0613.EURPRD83.prod.outlook.com ([fe80::399d:9bfc:1209:af10]) by DBBPR83MB0613.EURPRD83.prod.outlook.com ([fe80::399d:9bfc:1209:af10%7]) with mapi id 15.20.7677.009; Sat, 8 Jun 2024 13:44:07 +0000 From: Evgeny Karpov To: Evgeny Karpov , "gcc-patches@gcc.gnu.org" Subject: [PATCH v3 2/6] Extract ix86 dllimport implementation to mingw Thread-Topic: [PATCH v3 2/6] Extract ix86 dllimport implementation to mingw Thread-Index: AQHauanubOS23vGhdEuZ/nhvyu6R2Q== Date: Sat, 8 Jun 2024 13:44:05 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=4cf5d1f9-3011-4a77-8066-ab2b27e02d44; 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-06-08T13:11:52Z; 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: DBBPR83MB0613:EE_|GV1PR83MB0651:EE_ x-ms-office365-filtering-correlation-id: 909fb8b1-1cfc-44f6-1ee8-08dc87c11084 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|376005|366007|1800799015|38070700009; x-microsoft-antispam-message-info: yI6ZBjf13D1kEoD+P9fRU252S6oHi7p71BSuCUTDZB7WYSdl5V6Ffc2/01ZdS4bKcUdLFsQfVAbVjn9b0Itaq4e0BFNwOw/Qa24rKit00v/LgR3Ksx/o2lhwO38vNP6yeS6uzANNT5ewv5LJXs3eGbIXKcuGeWKYYdAKv+jhDFFVbbx4XCE7wXMrhBQs9n9Gakhj6U06B8BIw8+FCtYHaVsJaeVpQ/GdhzfNA9D532YqRQPQW8Xa7yy/ReqOaVSGVRyZD8jl0BO21HlvPlHArfKAukQ41bjvpZWsMYzBShyPYPxh/Hq8kaYwKBcAbiuFv+ZXjKOTQTMLbYXX4qAHACSioiLg+x+WKMA4vlaeHS43YukCerqdd3o7iRfGp1R7C5S3dBOnDKOFjX2GM1OyXWVTedpMteC0f32Y1j19lbnvCYkeQLZeO9UKdT/36JNJtAP0V1evP12PTOqmyfx9vY1itvDVx1zjbbPk3i9QMRvUWp1dg3LwE4faqkXGLbR/zFmWIbT3md74irHTMclPghj2Ox35kUzLEIAq3rChBZbZJlRny4GZN2v74s2JUwSki0UL95IgrSy53CQOWf1oXslKLLMM8YaraFjckKy5h5AQTHg8WJzYthp66EKxexEKVOtXWVXm4E0Tq+KGXOiVcnZm7QQehUlLnoPLueTdMJudXAkSaLiGuss6Y9vQBOtteHY2bhdeu1tCUKsTHkU018PUGRJZTvfCrjIVP9x7cNrpW6uZVJ7bRUfxjGNyhbuapIwfBq4oWVfFFGKU/e/89D7IiNsbFSv2iiaa3zQyjaklHzT7uv31VuZ7pYBQPbGkX4gtMU0t6jxKSTyZG7F+h6q6rQdS6+c1rXa7gnOcfYhrjQY0ky8KOiKQ0gl6KhBjt+KxGEpcX0UbKuE9UHL99lI882VGGCVB6rPXYeObrZBVv1vM2GTVeMGMz0Y3kZBRjYiLZXpIdSg7ZabqSPvTc1NrrstT3ogGm44FP5fwHEMhN5AHVEbRItvJ0koFTigZEWq1D1Lj9FM4Klu/CBHt6nwe8xj3HkBNVkiKKQSq31wExqWwo6m2ju79LOlyMZEp5jG6Gz7p8GLgDkloamDrVtRuuaX2N44yV1q0UwP4p6c= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBBPR83MB0613.EURPRD83.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(366007)(1800799015)(38070700009); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: tjDb8WFeJrBQGh5h/0vEN86Vw7v3UPUbUBzbgjlAMd28yBPUsbhutzRY8eY6zXzC8MMe56tuylVFMkAJ1oRywQh6FfBicprLlLhNBG/+YJu2pC/JbmFqagacqw5pLwIy7dwVff2r7nCu9eMUqjpYMuV4t1HFFFKMOpTz21iLWMn66X0xxcrjky7jK/WqHZqo/jxV8oWy6/Kfm98wjFl9JCMbcUHuiInTALCdi9fiF7/OZfm27/ytX39IrkCuKWC7XUl3a9cBJgDcE4uRKCo/1LPuEnKMKyuh+bBfDJRdYcCXjj2Aa9nboOSUl2CNT2HWkai0LoqP5F4A8dtkztw00lA4LQG2I9kvVu9C3eFhoScBHiKCgoZWICuOswxG/Azdi+OKKxIMgA4CJ/tfS8UC9Uy+PL4V8nUH00BBOW3iC+tuYq2wjY6QPI4+pOgGo1gzmmMbflfdqLBr86OJkDf3vb+lck+DqmGYcbYr7MuyeT8i82weuVuj41DU0r5wRuWnR3WgSLfieoXC8650FtZDQg6MhYaGKnz5S3i0btGWeAtn0gDVpRrUfJsz2lM87Uhu2KoqJ2RUR1TjRlOBL2n97xiMvby525eyI+mCzgWQEnbtHjPTLVZRA30f4iUF/4WMhk7sC9PaS4vAJSkTcSaNcc3agvwoC5A+FI1KqXpWYpDdJd7Pd6ft/JtH5uIpv+xpCryvw2RGcHpNJJHEKKxqblA9PbfXFP0B8O53qRu+rDQdGy7+AztDp6B5pCOLsrr/BhbuPM55ImYww4VO2meKJlSDlgcnEpVBMIjX74wA7g/uxNo3Pxi90/wxiXA+krhawcxjOcnf1a5J9nhVoEXkqP+aP0Oo52k7sF+LHts9/u7lTs3+XoXQLQm2fqMKzyp2/4yxyCHh2wkYE5k3qHeo8D8yIqylONYSGTfs8TbrUe0MYn0sdvmi786bQXLXBe30LNPQfVfaSGcuq4zsYyehAzXlSQ9UC4/7QcEzJf9LJJzyq87jBoCsXQASqKGMzha7EZOtwiTIY3114Ytc3rAmT8+LPRT8pT2BwLGvNOniWIinYBzAkOkkexgOPBzV6hjzFcf70dp0v1WkzbWgOkuxZyetgsH8etqcfvD2olCxBwrv5utNWcGqVdHB8mR01uNMG/zCqFUmi3lVxcxt6jaQAnDW1JXgzvVaaw2YRMyVPCIPJ7tGmaHbg4YmtapbqpXmg7BVgrG2fGLCzyaLPoQ06v/aOLf4CNTPIBt+ksMmNibPLijm/IydXQ02jNqkvTck3USPmoVk4ZKG60Xt/jie+OO15Qqfz9L4qctCiv/znflSccG+kqQvObUL9N9MHDBuBjgLgBeGKr3I227Dv+Jf6x2CWpoAhK8+2j5bFcx0anaC7xcMzHHITmVuHeqGipz3kCUHf7+9vctGYHbvFDD8bSYk1Fj/kahilW/eeM3l8XjZDBUuQ8dfGFYwk8diOYCuMx2KriDgfNFrIo6lcHqqN3PW5OgOJaNAiM4uciLyi/6xrgkdGHjRrkbhu2FMIb/WtzlUgD9F2Yu5UbOh/KwvsHNQc4Pi/bbjMwvfPvCrbkzWLaLLW4rP6L7O+tMwYKRxAxswglVAGzkGk6VLo8HIQecwsIp50OMTQw/2E3kVSJc+7VdcAFSUUk29DTdIFMYs MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DBBPR83MB0613.EURPRD83.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 909fb8b1-1cfc-44f6-1ee8-08dc87c11084 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jun 2024 13:44:05.5269 (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: thpH89qgc9Gvl3dVAY/r9LeykGn1td0w85FGLpBY8R6II79q/b1brTkEb8o4HWcxYwYJzO7saLSZrwbt8R6DRQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR83MB0651 X-Spam-Status: No, score=-9.5 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, HTML_MESSAGE, KAM_SHORT, KAM_STOCKGEN, MIME_HTML_MOSTLY, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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+incoming=patchwork.ozlabs.org@gcc.gnu.org From 8f6fd4775792b443a72dfbc8d95bf3ff5b516d18 Mon Sep 17 00:00:00 2001 From: Evgeny Karpov Date: Thu, 6 Jun 2024 22:38:35 +0200 Subject: [PATCH v3 2/6] Extract ix86 dllimport implementation to mingw 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. Use MinGW implementation for COFF and nothing otherwise. (GOT_ALIAS_SET): Likewise. * config/i386/i386-expand.cc (ix86_expand_move): Likewise. * config/i386/i386-expand.h (ix86_GOT_alias_set): Likewise. (legitimize_pe_coff_symbol): Likewise. * config/i386/i386-protos.h (i386_pe_record_stub): Likewise. * config/i386/i386.cc (is_imported_p): Likewise. (legitimate_pic_address_disp_p): Likewise. (ix86_GOT_alias_set): Likewise. (legitimize_pic_address): Likewise. (legitimize_tls_address): Likewise. (struct dllimport_hasher): Likewise. (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/i386/i386.h (GOT_ALIAS_SET): Likewise. * config/mingw/winnt.cc (i386_pe_record_stub): Likewise. (mingw_pe_record_stub): Likewise. * config/mingw/winnt.h (mingw_pe_record_stub): Likewise. * config/mingw/t-cygming: Add the winnt-dll.o compilation. * config/mingw/winnt-dll.cc: New file. * config/mingw/winnt-dll.h: New file. --- gcc/config.gcc | 12 +- gcc/config/i386/cygming.h | 5 +- gcc/config/i386/i386-expand.cc | 4 +- gcc/config/i386/i386-expand.h | 2 - gcc/config/i386/i386-protos.h | 1 - gcc/config/i386/i386.cc | 205 ++--------------------------- gcc/config/i386/i386.h | 2 + gcc/config/mingw/t-cygming | 6 + gcc/config/mingw/winnt-dll.cc | 231 +++++++++++++++++++++++++++++++++ gcc/config/mingw/winnt-dll.h | 30 +++++ gcc/config/mingw/winnt.cc | 2 +- gcc/config/mingw/winnt.h | 1 + 12 files changed, 298 insertions(+), 203 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 553a310f4bd..d053b98efa8 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -2177,11 +2177,13 @@ i[4567]86-wrs-vxworks*|x86_64-wrs-vxworks7*) i[34567]86-*-cygwin*) tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/cygming.h i386/cygwin.h i386/cygwin-stdint.h" tm_file="${tm_file} mingw/winnt.h" + tm_file="${tm_file} mingw/winnt-dll.h" xm_file=i386/xm-cygwin.h tmake_file="${tmake_file} mingw/t-cygming t-slibgcc" target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc" + target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt-dll.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" @@ -2196,11 +2198,13 @@ x86_64-*-cygwin*) need_64bit_isa=yes tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/cygming.h i386/cygwin.h i386/cygwin-w64.h i386/cygwin-stdint.h" tm_file="${tm_file} mingw/winnt.h" + tm_file="${tm_file} mingw/winnt-dll.h" xm_file=i386/xm-cygwin.h tmake_file="${tmake_file} mingw/t-cygming t-slibgcc" target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc" + target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt-dll.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" @@ -2266,6 +2270,7 @@ i[34567]86-*-mingw* | x86_64-*-mingw*) esac tm_file="${tm_file} mingw/mingw-stdint.h" tm_file="${tm_file} mingw/winnt.h" + tm_file="${tm_file} mingw/winnt-dll.h" tmake_file="${tmake_file} t-winnt mingw/t-cygming t-slibgcc" case ${target} in x86_64-w64-*) @@ -2277,6 +2282,7 @@ i[34567]86-*-mingw* | x86_64-*-mingw*) esac native_system_header_dir=/mingw/include target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc" + target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt-dll.cc" extra_options="${extra_options} mingw/cygming.opt mingw/mingw.opt" case ${target} in *-w64-*) @@ -2285,7 +2291,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 98b375538e7..56945f00c11 100644 --- a/gcc/config/i386/cygming.h +++ b/gcc/config/i386/cygming.h @@ -461,7 +461,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 @@ -469,3 +469,6 @@ do { \ #ifndef HAVE_GAS_ALIGNED_COMM # define HAVE_GAS_ALIGNED_COMM 0 #endif + +#undef GOT_ALIAS_SET +#define GOT_ALIAS_SET mingw_GOT_alias_set () diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc index 9b60264dce2..119c0d7fe9b 100644 --- a/gcc/config/i386/i386-expand.cc +++ b/gcc/config/i386/i386-expand.cc @@ -408,10 +408,11 @@ ix86_expand_move (machine_mode mode, rtx operands[]) : UNSPEC_GOT)); op1 = gen_rtx_CONST (Pmode, op1); op1 = gen_const_mem (Pmode, op1); - set_mem_alias_set (op1, ix86_GOT_alias_set ()); + set_mem_alias_set (op1, GOT_ALIAS_SET); } else { +#if TARGET_PECOFF tmp = legitimize_pe_coff_symbol (op1, addend != NULL_RTX); if (tmp) { @@ -424,6 +425,7 @@ ix86_expand_move (machine_mode mode, rtx operands[]) op1 = operands[1]; break; } +#endif } if (addend) diff --git a/gcc/config/i386/i386-expand.h b/gcc/config/i386/i386-expand.h index 65cb49c921c..5e02df1706d 100644 --- a/gcc/config/i386/i386-expand.h +++ b/gcc/config/i386/i386-expand.h @@ -34,9 +34,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); 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 a924cb3b620..a9171c3d2d8 100644 --- a/gcc/config/i386/i386-protos.h +++ b/gcc/config/i386/i386-protos.h @@ -323,7 +323,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 173db213d14..556fe22a229 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -11244,20 +11244,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. */ @@ -11359,8 +11345,10 @@ legitimate_pic_address_disp_p (rtx disp) if (TARGET_PECOFF) { +#if TARGET_PECOFF if (is_imported_p (op0)) return true; +#endif if (SYMBOL_REF_FAR_ADDR_P (op0) || !SYMBOL_REF_LOCAL_P (op0)) break; @@ -11836,16 +11824,6 @@ constant_address_p (rtx x) return CONSTANT_P (x) && ix86_legitimate_address_p (Pmode, x, 1); } -/* Return a unique alias set for the GOT. */ - -alias_set_type -ix86_GOT_alias_set (void) -{ - static alias_set_type set = -1; - if (set == -1) - set = new_alias_set (); - return set; -} /* Return a legitimate reference for ORIG (an address) using the register REG. If REG is 0, a new pseudo is generated. @@ -11883,9 +11861,11 @@ legitimize_pic_address (rtx orig, rtx reg) if (TARGET_64BIT && TARGET_DLLIMPORT_DECL_ATTRIBUTES) { +#if TARGET_PECOFF rtx tmp = legitimize_pe_coff_symbol (addr, true); if (tmp) return tmp; +#endif } if (TARGET_64BIT && legitimate_pic_address_disp_p (addr)) @@ -11928,9 +11908,11 @@ legitimize_pic_address (rtx orig, rtx reg) on VxWorks, see gotoff_operand. */ || (TARGET_VXWORKS_RTP && GET_CODE (addr) == LABEL_REF)) { +#if TARGET_PECOFF rtx tmp = legitimize_pe_coff_symbol (addr, true); if (tmp) return tmp; +#endif /* For x64 PE-COFF there is no GOT table, so we use address directly. */ @@ -11945,7 +11927,7 @@ legitimize_pic_address (rtx orig, rtx reg) UNSPEC_GOTPCREL); new_rtx = gen_rtx_CONST (Pmode, new_rtx); new_rtx = gen_const_mem (Pmode, new_rtx); - set_mem_alias_set (new_rtx, ix86_GOT_alias_set ()); + set_mem_alias_set (new_rtx, GOT_ALIAS_SET); } else { @@ -11967,7 +11949,7 @@ legitimize_pic_address (rtx orig, rtx reg) new_rtx = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, new_rtx); new_rtx = gen_const_mem (Pmode, new_rtx); - set_mem_alias_set (new_rtx, ix86_GOT_alias_set ()); + set_mem_alias_set (new_rtx, GOT_ALIAS_SET); } new_rtx = copy_to_suggested_reg (new_rtx, reg, Pmode); @@ -12344,7 +12326,7 @@ legitimize_tls_address (rtx x, enum tls_model model, bool for_mov) if (pic) off = gen_rtx_PLUS (tp_mode, pic, off); off = gen_const_mem (tp_mode, off); - set_mem_alias_set (off, ix86_GOT_alias_set ()); + set_mem_alias_set (off, GOT_ALIAS_SET); if (TARGET_64BIT || TARGET_ANY_GNU_TLS) { @@ -12503,173 +12485,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. @@ -12709,9 +12524,11 @@ ix86_legitimize_address (rtx x, rtx, machine_mode mode) if (TARGET_DLLIMPORT_DECL_ATTRIBUTES) { +#if TARGET_PECOFF rtx tmp = legitimize_pe_coff_symbol (x, true); if (tmp) return tmp; +#endif } if (flag_pic && SYMBOLIC_CONST (x)) diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 7051c6c13e4..d9f02f66518 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -2262,6 +2262,8 @@ extern int const svr4_debugger_register_map[FIRST_PSEUDO_REGISTER]; /* Which processor to tune code generation for. These must be in sync with processor_cost_table in i386-options.cc. */ +#define GOT_ALIAS_SET -1 + enum processor_type { PROCESSOR_GENERIC = 0, diff --git a/gcc/config/mingw/t-cygming b/gcc/config/mingw/t-cygming index f5de941c8e5..3dd9116d92b 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) $(HASH_TABLE_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..1354402a959 --- /dev/null +++ b/gcc/config/mingw/winnt-dll.cc @@ -0,0 +1,231 @@ +/* Expand a SYMBOL into its corresponding dllimport, far-address, +or refptr symbol. +Copyright (C) 1988-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; +} + +#include "gt-winnt-dll.h" \ No newline at end of file diff --git a/gcc/config/mingw/winnt-dll.h b/gcc/config/mingw/winnt-dll.h new file mode 100644 index 00000000000..14ca743b69f --- /dev/null +++ b/gcc/config/mingw/winnt-dll.h @@ -0,0 +1,30 @@ +/* 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 + +#ifndef USED_FOR_TARGET + +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 /* not USED_FOR_TARGET. */ + +#endif /* GCC_MINGW_WINNT_DLL_H. */ 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 d6202816e8f..74e454a13c8 100644 --- a/gcc/config/mingw/winnt.h +++ b/gcc/config/mingw/winnt.h @@ -25,6 +25,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 Sat Jun 8 13:46:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Karpov X-Patchwork-Id: 1945479 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=microsoft.com header.i=@microsoft.com header.a=rsa-sha256 header.s=selector2 header.b=GCIMjcvg; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VxK9l134Dz20Py for ; Sat, 8 Jun 2024 23:46:49 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E181E385DDE1 for ; Sat, 8 Jun 2024 13:46:47 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on20721.outbound.protection.outlook.com [IPv6:2a01:111:f403:2606::721]) by sourceware.org (Postfix) with ESMTPS id 67CFC3858D37 for ; Sat, 8 Jun 2024 13:46:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 67CFC3858D37 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 67CFC3858D37 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2606::721 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1717854390; cv=pass; b=Jh8VG7bcNquUsqSabcR0UxY2w2S4PK5BDU1VJNi97f4eycbkliOZSizM9AJjdBtVU+tYZvCcrRf8WsJsiGR87sy/sjGbKV1PAiczu5x1wGAzbTsRvk03z4C/v00vvjff6QpoHutow3ve06b2B8mVwXHG39vBkukHaP8iXGeGiKw= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1717854390; c=relaxed/simple; bh=5c1RgtIcLImeOYqBKkuZRlpeyHanYXmVWKytAD7RCSU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=DEvZuSbnE5ubL2vmp495sNLUv+mk0FQYsRw3ZLxitrYIkn57uO6HnODRSrbZ0vKB5GFpw1mF5yrzryeQWzZ0HUeaDOWfWHyproNWF0zM+jgiAiTTOA1RnzRr2GbsrvvXRSiar1CEFmPcn6GoBWHY+W0M9m9TivmWA6hl7VET1/I= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UjCZN2/E81XLvKz+w9y1i2n0bRxA62Mltoz/sNKwZZuTWdaNysamdlCvKMOHTPTWQNg5gPOTwRaLhlbovpyQv1VrHiiGr7v26aq7/TVgG/xCMAfcR/8++tjel+B7VEjtw8uLaPell+H0sLacxTSNjxSI54MMSoi5RylHlv4BRkJzrdZvhFJgyu0Qr/azaW68zOoYuvXMyE+ZkE1lPfwshxwkJTHrVMVO70amskbH8lWg52qTS1ZrRKZvnDRcKz9yjObE1czclt+9QQwNzLZOZo6E6ck+jucrcalCxYKphgufbDm8itA8vaWWv9otqAhZiNEpU9H6UOHFDE/bEizGmA== 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=1F+vDbHCOSR0BbMCT8+ZHIqRklsp4Kax2tDujMdOXgA=; b=Ptn69v6n2lz3HgJFLh1SYC0bWAyuAh8wY6fqJTfEZoRiI5J877asIl0nKMzphSI64PrBell9ivxRM9kF/AOF6D7b+n2g7TWHYpXzxhEoX8ZrfDD0sTUbFnM/9AnMRjSylMiACsT7bQFDuzVOitvU7SdUqDGtKvjDya2YxQEdganWPxVAeiOOBIMNaIfoWaUfdIMXQZLOAWpgg0Si9BT7CQwdv2xMfEmdUI3Ewmxn+c3pqiGMT2zw6S2/dlkGja9Eczhc66qOZC+3RQi56WYPPzjgLKowsXhRE+4aKHc+1Mf1BKmoYTyF9HzhAxq6YF4Hfk5FCvVy1wLImPP2E7U5Qg== 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=1F+vDbHCOSR0BbMCT8+ZHIqRklsp4Kax2tDujMdOXgA=; b=GCIMjcvgLmJ0i6EI8YOhL00hGNOZ9EElSaqncnKtT95wv3UuqDd5zMXi9wHjci6u5nf8LfIMsfynr8IArVbLSsfFLH8PAJlEATgshQ2BV5pdmLOs1bhuUHvbArZ6Qh77Lcg/8w7KX/u1DYB3Pfeah7Nn/f2lFMD4lVGyGw9NR64= Received: from DBBPR83MB0613.EURPRD83.prod.outlook.com (2603:10a6:10:533::21) by GV1PR83MB0651.EURPRD83.prod.outlook.com (2603:10a6:150:162::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.13; Sat, 8 Jun 2024 13:46:25 +0000 Received: from DBBPR83MB0613.EURPRD83.prod.outlook.com ([fe80::399d:9bfc:1209:af10]) by DBBPR83MB0613.EURPRD83.prod.outlook.com ([fe80::399d:9bfc:1209:af10%7]) with mapi id 15.20.7677.009; Sat, 8 Jun 2024 13:46:23 +0000 From: Evgeny Karpov To: Evgeny Karpov , "gcc-patches@gcc.gnu.org" Subject: [PATCH v3 3/6] Rename functions for reuse in AArch64 Thread-Topic: [PATCH v3 3/6] Rename functions for reuse in AArch64 Thread-Index: AQHauao/+nJVY7IYS0ykqbSoCP8PqQ== Date: Sat, 8 Jun 2024 13:46:22 +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=4cf5d1f9-3011-4a77-8066-ab2b27e02d44; 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-06-08T13:11:52Z; 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: DBBPR83MB0613:EE_|GV1PR83MB0651:EE_ x-ms-office365-filtering-correlation-id: 4f80676f-b80c-433d-6137-08dc87c16275 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|376005|366007|1800799015|38070700009; x-microsoft-antispam-message-info: hRSojmn89MDpMk0B5nuZIWT2ccSYV0XvTsGzjE0oZ5TPonr9xIuG76/uNSlRy6dyFIn3D+hV7KXv3OWqE14/mFz7sbc/xg5/BaL90x4shsrIaZzXbGD9bvx62KCCfi/DbpqhslKg2mFqKDVCGAinZmXSlirSKLHZfmuxRMXGem1VrxCNHUmACBw3+ng7TM9NQc2JwR/WWGeIg9dS/56xTdGN1InOeoQwmwlq3WFEgSVgptDiHSp+/Lj9UijJ55/03UzUb/Rz9iJ2D83SApFhT5muT2ON806pADIk1lJVYvpS6BtDcIvHMzgbbdq37b1fmpHcGYixhk/I4bVU2CtRMwd8htBtkaIMWp4MGsVzhuVWslAVUL1qtYECF595t3A+NxGVLFQOt9Vqgv0/lwqkchHnjaxAL6hYtHlXUU2ZX0eJH1wcLGyordz8h7zv5JipZa+tJM98xDE17OA71bOUrnsaBlKYGnE6Jl3fmvgTCfQSYPYYUjqmLz0nM6MdgrK3OBOGLEcWc+LJjXezeK0yMS1lpwzY1cNpBG/oZAv3TY5vhUxqauEjz4PlfTbvRUn/f2CK8h+rfKuMv9/12Q58pYjC/wGPAWQs6UvIdoX3jCsbVYDiY/biVRva7J4OUcO4GoCu4jmHaqt/3LF4jihhi4J/x/vE44YPY7rc40Y3jTbQcLtiRZSwRTbSqQBaj2Lk7PuDP//nDGcXPTIFQzPJe2KP79HsUNE+4CSP/geuthC0awfymirlIPOcfH0UoyyWDM1VuqveUAYb7jo6eOmqkJFPAJEmsSwNut/xBJPa6icKB/C9Vsx/K+hjIA8GvkkV2Ry4yd+nFzYQ49kuCI4sJ3pXh0ON5mTOjaKNP5lVMuXGI1ebNv6V/TRXWwfHt73rkeSK2wX5nNQa/+Xd8kZY/13NVlFay+NQSy9wd6fp9+lS+icQePMfjUXPBBvEV8h4Q84WTgS1No9ixBKhThDnTho1K6H+t6xorKkjED2fUGTs++n3NH8qHSYiW4hlHJGZ3xyuu+glpEiQiiM4hdR9dTzuxw13zgv0Oz12FFTdSUTIHQMMDNVQmfwY8f1dhm90aOkpiEtKx9Br/l5ick9SYviC92KUpSC9iF09XDAu45S6t6XVpRR9mDephPJetIKQmbtZG33BQkih7sMiNXWgI3SVOEAtcHs2q4uVVbTjomK7GMiaBCTse0et9qTqQH/AhKiK+ktEdjeRZG4Uq1MOXC5PpQg75eFbdoyFlC0PWyyXZ3rZoQ82M1x60v+/Jp7CB2/8onRW8EOfNn1hz0o+A/rSe2kCfKqJ5NqviX62O890EiTGFQxIswhYwDSBcQwPweoZ26wZPXiTgKQGk3h4k0Q7seYCzw4kE4r+erZPySE= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBBPR83MB0613.EURPRD83.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(366007)(1800799015)(38070700009); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: RPXpkBCsW3dduCePekRpRS+8voGJtyEGe0KBqY9Lo0fpILAmBHtGF9j1cC7W78+lN6vprjZcUwftB1P2y4BuyjHOdGqJ/Cj7KLwdmq7fJQmTVevL2Ift1+JczjyD+LbKokxZ3UkciVWuNMtpRHnmS34mK75eRd1AGjkI843plzKj0pnfO7QHThR9yxA/oCjHTWwqbJMdmw7z7DlPfj3WLIMJhOVkWAKsImgC31SAG69OZlws+TAw7OQI6Z4ULJhb2UMYsFvSzzfSHFVKYWANy7M1IpyImLaakCIg8h2plWFKplYFJJOe8wRz/Ruparmfxv8QZCAOAa3rqG/RamhZIyunhjjU1iuPYi+pgVyEVSeLQOgGqNu778YKuYHQmaCW3gMDMzApruwuuFPfd/ZVxOLhO0I5NHUk6hZxRdt5AcvtB86ly/EIT0Jj0cF8e2DVwgIkcFFNxrnFSc3KcvqSjGQZFYPHHi8tGd5E+O6VeIxgzPaQD3cvPxqsuG60UFiF15NuDpY+XqyfZR52gJ9uQZjmlrtZYFi1TEonxevou/BaaSiinmQHroXRmQLXM527wizUomjLb5NlcqAvgqYRPeA+7bp1PTF5Hc9sCLiaVZJeqBtKQPYaC7V76Sw16pOmKWjVyxgdki6cBhIwaeKjEApVT9YPpLdXRKgkxWQxDQO6qx/5qizJlcEGJA/gJKPTC4rglmDIK/oveNqso86H5nA3BTZDkPbQL20gk6Elx+ZSTN6U9s4UhVOrc7g7ajN6I+Rjsff2N+dG/Tlo0iuagRWNmKlGO7uirl4aZRQxBdTDLeuH7OEcS7UoGM8l7w9r7GvWtXGJdw4ljPcZ/QUieD8z33OT5dRjQrO/9Uhm+/TD6r45+k0wZTJzdyqsU0gGIPqWolwmLHIBCzYcrhGzKtSrkke5zKnc4/UKfzuOGgBzhDQw9UuEJVDuZWO3QeN5ahD9BcCOnKyibDjcyhBsGXuZRXFUIf5AjYSoNbJYN3zbVbKDj4znEiV8/0twzuFuTJ+pKiFU7RoZ2aFGSgH/KH6FtkTjaQga7ZAihfabi9omHOUT2Osmhg/VAnlnoTHPHx5nfCnCddzNOaaqGZuUKpNqhIVdATmB9XmpiTbrDdbW9DDK3tHO/G5zAOlHH8MaSzHBg4PaHaBRfk6mwjvCVrbFfTmW9iduir5UTnTWhkT1g7nQrQGoSdltybbwLr3lxW9nREWrQ/A4P/tItktBSkpenmPez1TaFVREKuYutmboKCqwxgMCALijdV+v8CCmLUkG/9OF1nip9AWcrc6WSpg4ikJVvUWwGJbmDlSklWwk3t7bhfixak5L18kmTsZbDwcgwqAWd0/2egFD1rD9uTCzwsXJpZA4kXcE/RStpYXtv3lM2XO35BqDH/4k12fwU/yMVeofLIrbmqpiMts7mAwLLE4H5vRacaaQ8hLAxZbsAzcFLJD87VTXNk7iv9Rz2cxXeWcD2GQAEz82wLMI5EMkBB8rE0znd99C/Chq83iszZ2N1DPzIOm1H/K36e8i5zO1YEJrpQckd981NC3eTlEMbR+rS6gQdE72M5Vj32LCWUZUrM3iYHiG1sPkCoikR1w3l4VVTvGIeyxr+j+t2r/053v+/Ik1iOJ5mgWEE++cp9zkuMYAVac/X8QhH78f MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DBBPR83MB0613.EURPRD83.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4f80676f-b80c-433d-6137-08dc87c16275 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jun 2024 13:46:22.9561 (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: ThNoMAspG3kt90Vhg3V7na34Z5ujhd7Ha/hgH0HplQuaSBU38b939vRFeDfPHzAxm1rGQsG8b6YlWQrF7ERwww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR83MB0651 X-Spam-Status: No, score=-10.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_NUMSUBJECT, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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+incoming=patchwork.ozlabs.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 | 8 ++++---- gcc/config/mingw/winnt.h | 6 +++++- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h index 56945f00c11..4bb8d7f920c 100644 --- a/gcc/config/i386/cygming.h +++ b/gcc/config/i386/cygming.h @@ -344,7 +344,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 @@ -445,7 +445,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 } */ @@ -453,7 +453,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 a9171c3d2d8..4f48dc0bf75 100644 --- a/gcc/config/i386/i386-protos.h +++ b/gcc/config/i386/i386-protos.h @@ -269,7 +269,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 *, @@ -309,12 +308,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..803e5f5ec85 100644 --- a/gcc/config/mingw/winnt.cc +++ b/gcc/config/mingw/winnt.cc @@ -71,8 +71,8 @@ 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, - bool *no_add_attrs) +mingw_handle_selectany_attribute (tree *node, tree name, tree, int, + bool *no_add_attrs) { tree decl = *node; /* The attribute applies only to objects that are initialized and have @@ -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 74e454a13c8..97fefbcebca 100644 --- a/gcc/config/mingw/winnt.h +++ b/gcc/config/mingw/winnt.h @@ -20,14 +20,18 @@ http://www.gnu.org/licenses/. */ #ifndef USED_FOR_TARGET +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 /* not USED_FOR_TARGET. */ From patchwork Sat Jun 8 13:47:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Karpov X-Patchwork-Id: 1945480 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=microsoft.com header.i=@microsoft.com header.a=rsa-sha256 header.s=selector2 header.b=Z8kl78Bf; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VxKBt1TvBz20Py for ; Sat, 8 Jun 2024 23:47:50 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 76EA73858294 for ; Sat, 8 Jun 2024 13:47:48 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on20719.outbound.protection.outlook.com [IPv6:2a01:111:f403:2606::719]) by sourceware.org (Postfix) with ESMTPS id 465163858D37 for ; Sat, 8 Jun 2024 13:47:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 465163858D37 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 465163858D37 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2606::719 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1717854447; cv=pass; b=cRwpnWcQfyENoe3cnNqYD0elMqt/6rSqKMvmKZnJFOzfHdEojaafYBHiZx4thidKyD+0kGSjzWY5A5WJpvpBFNJmhk73fQYR8/nxwkknEjwBW7CwR44W0If/lwnnbtWrQWPcNxwine6GjDiSq8PAraw47k2QVeBM8ZeLX/9CEvM= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1717854447; c=relaxed/simple; bh=K2E1FEb73RzCVm1fP3fbyD2UzBBF/p8whw7f6bX3lms=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ZHb1PqajPjpg/M0onBauwEEQXKcbVATYkKkIjMEdFjyfKpdHChRZqAtTY94N7UrpA2ICuygaeerp/IicaKjQvZYS9yHlcEHp14cMQjEbMvL7kU5KD/Eo1LFBOxy4h3xJemAeX3CX38EaX7z+0iIbJ3qedkvFD2QmnTBeYwVldp0= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g7hec5XWCDZ3q9ECiHiYQ8f+KjqZYZVJwQ8n8uHpcq8uRVf4mMEVlEzBr/wRBRUNOR8pk9p6Iy8XcGw9CkBGKeHGTvBwbBFwtTlkK6tHF8r7R9ivVHOH3PeE0J93cwus2MmddPCrUypTrGQjhBBrTg+wH4FEvSNYAR40HhITJmw8Qwkc9AN204454O2NBaiajc0DJIA88tTfngaXBr9uK8vwywzuxGu7yWjjvPrciXojDljWf/guEUzRUOxi4AxzCDwx/6cayyA2KWjoYq5BjBLnjli7JuQVYD9iDP4NF+OT8h10ZdYXl1mtlmRQccIDYEfgT+PGgFwv+UhQYTKf7w== 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=v957DOYri1FFf315e6QU2SK+vo7kXBC+KSIh+tqXUyE=; b=ARKCMoB0WYtj90egrPUwQ/Il2cTch+FKUb++LqC5SSStKqXXfngjwfE1hiegLClMJjpX4LwONzBg/JzakdwCVp4BrUj4TshED58/HDKH0vNiCfw+Xe7u8qwfRSQH7Y0lmR12g4oEZJNVcNsijOtM1o14r+1hSSFS1rqNDU4nwGsCCB7Lx3zdbTlfwXf8zCFB936MpPsYpLSVF8+qhzWNm+jU7pv35WIXijq715K5GLSK+G4A2edt34WMSFepwkl+2HLjUkqhbaDNBHBzuXCA6rc9jG+HbpvyklltpQyIhZRC9UMMBkEnlPn7WUXanOhxnzPlEkB/r6T6oNfJcGattA== 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=v957DOYri1FFf315e6QU2SK+vo7kXBC+KSIh+tqXUyE=; b=Z8kl78BffIVgn8TDDDT98plaQ1sj+ZKR3vAhBvFtfQ/xo6rs5GW8bhCYvt1phWt3cW0nxIOOSC9+bMTsUruuG7eWh0EgYdIfoZphysGFOZ9GC60fAKIOrKr9KYNor8DcqxxNXZms4SqAbsN1xa8aBddtMREJ11uomXEAh+TlOck= Received: from DBBPR83MB0613.EURPRD83.prod.outlook.com (2603:10a6:10:533::21) by GV1PR83MB0651.EURPRD83.prod.outlook.com (2603:10a6:150:162::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.13; Sat, 8 Jun 2024 13:47:22 +0000 Received: from DBBPR83MB0613.EURPRD83.prod.outlook.com ([fe80::399d:9bfc:1209:af10]) by DBBPR83MB0613.EURPRD83.prod.outlook.com ([fe80::399d:9bfc:1209:af10%7]) with mapi id 15.20.7677.009; Sat, 8 Jun 2024 13:47:22 +0000 From: Evgeny Karpov To: Evgeny Karpov , "gcc-patches@gcc.gnu.org" Subject: [PATCH v3 4/6] aarch64: Add selectany attribute handling Thread-Topic: [PATCH v3 4/6] aarch64: Add selectany attribute handling Thread-Index: AQHauapj3Gdzf0D/c0WAYEauW+ea2A== Date: Sat, 8 Jun 2024 13:47:22 +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=4cf5d1f9-3011-4a77-8066-ab2b27e02d44; 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-06-08T13:11:52Z; 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: DBBPR83MB0613:EE_|GV1PR83MB0651:EE_ x-ms-office365-filtering-correlation-id: 862f76bb-3ea8-4c0a-87d0-08dc87c185cb x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|376005|366007|1800799015|38070700009; x-microsoft-antispam-message-info: wMofnadrHFu4IztLNWt+ov9Ebal1XaJaM4yfDNcHn7Q8uL9sZo9B8dhsaw9AI/dQ7km9Eq0HIKG0yVL8RBxQ+94dekym/D3cFiC4Ijy3y/cExVAwqPS0/40ubkgfsHdZu4Avziz35gBKiwcU07ajVagLvEqtv49FpmpKEQQ+ky17kfKcZJiKr78kRDjCUqu4f8FR7n7aXvg6n1sORt1K6DIHBf8auYGQGqepqRAt1JBINHncom9tNUPHDdEvBSuSJ6pb9gsKyVoh0leoVFyEEM+0yT+U0jyDLZc0NeuaXIQLm5eqsQ1zRwibhhO26pwruXPu11z6rrE2e5qQ8WjV2No+ebpZgNjLvSKNp+Z4I0LcbtYIyAg49ldr8/NckD/a2rWYHIq8vp70uT8XBpQNZdQxyqJ/8kWVrAKaFPmgcO3PUfnow6J88v9WwYPvA7O3R37ngl1fRIy2u6W7RZZawNov+LAYyWLNJ7V6PxT8syGJFAqgRyKrtebAHyGVFpZNGaj6r8SyOcijNp3iT1TE5glP+dtK9vzm3EfmG41au1pNodX2yeuugAUN/d6RI+mtkZRbjv/HqvWatGYXdvIJIxD7PIxGQA5W+UC/UopLjl1vSQcpMzbABu7CPBJ/uIhkkyaOte4nbf3MHvgA+ymQJiIQQAnpZK3TP1NFWEhCdJrm5mpnVj7IJTDuXvfVVy8WNUZ2Rq93iZJ9uMhQOs7M/Em1FmkUPadKKmPO4nlpqL0YLDMIusDlXMThE0IjyA2ZDdA/KZEPGRCGCunkIAw5JNGqMXOn2YP0f15L/hxabexCbgl1NJD+VlITdhJ/JRAQ5ydyowu/9M1B3GrQ5BKMx3DJWJL+GvB8qiuPJphCfm2yN4+9vjxQs6DNe2dIKaKgZsdQMWjZGEa100Z9v3u4XXq2kRLgLo/iLwPwWMBWeT5mSMIRD758aFyd7+mgqT/mZrou7uZzy2ECz4hgXQH5r3OO9012DaVOWn2jusqz3NvqKIe/U7x29mqrgyHruDRB/0Zgfi2a/SCh8NAdziBzH9thZX5pel6UJP8EsRK99g4vmUaqCgNzBjVShFug+S/OVGnTKWEitKLDIydaWjdwERU9AguG8pifXyhxP+KpykPZ9m5EVlBcjfuhthjX41jwzj5KrY1RXVTT01iJIFcUsFAN6yey1IxG5+JzgCQDyPtrmR6ukaJHnrFPn+Zg/SyCs86adUADhzUMBRStWEl9jWU3lZE7qAPD5mtK0dRn/35MwrDTZHOAGnQ0x0Oe+Yb4sPPLH2pmc0lCAgUWtZMbiRfyrD+Jzvb63oGSx5vL/Dmy850keOPYYVVVjafgPiaiyg7/GIJS034m+O+QinAStAvBkgJMNaJk5qZXUtCEX8c= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBBPR83MB0613.EURPRD83.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(366007)(1800799015)(38070700009); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: wXKgbB/4XF8brQhBvjm1k03mizItgagApLcOvQ4ccfBTKhV0xMV4c+1I+0ErceYNADyItrVZWh5YnBXNnnNJJU/+yGnndw3rd/zsOtPPkCyfb1XYP/I2SvOI49IueMl9dcZmMClkaRvic3CXcz9ACpvEwxx/j+S10VV/ZWs7+MkAA0khkuaYthJRkAzLjj+CVAG+LNHQIcxsZzKG5oKlob+TVt0+Ui3iJ/0qhNSgqFN472sxhuyRfXSVqVU0ADKgJJvx7gjFF6F4Q87PkHUXCZHW3xqVE+ktBpha2LyNxCLfbLpsidAMBeBKyFW1BHefAIrmLrKsuow0Mv663tj+yoPoakEXC6X/jClxKhwYRrZW84krUzVWBwWiF9POSpXrXI/EyNzM3w+CEXz95+TJICdLh+SJCvPKLTvG6kDzcn9B7/ogDmdjGHK1fy1vAkjBRyURsQxTWU5jYuInwdeZVo8M0piou7cWynAi6Hlx+AjP0DbMkWszeprYg1lTsRF8HdNyuQLdTvd0uL7eRVQ+ZVRv+E4T0JrvmxgFrOXHthCgqu4yXeVXuYf8NVNs2h5zbtuHtt0dFzqyV0oj65l0juiS4P9iOhP52jgw5UzqrS9NeUZ+rxoHCHbBsszyG8oIczrkjxBWXOv11qnH1fqdrVpmS8WUF5PBOLSSB6VsqB7T51GbaOtY/M50KRsqT5yulOXZv+yX4A2OrBCe0k+nB4jmQHTMuA9IT/LelIRxataQlt3LR9BmXLtkpEZNguu/77o/Io2Beq+D/pZ9eLfKQz9l66XrMHNkz8XFybazV3EVcOG9GhgeG90K5rWngB9CfqgHuy9nqBvapB0I41CMsknL1V4ikouac458+MbuQuEV3r+6tAyRjW8EIXNsoUJXh/99l2iY1OVGwSE2ZVIxFVAAS8tJB56VpjSjlatK8lUzBKBL65icMQRQco6TfxksDG9KZuKWdM25fvSPzkTP+zQLk30Ckx1EtxkSGNZs0F25rr5xJI08G6QOCt55On5Uf+6d/GO+r6nMqUCObHxE80h61FxzTLNkPpRrxvUgjjIca4eUMi8Si72/wa2/f3YwESdG3ETy2u+ENWL4mcPBm8W8eu3XnNDqIB0ot2VsNy2tt46azTv03YdF8PBBr8xNdol7q1bA5UapJ9pakKey3cxKhBQ6pxRZRt80XsZ2rp3Ym51cN1AFujD1yWEYSy46iIxnVvACVO+xS8eLaSLikJbZfqnbTlDmlpOPBhZucyy3mEoRNwNY34CAQnMnjo4H+zyGaovUOKEWNLLa+07gP3WtAnJDQN1VjiAsd+mpRfSKsHhTFwYk36cTT8ZpGKJVz2/5n2z3TxH5KS3f0WkyhcDlUXhhGK5/8CuL1i3m9XbNRKck9L982uplCKkkyg6mQU/Y1QEAe8/QFfjdFzcmdM5RItd/rYvkbBoipIfqxFcYJu5HqefQTvHxnHKtHyqSuiliQOM0SIPUlXKP5FII7nJiNBGF4OzZHEWQLmTM1Ci+idFdc75y52JZzJKncx+zvan9REDSa5n4f7xBzuSOOtN4fSQwlNCPBJ5XGxRHrYn7/Ekz9tm4uy0dinlpsNeCw74D/YLnHVPJboNJN5AId8wo5sZaiXypKg+F49BNG2ISE0yTNfVv2JLJY/LgmrsH MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DBBPR83MB0613.EURPRD83.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 862f76bb-3ea8-4c0a-87d0-08dc87c185cb X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jun 2024 13:47:22.2477 (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: FcZB1/Fk24MdAyhWXiIZSt59metYrOXztLiVlKNWrwiGy2KvV/Ud4fGQBtX8TpIKe77+TvuW6+OnJcsEEE/3Tg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR83MB0651 X-Spam-Status: No, score=-10.4 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_DNSWL_NONE, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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+incoming=patchwork.ozlabs.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 13191ec8e34..3418e57218f 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -859,7 +859,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 Sat Jun 8 13:48:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Karpov X-Patchwork-Id: 1945481 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=microsoft.com header.i=@microsoft.com header.a=rsa-sha256 header.s=selector2 header.b=jvmPdgoi; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VxKD837dkz20Py for ; Sat, 8 Jun 2024 23:48:56 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B00B8385DDE0 for ; Sat, 8 Jun 2024 13:48:54 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on20720.outbound.protection.outlook.com [IPv6:2a01:111:f403:2606::720]) by sourceware.org (Postfix) with ESMTPS id 29BB33858D28 for ; Sat, 8 Jun 2024 13:48:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 29BB33858D28 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 29BB33858D28 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2606::720 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1717854516; cv=pass; b=lwzzXtIkRl5DGGFEaBS/d9u9BuL3uda876LNcBpb9tLbL23JdZhg9KZK77t22pUMQOPdyiE6k5Xj2/IzpuABtPtWZtbzfdRu85gNTd3OtfjDEPN4voZ2PXNtvynkulwaFdvuMsSHIf2y8/RX83LZODpaRWZMdaVhE2B5cjX7Gb8= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1717854516; c=relaxed/simple; bh=B6SZcAONdVfO289Y1GFCpTm7823RaN6DBV/MFA2gZhs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=tsOGncf0DDgFXMXORea5yIpjN+gvWpmv7G7E65Kz2tcngsqduSIECcsgc9zMkqMKt+uZfNBC12oADzMUzOx5T2hMWo5jrmHUp0ogLzR689W1Ip5Xeo7DebZOiLI6XEBiZWNe7q3gEK6/hoi7wE9s8YS62eGk4twHl7lyU+z31SE= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D51VqAiqX9wG2IwNb/Zx9ymImisqteonXPlg5dKQsbD5nxQ2Pp+goww2rLcTuV/BKi914kUfcNWgzTIxA4lGfh1tiH/wBDwVlWzdhmUO93BWzWzcQBEjMABYhoU64jXPVLW19dyFQzX1ufpErZ5iSXS/T6YUfmY3C3xIU0yBcorNAmL9Qb0S48ciLD/x3f3ZYFN8lHVkr4kkThatgsu+yJKs/xAf4+3mZR2zE1RKZHy3sQ5KbEAPFGnCLadU9PEJbfJmdfYs6JplCygxQZXGZdBy6vStOOf6V5i1nIoJnE0oay8oVMnDZ0LWMOv/p5Ox/CK2sMuOf1cW7xOYztrq/A== 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=ImOi2F7s/1NUHMO2BoRkrcA2mUXmQVDiYQ1ccCfvPCg=; b=iAd+U3PoSMx9/yojF36uLMhHvoYWRbP3nX5a2x/enHYed8N9oMtcrTppBu5z130UEfXjQYroCsqtquy4i02jsYX8HWYsRn5lZ+HLq2vOj2+xWwiwLb5n9Q7NITGd5/Hih3WVdwEGgD+awY0uz05TXYnfd1/azVEjdjKw/QBGyzurX0bj92VyLApCkVzKw56zRInl/cR+NtqYo/MWbINDRIs7jh6dtCS5fxyGMxeebCPtGiOfKAsrQX8bz9Ezo7iIF0TD40vWz3uekJCNkNs5SGiYWJ1JdIipmTG6y4fL9dPtY3gph2exlk1BgXoyoQa+Gzl1ojaI44JiVIXgk3Bksw== 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=ImOi2F7s/1NUHMO2BoRkrcA2mUXmQVDiYQ1ccCfvPCg=; b=jvmPdgoi4BCw6CCOQurzWIPWxE9dvN39/n37h/UkhQXKULvH+vGRCTmt0RMSQJP4B+4xjUhCN5qhf+Ip68HxHormdh0QscQwGGE0Sq2nKqvFYj4Un5MLzMcUI7HfEaxVJfje9aFWKhj473Z7kcMOQ7fE7WN3cyHs/Glkd1+9hFk= Received: from DBBPR83MB0613.EURPRD83.prod.outlook.com (2603:10a6:10:533::21) by GV1PR83MB0651.EURPRD83.prod.outlook.com (2603:10a6:150:162::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.13; Sat, 8 Jun 2024 13:48:31 +0000 Received: from DBBPR83MB0613.EURPRD83.prod.outlook.com ([fe80::399d:9bfc:1209:af10]) by DBBPR83MB0613.EURPRD83.prod.outlook.com ([fe80::399d:9bfc:1209:af10%7]) with mapi id 15.20.7677.009; Sat, 8 Jun 2024 13:48:31 +0000 From: Evgeny Karpov To: Evgeny Karpov , "gcc-patches@gcc.gnu.org" Subject: [PATCH v3 5/6] Adjust DLL import/export implementation for AArch64 Thread-Topic: [PATCH v3 5/6] Adjust DLL import/export implementation for AArch64 Thread-Index: AQHauaqMbJxic61Tk0qoFGVmJkPMFA== Date: Sat, 8 Jun 2024 13:48:31 +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=4cf5d1f9-3011-4a77-8066-ab2b27e02d44; 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-06-08T13:11:52Z; 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: DBBPR83MB0613:EE_|GV1PR83MB0651:EE_ x-ms-office365-filtering-correlation-id: 8d242700-6e2a-4e16-e2eb-08dc87c1af12 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|376005|366007|1800799015|38070700009; x-microsoft-antispam-message-info: ahaRYAo4qs0AdA6LrRn8I8x2HHM4Lmf3HYqjVhaNlhAEErhKvEe3RfoVjr2wKrheNN+c3bwGvkke79VO7FZRbA42vdVBdM9yXV1zYAQO8prGMUMMiSzU+yQGO9SRZJC65bgaIDr4qFEAahkJkgKgR+Xb3GpfFsWqbHce3KIJaVYDqSIyfvVRAy2JU5EbK6CxcGpLL0pwNJumMpdytjF8C7V0bhYPLB4az4IhwejN2ac3bKYpp7lT9j9wxjNRa5FxHLR6UvYE0sy9Mi2DcXcGGnLUYS+niHdM4vvV5BoVl47L2CM5gO9ISIKdsVc/4TtVAc1FASOl5hnIoQXbQW2MUDb69VOmLJDEdOl6tWuZnHjsztXymzjcpI7uI9aqzsBlcE7H7sVISYEiaS//pAn/QR7V0G3V19QmU9cuk5pbNYb8sz9YSsetnrhXQdpn8SOlWHa2luYp7lr9Fuy4Fi6P00XGPSSpOcXdl5XJAd3xORsyOAgziz4hjLVgqIz1gezYVCYNVF3cMzU6jF7jq9ptkxwhqAePg8zxtkT+dNLyilZZMMHsxb9Sru2wg3tRlFEePKvIoILrUkBzR8WdZU010ISzq0toZmR87b7Pbmm1dS3+QS+gnEqKS7i++PfdNz4k/Zm8O4/r6R0LRYr80OJaIEyZZdEMsvy4LSLijqljSAOJkgXVQwsieVkO9CzvDfpv0UEdU6oDuSfvMoXS+I64tJ88pmU5Ly4vmMkMF0XhydfUELJQd2h7DzuxnqS+iZCVNyz7Sew6zQRb9oi7R8aoN3AkYdHrqJ+T4964KNJnf0E57Bqqixz3Gf1e08+e0r3pl4zsM12jIH9QuO+Z+Mt6Rd7L61fhxZqndXxRr+HevxdMEneE66iSzmY43nyA0BejfJR6anyqJTzZx1+psoHLXdpKSnHQ879i4EQ1dRHNJLfuxm1a/3pXOi5TckWXH/sD7IkEmpjtMQoaKHxk5kW0YwRAckFAnSdGmOI2Fx8FuqYB38CSjr0CCrff6/S2JpTCkYKZhVkhWlU0sl1BkkkiBo/P3khFQeMEsegezylhv4NX1Cv6fbIf+CtmCXfI5VoibJExRRJq1VX/Yo26RcEHSSKs4uImeeiOuj+IgT69gHFyyh/ML/ae0BWlVTUAeA2A3nm6Nk3pw6usznzy8OsLSoTtMk1nbCyBoRgFCaH6BMf0dnzrlZ9UyT4xW0DiXDeDJEetweKdHA9/EQyA6FUkFPafLoQjlwXOb8V9cZBdILzjZG8SqANkwPReHxP3XLcn/rlxGEw3yOO0HS2BDN+RcEcNvvRmzqdNuJfCTXTUgxKqajGfwaj9FbxpbG4twz1TZ8s4oNSKFbhH6T9HjSFvLWh50wuncU53jlAVh94Bqr0= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBBPR83MB0613.EURPRD83.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(366007)(1800799015)(38070700009); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: /tQkeeuuo8vZ+cIWpsk1bX73gTBL01VJwrAl8Eyde1rfxh1hZsL1PVFxc/xt7iaW2temnmLWgdeOVPILBA6rsMK/ut+p6g3RzQ8KFPm+yCqrjc7LnjieEhTu8vWwbaiUutC2V+sChBXYhCX6s2R5CNDomp+Iuk7944PiKMpUJH9g757Z399PZKgrtktFwr/P53JFQZeL/MbCS6rGpjLZwVpI3sYgtvSIb3u+3FNiorZQx6EVwQEElPTqeHE2TZvndgsMFU1e/nUeATZyw3exIWba8HeXBrB+gjvpAUC/5K2n67qkMdzVrS2+hyRCH+ioDOuxFDNrBw4obxV3w1GOaAV8WZnrlDfKhVO/NOWF/zP/5AWhMNQgX7xaivwk2zLquIRzRQVGd/8kqmhKE357M0HPhbpeVGudyYXZlWtt5fUOyxFDqJp4R23vtgBkmaCkqnOsSHbU3XDYwRzdLFcGxbWbq5rKnWiwAP9p2KzGLCZxWxXMHtLsVWix42KMOXv7MWSXl9NSNJZ4IDdY8WSG/SrDBRWJ01j3/CGkavBF1PsUqfh+0rNeu4sdH+JmlNvOc2f3htKYyAVJ8ILB+W8v2FiCSolCoBI16NaUAI8RTIOu6CQbq5j8Df1H8D0JrZ5Kz2/jf6+qoTFR3zcuMmObVx/rWpA04gdVSNUN0+RrGD51kAJHMcKPGB1DkPkOdyBG/iK6yttyZ8PwXJdclITI6ei+aPtMo/ZpRgWRi/QcZBmJkeMy2ASyuvNF1V4qlRgXgxBwpki5/XL5yTUtANOBjzmq1b12A9Q/FazqU+KKFCldRN/0Y2nY4dZm7TCZFcJwL07ByC3lSXmoEn7qkMfUn2FArG7wW7O/7//olV1U1ZScjCWsW4iE8hIHeuGpVECzNAnQFazrLFT1SPWDWaF64eo/IENyMXeqGtDRLtgUUQ3jR0ux5AQUdkFoa3rjuETns/7h2lQnR9uzRYIf/PMMD1yJ7+iNc3Da2iTtjtypvqlaXZS3CooYNoqK5s9fObnkymfzIi835VUOfh1lOTkc5GVk/YPLWiwhGGTbhlH2kC4CuHh8GvSVGGoTh3P57PlvGDFCEFUHfgScvskfbhp6aT2mkrJUeQEZQB8XJWs4uRxgla++K1T9K2wmjGaZWG1TdVSJi+hALbCuk4OHmSaMe7wscJTD9rfs6JaOjbVInYS91Q4ykAkxsgEZCj5zsjzVaErnmQM66Otv2Nb6ppNCeXu+Oi0hEBcBq7o3j9pxDEEXKAgE+FcXPJfmVRAqwb8gzIkJ4JaB1bPcAxD0y86vGplZuCVgR6jkwL3ZiRFKk83qDRZuIU1+Y9r1ThLq9EcVHTNfwPmPd8SH94vWv+ztF8CIKM7VQCS2lYOgaKGeQB5+ROvVu2k4sEjDSHG3o775U21hhs4Wz11pCMl0Q61CMLP23m9Y+ofE5kVll+3QcKOht2DJOTcvxXyHc/W0Ue8Zf7ow0uAgmK1WYwJYFt6qpf7wjgMEOA2/qjC+OG7UGd2GCQuhdPbFkaax/fRfqfEv++UsSCOiZfkQeuRXQT9clcvkCdVvEk64LClo9BHmrx//UCmDhaNwV+c35u4rlPnePhEKUQ68isFy7EbqjsI8XWnMh7WZnYS9p3macwj0Y8uwbhejq0ax04RVnXCz1/it MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DBBPR83MB0613.EURPRD83.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8d242700-6e2a-4e16-e2eb-08dc87c1af12 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jun 2024 13:48:31.5246 (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: XvB3K5myF7a9L9/XQiEYWJT5WGPMhtx7d82EIcFAwCT2k71mxqWAMVtLCNPQU0NTNFJXHHkdPFRVD65UaOB6qQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR83MB0651 X-Spam-Status: No, score=-10.2 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, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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+incoming=patchwork.ozlabs.org@gcc.gnu.org The DLL import/export mingw implementation, originally from ix86, requires minor adjustments to be compatible with AArch64. gcc/ChangeLog: * config/i386/cygming.h (PE_COFF_EXTERN_DECL_SHOULD_BE_LEGITIMIZED): Declare whether an external declaration should be legitimized. (HAVE_64BIT_POINTERS): Define whether the target supports 64-bit pointers. * config/mingw/mingw32.h (defined): Use the correct DllMainCRTStartup entry function. * config/mingw/winnt-dll.cc (defined): Exclude ix86-related code. --- gcc/config/i386/cygming.h | 5 +++++ gcc/config/mingw/mingw32.h | 2 +- gcc/config/mingw/winnt-dll.cc | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h index 4bb8d7f920c..0493b3be875 100644 --- a/gcc/config/i386/cygming.h +++ b/gcc/config/i386/cygming.h @@ -472,3 +472,8 @@ do { \ #undef GOT_ALIAS_SET #define GOT_ALIAS_SET mingw_GOT_alias_set () + +#define PE_COFF_EXTERN_DECL_SHOULD_BE_LEGITIMIZED \ + ix86_cmodel == CM_LARGE_PIC || ix86_cmodel == CM_MEDIUM_PIC + +#define HAVE_64BIT_POINTERS TARGET_64BIT_DEFAULT diff --git a/gcc/config/mingw/mingw32.h b/gcc/config/mingw/mingw32.h index fa6e307476c..0c9d5424942 100644 --- a/gcc/config/mingw/mingw32.h +++ b/gcc/config/mingw/mingw32.h @@ -82,7 +82,7 @@ along with GCC; see the file COPYING3. If not see #endif #undef SUB_LINK_ENTRY -#if TARGET_64BIT_DEFAULT +#if HAVE_64BIT_POINTERS #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 1354402a959..66c445cba77 100644 --- a/gcc/config/mingw/winnt-dll.cc +++ b/gcc/config/mingw/winnt-dll.cc @@ -206,7 +206,7 @@ legitimize_pe_coff_symbol (rtx addr, bool inreg) } } - if (ix86_cmodel != CM_LARGE_PIC && ix86_cmodel != CM_MEDIUM_PIC) + if (!PE_COFF_EXTERN_DECL_SHOULD_BE_LEGITIMIZED) return NULL_RTX; if (GET_CODE (addr) == SYMBOL_REF From patchwork Sat Jun 8 13:49:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Karpov X-Patchwork-Id: 1945482 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=microsoft.com header.i=@microsoft.com header.a=rsa-sha256 header.s=selector2 header.b=N/9bcAMv; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VxKF91MVwz20Py for ; Sat, 8 Jun 2024 23:49:49 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3C5453858D28 for ; Sat, 8 Jun 2024 13:49:47 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on20717.outbound.protection.outlook.com [IPv6:2a01:111:f403:2606::717]) by sourceware.org (Postfix) with ESMTPS id C9441385DDC9 for ; Sat, 8 Jun 2024 13:49:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C9441385DDC9 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 C9441385DDC9 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2606::717 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1717854564; cv=pass; b=IPi47CpavDyQfvfROG10VJkXFeH6oJiKBPNbtr3zwGECY7EpYXj0KJr8h4yyc+aSfCRNgSpgwWasODRL91H501ZmB70KoG0kH89GX9WQxpwhaGN2fQI6UgOfRGXMAf7Tj28R90+l/x58/7yhX1NwUkCyK6B52n5ipCjWu3bWeEE= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1717854564; c=relaxed/simple; bh=4fHy+bIF6PekcXiltl/Y+nzzbK/T4dAl7EFcgRT05Rc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=eI5ao4/34uK82ogm1b+P75YaUpTxiRBIiSMFQP+pzP1ecdMuAUYm9C1P4OY6tm6tbz5hFBLuN7PLJn1dxR8tMcEeYRQ9jZZCWBy5naa/nXD45YqElEI64ya+s8W4qCPPhMkVUPSAxv2mU/bQdFZCT/oSDvzBMokVYmcCpy4KKDs= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AXRnllvL5M5FtSiZ4cfZgECTCft9QJa0Zhk2UBNmk+QwnNeYk4WA4QxaaOV5C4/8+6Kur1o4szPDaDtKfxLR9x5s3gdpMhpGda9h8pKjwzd7MFAikIsRWLvIdGjrFV8S4hvoCH4Lp5SjUA/v/8BC5llmjiPafdDbFqrK43S4j7ITUEKqNYSXmSN3gs8JHha15+Nh0eFz+aDS2mORokEz/qrY9Lv36YPK+c+L+kCY8tnaeaht5h2OsCBDFkVnaGAicxLBUGp3hYwZROqfPeSJ0mBsCVW3zBI1uO1sjFc61xo/ToOZhbNZcdE/JpkEax8xycu/LT1Qt+u7SenlMYHLlw== 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=O1SsnLn9m+Di0++EOKWkRzUiwxVb1p++pnEW7Um41yA=; b=f6QW5e6DICBYlzQbjTSOCfisXLumHD/+8ags8nJQ+KDEImeyBPJNoYZ/T2c6sr4iaLwqnn0N86SKGBpU1L3zBpQmY306odjcU7F/cqGSJOscKLocZCW7+dndiS68ufPT0sRcGfdHqtkrmfl+EPvF6QzGP2ZE8cVcN8cBzi/bL7Ppf/uQCSUbG45SsKIn8RLsMUI1F2Q/CtmXEcp2LqjWL1crPgVq2YR9CmrYZG6UDGMW6E5JitSJqe2yUYNVeipCt6sA7rSTcgdwIYUWflPTvdWWTnEBwD/xDvOOQgZh9My4hNMwmLzgM/3gInyeWNoQxV7zrtbvFYgJTbJcesE0EQ== 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=O1SsnLn9m+Di0++EOKWkRzUiwxVb1p++pnEW7Um41yA=; b=N/9bcAMv55HV3oUnlOfe0r6Cw+BcAbHq7wQ1oAoWX5qk5ZVaqiD4lRnY2D42FSbAxVwy33r/a87hYgs1cf0DqOTHdnsBdH8ZZTuqbAomqCoDXpVHlWjVVVoDxYEoycH2kFeyfUYIqsbhChR1b/qfE55kYchSF4qriCqfbnKPQOM= Received: from DBBPR83MB0613.EURPRD83.prod.outlook.com (2603:10a6:10:533::21) by GV1PR83MB0651.EURPRD83.prod.outlook.com (2603:10a6:150:162::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.13; Sat, 8 Jun 2024 13:49:18 +0000 Received: from DBBPR83MB0613.EURPRD83.prod.outlook.com ([fe80::399d:9bfc:1209:af10]) by DBBPR83MB0613.EURPRD83.prod.outlook.com ([fe80::399d:9bfc:1209:af10%7]) with mapi id 15.20.7677.009; Sat, 8 Jun 2024 13:49:17 +0000 From: Evgeny Karpov To: Evgeny Karpov , "gcc-patches@gcc.gnu.org" Subject: [PATCH v3 6/6] aarch64: Add DLL import/export to AArch64 target Thread-Topic: [PATCH v3 6/6] aarch64: Add DLL import/export to AArch64 target Thread-Index: AQHauaqoIAy8YDhSP0aVE0VJh6ovtQ== Date: Sat, 8 Jun 2024 13:49:17 +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=4cf5d1f9-3011-4a77-8066-ab2b27e02d44; 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-06-08T13:11:52Z; 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: DBBPR83MB0613:EE_|GV1PR83MB0651:EE_ x-ms-office365-filtering-correlation-id: 9280952a-b585-465a-63a2-08dc87c1caa4 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230031|376005|366007|1800799015|38070700009; x-microsoft-antispam-message-info: 8O6TAnxjVIzBq68TW+O7TvH9L5LA5QfGr5NquZB7C3N77Is1vweyyk+/ItzAFfKEzp+GCx1c3G7APIbnNpz07xAfpqQMtXjLMwBxFb0iGGK2uMk/1fSLYSz8yzhItHOW2bQroDeB0Z6b4R9fBgFMhblSOATnh3fYiVkGm36zwqJwBi9uoMRQBi2k55zQhFsVhKr3VVdbXV5aTrNLIK/rvWdyreaAGqZjtk529cdDsN35Bue3C8M3WiNzgnb8kS72Lb13R45z4VBHP8u5xgGOCdkXGV50OtXMHeFcbLaB/cfLBIB+EIoUHhDPVqXsmHNpUTOGDF95h85bOj5P8+yfolfD8n6F7QTF/xw3UDImitGsfO4Xjc133COe9N0X+A70zxyaVTVZ8RIwy3bOohNBgkmr6J4iRe+Euiaex1NMqjCJvjhlg9tmwpnWvGKNQlOl06A9iR9LY7u22kwG0MSpXfhcAE0t66LVak744QSXrqdH8sy27O+Z/nQRlkv1wbiyzXAe1keLYRSBf9Sh15OzMxEy7FRsOk/GDFSGiTjcakLDRQ7qOAmg5Z0kJIgiVKIbOhkmvYR7T3VYEPs81lhSN69zB3Asf7dWaNr7A/kLYLUADOL+7rXcMeJSm93wviJCGZd4LWEj8okZNpAycHJ2m1jc6PzZyA+cW1+HDwcKgGvTtAcIxPiBV5hseyAnJBjMn6mNJff7n/ZXNlhZcREIlqchwc01xa1bMHLwIQ7Gw8ZtoAq82cIVJnzuu3mXItlTNaWl6VgRLj/9242Ms6iVwi3Wp8BySlJjuXmRr0KxNIANO/x0oQKHe/i53k3bdenGVAgQ8utw61hga8DvsAg6CqEsF7WkmagHPXGxrq3amMuKKHx68k9nWIAnU0qgOwrSOUY8SaK5GFeJH2TrLWIYPQlclA9vUShTAetGsDtTFKulxPm9aaRQhTVobJ7I0jtpOQO3dttB+AfOJ5MNaR7ObUXRPHKNjWzHfHN2ZUiEJuGN7jh2kPQV49JnLqQfWp9x5xtRDi0f9pe1MImpq7KzaSiCwrO+ueMQax7n4UKIzOXlr5lUUGPZX8OFhqcvGTHI3HZGSd9jMTHtlEUPtNGpIScAY4azx0+3YMXnUXruT0auL+4MupjEmimhVGN8w+jg14xQNjLYuj1204ixNTRtUSDqA3ooIkLdRwK3rX+VtYYRP4Kpg00i9a6GHgHkaj3CCQW7EWmXiIAyleP/csh+e9ie7RsCzshW9YgfwkoCRzgJGmPLe4MBNHieSsT+7cinWeZ/YB0/WDNfHK48Jp5Tx4Ml6Nfcffv2lTaqRZVyTdE3O/VA8qRdH5aweEf/6SQjA95SdbAcCeGCBDszsnnpXV41fxtyY1gjdjmsOHsFksY= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBBPR83MB0613.EURPRD83.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(366007)(1800799015)(38070700009); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: IDOiOmQFMf1jkjuVrFVEfWO2Cmd0CayjYa0XQNyHPuPrneoaZQIY2AKnjGN34MOg/QiAgeeAFTvYTKEMtquiYSePLmjVYGX7Xz3y++x3rOyjcq76NZX70hxWxm7BYyLfaUwdqGuXTdEinfJ21y/2L3Hny/eNR9bolfPJhLOa24SWUhPgCF24fjW7zlZ+Xu7SUUt40hikNOhXJ9dmTlXPlw9Fo1Q/hBtWen5Sy92nXyzGFmGrqpJw4j2JFdSjBJenycCTUrW7kO+kN/XTh8T9VFvnbx22SYa5Ukb55EVqnRRC1+K4YJ7FtGoItvrOcaZEGPCQHNOD5zuoSUZbiEws1CDIh+K9x5h5WUmm3zf3FI+CbvMLQNc1Oz0/xh5ImHLYXFPYUQ/L+K+bcbkXVfAL/ynPizizGS3EIZk7SOtkV9vnD4E5/lqeyv59AQPMy90nxe89E5tpuOeZSxygkM7ofhl/+sqMbtHHeRpmU6y6Ir0rHGE269iAvkE0P83atv1pIgJ4yw6nRAFdcF2QlWInk/ljzcjdXnfefn5/HEql1GTbosZppfcx6BySYxeej6Uru23qG5AE/LSA8CcTTsjJxAccBiFpxrqDNNTyAaal1AE1MyGf+BrvWh6nxQn1+RInZjUavVweyMB7OLpXqlIao548wkAx8Wz/b19DP7ruX8FKR2MY/NPYJdaa4asVco+Dy0LapBck5pL+kJdZzPy4UqiZvbmf8TPTEFYmDjcd5TSjAtp7OeuGDh8XLk6aEyVYj2Zdt4PMVDNs3bHTfO1X8ZLqdYWzyn81bn4HnDJJNMoqhrpfrxN/8K+wg9+YukJZn3hupmhv6DkoNo6SvAy8zNHHn1ncdYgP7WwLcQYPRwVfNEC8BiuG8e5teWV9SzlkdYHvDdaZHDL1oMzolN1cP8GrlSZjcAAcbQesteuZ9QnhSBooBcgLvJTawTv15uhfkqPV5JSdzvs66InWBkTEa2IuC4qZb4w545haBnkACOldyAWaH7yU/XH4X5nii1kz2yJ1i03fVY96YFmueXumJgFarvN7pqdMCkpSmWMXtPt8gtGYhZnkrzgZO0p9+o/2kz6dA1+/vZFa+tkJEbmqwtmAQflTJzXzQ+4dPz2vqlgThDIbd/ImC60qqmSVjC8qOTTrNujd0u8+/6raZcR0NA5EDmkru3uLprhDFTEtQ7PdBJL/jnr8GOTtkGXHEo2pcOd4X6YFo1mkHvph1Dk03zyds/U6kNnoqB15wVpSkbsozRgXP2EOS9bxbx4vrw1OdQ5Vi5ivDaYm7pU1WKGh1KWHyM7zuSFPOHa8Q7nsX41+fIc+jGWEVSTkFyO/tOzCUi1b5WzZkkazAx5wONBU03gpmdV2kGx8kL1Omp68kGthkJdSGi0CfyVYloxnSriJiJPpyNIENynIKZW/6rDThFbgMBW48e1VsjdXLQNaCJnTeIaj9hJuLvyVDUBX8v+fVGU3+NJLj9zLMs18VapSsmxqn7gE0gwSbG2+MQZHOtUqU6zSe5PjnoJORIFPHb8hIPWFu8YcovW000edEsZK3tVZI/obcNj1DeiDg9D5BIas36j8LLEjizFXk9+GXEogZVx5CA9hLzWy6bg/BaieAQrfYGQ26fD2RT6H9TsZDQ02AEBzfEARC+MGxey93+VI MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DBBPR83MB0613.EURPRD83.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9280952a-b585-465a-63a2-08dc87c1caa4 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jun 2024 13:49:17.7846 (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: sOn8vb6bPn9xrBbUqQhJyzcj8AFmEAJPJNXGk6S2iNXn+g/LLtLBZJDlGCxO9atEVosINS2AG/ul+RtuX7I+TQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR83MB0651 X-Spam-Status: No, score=-9.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, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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+incoming=patchwork.ozlabs.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.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. (TARGET_VALID_DLLIMPORT_ATTRIBUTE_P): Likewise. (TARGET_ASM_FILE_END): Likewise. (SUB_TARGET_RECORD_STUB): Likewise. (GOT_ALIAS_SET): Likewise. (PE_COFF_EXTERN_DECL_SHOULD_BE_LEGITIMIZED): Likewise. (HAVE_64BIT_POINTERS): Likewise. --- gcc/config.gcc | 4 +++- gcc/config/aarch64/aarch64.cc | 37 +++++++++++++++++++++++++++++++++++ gcc/config/aarch64/cygming.h | 26 ++++++++++++++++++++++-- 3 files changed, 64 insertions(+), 3 deletions(-) diff --git a/gcc/config.gcc b/gcc/config.gcc index d053b98efa8..331285b7b6d 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1276,10 +1276,12 @@ aarch64-*-mingw*) tm_file="${tm_file} mingw/mingw32.h" tm_file="${tm_file} mingw/mingw-stdint.h" tm_file="${tm_file} mingw/winnt.h" + tm_file="${tm_file} mingw/winnt-dll.h" tmake_file="${tmake_file} aarch64/t-aarch64" target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc" + target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt-dll.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.cc b/gcc/config/aarch64/aarch64.cc index 3418e57218f..5706b9aeb6b 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -860,6 +860,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 @@ -2819,6 +2823,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 @@ -2865,6 +2878,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: @@ -11233,6 +11257,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); @@ -12709,6 +12739,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..e26488735db 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. */ @@ -168,4 +183,11 @@ still needed for compilation. */ #undef MAX_OFILE_ALIGNMENT #define MAX_OFILE_ALIGNMENT (8192 * 8) +#undef GOT_ALIAS_SET +#define GOT_ALIAS_SET mingw_GOT_alias_set () + +#define PE_COFF_EXTERN_DECL_SHOULD_BE_LEGITIMIZED 1 + +#define HAVE_64BIT_POINTERS 1 + #endif