From patchwork Thu Jun 27 07:16:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Karpov X-Patchwork-Id: 1953006 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=Cd4BLx6u; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; 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 [8.43.85.97]) (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 4W8qcx1x0Kz20X6 for ; Thu, 27 Jun 2024 17:16:49 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3ABBC3875DF2 for ; Thu, 27 Jun 2024 07:16:46 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on20701.outbound.protection.outlook.com [IPv6:2a01:111:f403:260e::701]) by sourceware.org (Postfix) with ESMTPS id AE7D83875DDE; Thu, 27 Jun 2024 07:16:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AE7D83875DDE 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 AE7D83875DDE Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:260e::701 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1719472586; cv=pass; b=GG38c/+KgNoBb8R8ETU3AtA56bT6mlktkL/JJx5qlHpX5yY2dBP4JWYf0sg0vbNOoPDa/GZThK/VyJ2B5B0ILHW3j8MAwWzLETYYkQ3HCIDFag4y5hk1N4lhWq5fgghsP8/DGMYGmhqJe2LYjtFU4e5Zaltw4QvcQp3NfnO5BZE= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1719472586; c=relaxed/simple; bh=AFMF7EbVNb0yYU5ZsvHkFhl1VdaYXmD4Su/yEfqkUz4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=pcZ79pXa2v/PZVjLGGUtgmXPLCuFBHzVGOU9QnJ7H+1WEb1iNNX3RXbtfnxRRDelT1e/T5KU5pFubSJgCqvEdQWlJsjCIcuH/bBX4glJ4fsENJ7b1xSh5HVKmN3292va6sYw05MrdDIvIUHEEm9ZsEkYBXLsaCbuRBEoj52jZqg= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R2Gmt5o5If6t9XzjJZdJL4yaTrv0C22y3OgTNA1rOOcczrU06cLSjhMm9VE8g/xbp3yRQvgNr9EyvEe+N6h65yqf/sP1S2XYkGAl76fHNSvu+w3y0aQIU86cngiwP/uGk0N90nOlu0PtC59FKlW7XcVO6xihKxmT+jh68v6wQZthmKx8hLGrVlgbRmNzQzTUJf4YHygmAfmhtAeHn0SGg1xRa664JVHyLo8cQ3TVaFF68CXZho/nOpskDjRZrG6ObfJOU2fRkeVJ9XG+dJws4DSDon4cOtmanPJFRWWK6QuJCgA1cHzQYm4E6v8dq9W4N0xT1ad7mOsnSoSWperN5Q== 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=hyPvcP6VuxNL3XgMxf2LfRkWa7fugrCoIU93AzBgvvg=; b=W78roO6AfxQJYoVnYb+FVUU1fh72Oc1A+2klWzvukd3vwv4Hn19knZAvfuUGR63JpDTH88tprc4MM0zdLzzHQmOpZxGn5f/xDJaz+HTKEz4Qxw+TITbuBKDSJSoPT/EO9jI9nFD/ZiL/AgEDsFs27AvoTYmEkelQgCbH35jCl7vz7jqIyddRzsua7sY2t0jHVeBSHykP02EMo4PCqeoOjjrcOnRgKtsCVkFvCf0cSUgD/8Je4EZ94RKeqhIvQnch/jVSnZfSU3dyFRmfPdTYhT6eqm7/N4fj2XM99Deqq7CMVqCZMnmy2SZRWJqDyRmpriywQdVBzXx8vdDkQBPNZw== 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=hyPvcP6VuxNL3XgMxf2LfRkWa7fugrCoIU93AzBgvvg=; b=Cd4BLx6uddnK7I82uFpLf9mn++nlRpki+6hSnTmGlsIypXkh6qIPIusKOW6Cq/YykKizEFjsM7YuDNcWl5QTdMzKlk0dlqDxDyJIZz978JvJJiWchcCsgIZ2LnWH7UH4cNBbnY5nR2waLuPYXD6TDWK+iy6Jkuno4WTNv8HP3G0= Received: from DBBPR83MB0613.EURPRD83.prod.outlook.com (2603:10a6:10:533::21) by DU0PR83MB0555.EURPRD83.prod.outlook.com (2603:10a6:10:321::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.6; Thu, 27 Jun 2024 07:16:16 +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.7741.006; Thu, 27 Jun 2024 07:16:16 +0000 From: Evgeny Karpov To: "gcc-patches@gcc.gnu.org" CC: "ubizjak@gmail.com" , "richard.sandiford@arm.com" , "Richard Earnshaw (lists)" , "christophe.lyon@linaro.org" , Maxim Kuvyrkov , Radek Barton , Andrew Pinski , "zhendong.su@inf.ethz.ch" , "sjames@gcc.gnu.org" , "rguenth@gcc.gnu.org" , "dmalcolm@gcc.gnu.org" , "xry111@gcc.gnu.org" , "unlvsur@live.com" , "slyfox@gcc.gnu.org" Subject: [PATCH] i386: Fix regression after refactoring legitimize_pe_coff_symbol, ix86_GOT_alias_set and PE_COFF_LEGITIMIZE_EXTERN_DECL Thread-Topic: [PATCH] i386: Fix regression after refactoring legitimize_pe_coff_symbol, ix86_GOT_alias_set and PE_COFF_LEGITIMIZE_EXTERN_DECL Thread-Index: AdrIX4f2GHyh/8F9R8uFFUBrx8tnvg== Date: Thu, 27 Jun 2024 07:16:16 +0000 Message-ID: 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=78fe9a3d-1ad9-4572-8fd4-d2ccae5e173c; 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-27T06:52:08Z; 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_|DU0PR83MB0555:EE_ x-ms-office365-filtering-correlation-id: cdaea5c9-8122-4767-a458-08dc967908c1 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|376014|7416014|1800799024|38070700018; x-microsoft-antispam-message-info: cg7rKm4L/NVT7FF8EdnW3OFJ2XXIFNs071Dt5JARbiCG42zte2jdjFor0XLfc/FOMOm/EOeKF8HP8r4fjZn0vjwWl9QuNh8m2dC8dkpzAVS0KQXCNGXHLQhUsAmbhEL9fVkYAhC+lOI2gwcJ+Nsb0otOFvISnrxqt7xd6IUMggitEkiQWceNZdUTs2bjViNB9ysuzz1LMpm0C2RRE2WuQVVbwitzYmjcdCajGPALPfznvzWUyE4BUSEeHfqTE2ehe3ExQ1zwdx2o1STZfS75gcyGeoeblKjfhvbys0z2/ZBAbyIqBCBCjItph4xQZNkE9lcCaFEVB+gyvG2/E5X1yXyan/PeoRnZuShqYy353H24oAJ2QE5fzO8RSYXI/vCRq1lc7b97eS+YwOSGnfnPWJuCFnvApW7sbJmsZ/TnVWVOMscmakKYEF8I+uUE7KU7A+ao1j1yb8fNuOgo5qTMP3sEeCSnzGtTSzeAmE4e+9ql57nWzNKe17VUQBpSSw4jsO8HdLS2woKvTHJS++82em8D+Yj96fOFNyZsFKb2PrvqmTASO7KH3LbtaMyfznvaqMSYaf9yY1bsNA8P4GBHhBCpRq8mgztbnReniIleba8JhE7L7yLc6Ij9OWy8STa+VlFC6vudqryvcIBnb94a5zwk8JydKf7ujDsApdmX61J0g1YhVwPBAthlf5TCIvLK+qaoNOM7lgQOG7taOFH9MQMMpdNbB1d2P4sIbTXSqz47Hj+XEOCH0iL9wy6QoE4qQYZtJAE2iZJZnCY5yYl/DvFPQI+vlLORJpsf0a+eyFDmi0/A+pnQZgGHYvAA54qMe1ob4d4IK3AP2essEKqk3Wg1/3rDsAIzzSsiEyfX4BO6O1uMjYJ41zVYVZ3Yt++Ovd7klIBWx4d5HvTgBbq0R7xWe1dJdbAaIVfVtuArCsEH6aGFfXc9jYj/hNxlTdjTlCK4Fa3b4/hQRGobmC44h5eMPnVnkufqJxEUttmJ+DGyHrKC4R2v4YDQ3T2qqkTCrHOlp+oGM79uh5wTw5Mh3i2VRstyxd7SNc9IY6Mv/5sDtZUAHlzWoQxMiFY+00ReYaga73WmGQSNKLr0V1LjN3qfecunt5Sxpu4AKrTXrhSlcCGLljrljvqiDbtOrr77/LdJ5+tYHF+wBrK8DpQ5d+gA3jlc4QrF3PltkuUTGPKsT3VRWayoXUL7jULzIm6utOb3SkdrQV8Pw+mTwTxs8Rv3GJuLxmVuQcy1BEkJbkxvy88ePgR0cPa7VFneCVOaA0V/snUCafuUV2uUx0gyEyq2vZjNClaqah1WwmzmrVOEcTbxan88ZxTA2Dpofgi6vpQeabG/5R4ugfWZNgsD1mL9YAVUXq+DutwOCdn6MZTgSPWlfuEbyE1/iUH6GbJ2y/u19EjKpwz4Dy15Dfor0A== 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:(13230040)(366016)(376014)(7416014)(1800799024)(38070700018); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: Gai1aRZTGKu9EOjanZtVBQ36zpAymZ2ZBG15ukLgKvBZXS+T0bQqVEgjusA6tbKrZw65SUip5wMHCTvWwYMVlh0wqjYMUVK/ONwV4uKHZQlM8UHFwUeWttvfZqkgUpjmufWeqHApfMxPBUQrECGt1vtjr5kviq7eFx7tLncXhteZcWcMfI08EgX2sx9vuoFan/CVoM84DctLvezzcWkR2LIdSiR2EPWnPmVjyqTAsDgE9nBdjUA/rGZdM7HD7PvSWjmaCsg+M+17f8Zro3n5cWdeNXHkNa3jAXJ54BVzimxfhwNQZYze8tAYFqVLMnkykTuXPnKx7SZbMS1h5zIBvDxlOiWzypUFKBtLK87ij4YGF7p2RYSTOeS0Piv3gEWJy1piL8tX3kpY7l6Q0TUzurOAcM4ui5HZ01icLB8lWW8fWgVICL3sJk64amFHFaW329cGnO/gSnWz6kLCjjQHZig5CF8bOjdTkCU/I6cIbusksLfnFSrSaZ4hVJ5Bk6BsLnGbx27pOFSHvVMyXRvP8HibWFZiOChWEysk/KpyFrNfKWeBtgSWFoSWr53qwaW4P/Z12R+IfW/fRToqyFABb8pk1oUWzc/ZnhSwT7Lvfy5Hmfw4ntktSRWdBzuIcbp/ruzcuRDm/mYTi+Dsb9X95MSQtGPkoSMtp3AS/SYPp0RWPZ9mt11yRno0bKUeOCeimrJ5f1AhLQoKzCDC5af8ySjrkTm+5VJt8ywJW15rnyT3AOwZ9prCAllxLdkwP9sIGWUWRhpv2DRVBZiEqijUga8bWui19DOfwYyd23VVYd1t9VbE5uK7seTPTlj1cU7y0mLlYUJ94QNfugyIWUnehaY9acOx9Gvrm04yfXRUbU4VUhPJmbrz5Y4fE9fhQWRaGDasx5bZI6ftKEj7eezfPojfmFRubnZzefWvPEEnOrZMn9gcJw+mhEX5mPzwveheHox5odsUonjSKJZv4b6XdmL/W7gKUP0ymNDoCMWk68TWLpHz/kNPs6mYhNmBxw/l8HMmOOmkKZsEGLp4hOUV6Ot7yn7qwZP6nLTwyFweOnS/OgRorFU+0wKNgPrNcVVl4YwOckgnihwO6dv8WHltdntSd8wDrBfuIsHquo7YZEyN53wdQ7hGB+PEmqVBzetd+F6MEtybfoIH+qKW8PVpJsrLyLlpkHzhPJ20J7fLoLL8mPsyaJeiQsQ9eLNC+X19Tjopisc//vZcbLCeVgNXPUbbNk4iElplo8KRHKfy57VAI0u+NgfH/LfU6bsJwmwbXYHV2NbC/kg4065t0wYpB2+4OHemGfTgSUnC1lrFAbrZ5fgv2anR3IcPuB2sBWcHTZcvg7IZpeOdRLmRuhhhKHKgLYdsqMAItMTr2ckMG555K4Gltn64HDCMod/VM/ynLIlsBQ1ChqNG2ZtzcCSQ/XBDZL3WLR9FevDYxATnZ99w9oNgwMwCkPNriQUj8GcACiOvPk2g7BAUWmJRVgV3kLlHALh/jfUff6FQ2Jj2utx3R/ZH3v9QZKScHGty1dWsGCdvRr3hyno5T0+XFil6mAjNcapkT3pkPDJT4Q7OKa+gLoYKQqrkBcILJtLCVi0t 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: cdaea5c9-8122-4767-a458-08dc967908c1 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Jun 2024 07:16:16.1380 (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: 4IQmMkSsojjues1zKpK4uOyYqWikb7ECEsRmR7wylA2zZqq3O9q0ke00ANAOZrJQonpVGTA49Yw5AzMEGuv02w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR83MB0555 X-Spam-Status: No, score=-10.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, KAM_SHORT, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Thank you for reporting the issues and discussing the root causes. It helped in preparing the patch. This patch fixes 3 bugs reported after merging the "Add DLL import/export implementation to AArch64" series. https://gcc.gnu.org/pipermail/gcc-patches/2024-June/653955.html The series refactors the i386 codebase to reuse it in AArch64, which triggers some bugs. Bug 115661 - [15 Regression] wrong code at -O{2,3} on x86_64-linux-gnu since r15-1599-g63512c72df09b4 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115661 Bug 115635 - [15 regression] Bootstrap fails with failed self-test with the rust fe (diagnostic-path.cc:1153: test_empty_path: FAIL: ASSERT_FALSE ((path.interprocedural_p ()))) since r15-1599-g63512c72df09b4 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115635 Issue 1. In some code, i386 has been relying on the legitimize_pe_coff_symbol call on all platforms and should return NULL_RTX if it is not supported. Fix: NULL_RTX handling has been added when the target does not support PECOFF. Issue 2. ix86_GOT_alias_set is used on all platforms and cannot be extracted to mingw. Fix: ix86_GOT_alias_set has been returned as it was and is used on all platforms for i386. Bug 115643 - [15 regression] aarch64-w64-mingw32 support today breaks x86_64-w64-mingw32 build cannot represent relocation type BFD_RELOC_64 since r15-1602-ged20feebd9ea31 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115643 Issue 3. PE_COFF_EXTERN_DECL_SHOULD_BE_LEGITIMIZED has been added and used with a negative operator for a complex expression without braces. Fix: Braces has been added, and PE_COFF_EXTERN_DECL_SHOULD_BE_LEGITIMIZED has been renamed to PE_COFF_LEGITIMIZE_EXTERN_DECL. The patch has been attached as a text file because it contains special characters that are usually removed by the mail client. Regards, Evgeny From 6b1448e9ba651657dccdb41590a51a7c3c371e50 Mon Sep 17 00:00:00 2001 From: Evgeny Karpov Date: Wed, 26 Jun 2024 22:10:55 +0200 Subject: [PATCH] i386: Fix regression after refactoring legitimize_pe_coff_symbol, ix86_GOT_alias_set and PE_COFF_LEGITIMIZE_EXTERN_DECL This patch fixes 3 bugs reported after merging the "Add DLL import/export implementation to AArch64" series. https://gcc.gnu.org/pipermail/gcc-patches/2024-June/653955.html The series refactors the i386 codebase to reuse it in AArch64, which triggers some bugs. Bug 115661 - [15 Regression] wrong code at -O{2,3} on x86_64-linux-gnu since r15-1599-g63512c72df09b4 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115661 Bug 115635 - [15 regression] Bootstrap fails with failed self-test with the rust fe (diagnostic-path.cc:1153: test_empty_path: FAIL: ASSERT_FALSE ((path.interprocedural_p ()))) since r15-1599-g63512c72df09b4 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115635 Issue 1. In some code, i386 has been relying on the legitimize_pe_coff_symbol call on all platforms and should return NULL_RTX if it is not supported. Fix: NULL_RTX handling has been added when the target does not support PECOFF. Issue 2. ix86_GOT_alias_set is used on all platforms and cannot be extracted to mingw. Fix: ix86_GOT_alias_set has been returned as it was and is used on all platforms for i386. Bug 115643 - [15 regression] aarch64-w64-mingw32 support today breaks x86_64-w64-mingw32 build cannot represent relocation type BFD_RELOC_64 since r15-1602-ged20feebd9ea31 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115643 Issue 3. PE_COFF_EXTERN_DECL_SHOULD_BE_LEGITIMIZED has been added and used with a negative operator for a complex expression without braces. Fix: Braces has been added, and PE_COFF_EXTERN_DECL_SHOULD_BE_LEGITIMIZED has been renamed to PE_COFF_LEGITIMIZE_EXTERN_DECL. gcc/ChangeLog: * config/aarch64/cygming.h (PE_COFF_EXTERN_DECL_SHOULD_BE_LEGITIMIZED): Rename to PE_COFF_LEGITIMIZE_EXTERN_DECL. (PE_COFF_LEGITIMIZE_EXTERN_DECL): Likewise. * config/i386/cygming.h (GOT_ALIAS_SET): Remove the diffinition to reuse it from i386.h. (PE_COFF_EXTERN_DECL_SHOULD_BE_LEGITIMIZED): Rename to PE_COFF_LEGITIMIZE_EXTERN_DECL. (PE_COFF_LEGITIMIZE_EXTERN_DECL): Likewise. * config/i386/i386-expand.cc (ix86_expand_move): Return ix86_GOT_alias_set. * config/i386/i386-expand.h (ix86_GOT_alias_set): Likewise. * config/i386/i386.cc (ix86_GOT_alias_set): Likewise. * config/i386/i386.h (GOT_ALIAS_SET): Likewise. * config/mingw/winnt-dll.cc (get_dllimport_decl): Use GOT_ALIAS_SET. (legitimize_pe_coff_symbol): Rename to PE_COFF_LEGITIMIZE_EXTERN_DECL. * config/mingw/winnt-dll.h (ix86_GOT_alias_set): Declare ix86_GOT_alias_set. --- gcc/config/aarch64/cygming.h | 2 +- gcc/config/i386/cygming.h | 7 ++----- gcc/config/i386/i386-expand.cc | 5 ++++- gcc/config/i386/i386-expand.h | 1 + gcc/config/i386/i386.cc | 11 +++++++++++ gcc/config/i386/i386.h | 2 +- gcc/config/mingw/winnt-dll.cc | 4 ++-- gcc/config/mingw/winnt-dll.h | 1 + 8 files changed, 23 insertions(+), 10 deletions(-) diff --git a/gcc/config/aarch64/cygming.h b/gcc/config/aarch64/cygming.h index e26488735db..9ce140a356f 100644 --- a/gcc/config/aarch64/cygming.h +++ b/gcc/config/aarch64/cygming.h @@ -186,7 +186,7 @@ still needed for compilation. */ #undef GOT_ALIAS_SET #define GOT_ALIAS_SET mingw_GOT_alias_set () -#define PE_COFF_EXTERN_DECL_SHOULD_BE_LEGITIMIZED 1 +#define PE_COFF_LEGITIMIZE_EXTERN_DECL 1 #define HAVE_64BIT_POINTERS 1 diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h index 0493b3be875..9c8c7e33cc2 100644 --- a/gcc/config/i386/cygming.h +++ b/gcc/config/i386/cygming.h @@ -470,10 +470,7 @@ do { \ # define HAVE_GAS_ALIGNED_COMM 0 #endif -#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 PE_COFF_LEGITIMIZE_EXTERN_DECL \ + (ix86_cmodel == CM_LARGE_PIC || ix86_cmodel == CM_MEDIUM_PIC) #define HAVE_64BIT_POINTERS TARGET_64BIT_DEFAULT diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc index 5dfa7d49f58..20adb42e17b 100644 --- a/gcc/config/i386/i386-expand.cc +++ b/gcc/config/i386/i386-expand.cc @@ -414,6 +414,10 @@ ix86_expand_move (machine_mode mode, rtx operands[]) { #if TARGET_PECOFF tmp = legitimize_pe_coff_symbol (op1, addend != NULL_RTX); +#else + tmp = NULL_RTX; +#endif + if (tmp) { op1 = tmp; @@ -425,7 +429,6 @@ 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 5e02df1706d..56bee29253b 100644 --- a/gcc/config/i386/i386-expand.h +++ b/gcc/config/i386/i386-expand.h @@ -34,6 +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); bool insn_defines_reg (unsigned int regno1, unsigned int regno2, diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index 1f71ed04be6..aa5d188ada0 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -11242,6 +11242,17 @@ ix86_cannot_force_const_mem (machine_mode mode, rtx x) return !ix86_legitimate_constant_p (mode, x); } +/* 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; +} + /* 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. */ diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 9ed225ec587..147b12cd014 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -2259,7 +2259,7 @@ 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 +#define GOT_ALIAS_SET ix86_GOT_alias_set () enum processor_type { diff --git a/gcc/config/mingw/winnt-dll.cc b/gcc/config/mingw/winnt-dll.cc index 66c445cba77..f74495b7fda 100644 --- a/gcc/config/mingw/winnt-dll.cc +++ b/gcc/config/mingw/winnt-dll.cc @@ -139,7 +139,7 @@ get_dllimport_decl (tree decl, bool beimport) } rtl = gen_const_mem (Pmode, rtl); - set_mem_alias_set (rtl, mingw_GOT_alias_set ()); + set_mem_alias_set (rtl, GOT_ALIAS_SET); SET_DECL_RTL (to, rtl); SET_DECL_ASSEMBLER_NAME (to, get_identifier (name)); @@ -206,7 +206,7 @@ legitimize_pe_coff_symbol (rtx addr, bool inreg) } } - if (!PE_COFF_EXTERN_DECL_SHOULD_BE_LEGITIMIZED) + if (!PE_COFF_LEGITIMIZE_EXTERN_DECL) return NULL_RTX; if (GET_CODE (addr) == SYMBOL_REF diff --git a/gcc/config/mingw/winnt-dll.h b/gcc/config/mingw/winnt-dll.h index 14ca743b69f..659d9c16b7c 100644 --- a/gcc/config/mingw/winnt-dll.h +++ b/gcc/config/mingw/winnt-dll.h @@ -22,6 +22,7 @@ http://www.gnu.org/licenses/. */ #ifndef USED_FOR_TARGET extern bool is_imported_p (rtx x); +extern alias_set_type ix86_GOT_alias_set (void); extern alias_set_type mingw_GOT_alias_set (void); extern rtx legitimize_pe_coff_symbol (rtx addr, bool inreg);