Message ID | GVXPR83MB06295CD92B26BAC44CD47438F84D2@GVXPR83MB0629.EURPRD83.prod.outlook.com |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 664F53858C60 for <patchwork@sourceware.org>; Wed, 23 Oct 2024 13:21:28 +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 D2D4B3858D21 for <gcc-patches@gcc.gnu.org>; Wed, 23 Oct 2024 13:20:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D2D4B3858D21 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 D2D4B3858D21 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=1729689656; cv=pass; b=KqwAotHKXcp7a9OhQ3tmmJDQa3vyl77E6eL5d0Uyispv1sEXwnX5NpmB9MCkMIJUJQqwxm/W6qNrA8IaZ8ynK1rUZlAXRnkci/jTwUES380RfqkmbQYMQ0COapvpVj3gek02LBfRbhFD33gj/5IvEZTTzS3IB19WqmK/lDIFa10= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1729689656; c=relaxed/simple; bh=fOsCZ+hOTsZOmQS0ACv0GSBetdC0L144fLAcKTCkyFM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=QSVB+KseIZDFpdM5IvvJp1TY/vjqG2qcfzlvjzoTX+YnrqYIY+/G5YjFYmaKXR07Y5O4G1yUt8bYrfU2ofBhe22Hp1H+q8SOtG7OkkVO3PU6CYs2NH3Twe1Jl4agvUDD+iwDmzT1/JKCl6RN5ip6uo6SUq0oS8FpI+VrRBV6Fxs= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FWtTPUHwZbj5s68E+QX25cS7pTJE73eWlHXKBdFP367r0up/XrZnvjnCPaO2sEtVzlC55XzB426I6Zv+7wG0nICtaWO9BlLV3G/UoNyo5KMxz30m4Jzd0a7Kfp7wPqakfph7tkrglNfmQ51TLrmtFvzvHL64Ma0fr5pTghw85EpCaS3BS62UPhQ81o3D84XSppd856saMf3bb9uKPrsJFTflxWQJYn9WcoPVmDhtnwnIFF4G9ZtE1BgcIFgNzQ5+6tkh6i00RuCJY4Q2/4pJCqbCYYUMvgBMUkQi+k7PDhdZAXxgDKxCFZO+ktv5U7l4e071A8lQJZHS0CVaceNkyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=fOsCZ+hOTsZOmQS0ACv0GSBetdC0L144fLAcKTCkyFM=; b=B2njiRWMqVtOritC5wydM/t67eAwIKWVDvABKXz+oKaOTL1OW6wyZ+WUOx3hgSgrb3DvVBoL86Syu3/3tcZdafNsBwq1964ae91+GpNlFlVvTk5NMIK6Udjoapj50ZCY8Pj8Xaofm+QvuTkIFDtiZ9psb3ehYKvo/+qPqKY+89AdwA0hey0wTglE0huGe/ehPJV6EGidz2VYyFQsI4otsJdqGsSLMCsc5JfyfUKwDTIyYSIun5ulhj5mE2bNO7a+vp9tkLPApp1qurnyw8TnfJ1Mlz+b9peLMKHhqlg2XAopKSPp7eNyH0pHyx7xSBeke6KsHbE8JJUaCGay22ycCg== 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=fOsCZ+hOTsZOmQS0ACv0GSBetdC0L144fLAcKTCkyFM=; b=LGR9hD1MRXMpNrSac1I0Znsqh5NuL2f1s8doJT2ed2EKP9mlita+YDCMw2W23wFkMqq8nkiEJ3GqVjf9fAOfeF/w+uQh3W5AlE0GwCWbWFuuik9jD5M23OaGOPJrsAGFx5N5W38mORebOCdGuu/UePCakht1WzMpp4nql99QBEQ= Received: from GVXPR83MB0629.EURPRD83.prod.outlook.com (2603:10a6:150:154::8) by VI2PR83MB0815.EURPRD83.prod.outlook.com (2603:10a6:800:271::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.7; Wed, 23 Oct 2024 13:20:49 +0000 Received: from GVXPR83MB0629.EURPRD83.prod.outlook.com ([fe80::368:a10:d6a:7278]) by GVXPR83MB0629.EURPRD83.prod.outlook.com ([fe80::368:a10:d6a:7278%6]) with mapi id 15.20.8114.002; Wed, 23 Oct 2024 13:20:49 +0000 From: Evgeny Karpov <Evgeny.Karpov@microsoft.com> To: Richard Sandiford <richard.sandiford@arm.com> CC: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>, "Richard Earnshaw (lists)" <Richard.Earnshaw@arm.com>, "christophe.lyon@linaro.org" <christophe.lyon@linaro.org>, Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org>, Radek Barton <radek.barton@microsoft.com> Subject: [PATCH v2 9/9] aarch64: Handle alignment when it is bigger than BIGGEST_ALIGNMENT Thread-Topic: [PATCH v2 9/9] aarch64: Handle alignment when it is bigger than BIGGEST_ALIGNMENT Thread-Index: AQHbH9yp0n6fh6P04EmnuKyeyRjoSrKUXB2Q Date: Wed, 23 Oct 2024 13:20:48 +0000 Message-ID: <GVXPR83MB06295CD92B26BAC44CD47438F84D2@GVXPR83MB0629.EURPRD83.prod.outlook.com> References: <DBBPR83MB0613E6D85CDE663E0B7A57C8F89E2@DBBPR83MB0613.EURPRD83.prod.outlook.com> <DBBPR83MB0613871922DC43897016B3F8F89E2@DBBPR83MB0613.EURPRD83.prod.outlook.com> <mpted5flxar.fsf@arm.com> <DBBPR83MB0613A71DB5403BE3D50B1007F8462@DBBPR83MB0613.EURPRD83.prod.outlook.com> In-Reply-To: <DBBPR83MB0613A71DB5403BE3D50B1007F8462@DBBPR83MB0613.EURPRD83.prod.outlook.com> 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_Enabled=True; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2024-10-23T13:20:51.054Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=General; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard; 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: GVXPR83MB0629:EE_|VI2PR83MB0815:EE_ x-ms-office365-filtering-correlation-id: aab541b9-298e-4be4-724b-08dcf3658292 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|376014|366016|1800799024|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?q?YL2fgkrDNb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iso-8859-1?q?j8iXY86qXpBQCxQt4053r4hJsvrqAOfXDI0ION1WAUNc/JScQzVkATQmn9wU?= =?iso-8859-1?q?tcLRE335rxEXMNf+S6maGcEC2MJC//s6zHXsqJZ0squjTtrAa+B+4x1jI7Jj?= =?iso-8859-1?q?lJwRdNEyAnbFu0+VX6ilNfBFvXWzRRSjlmKC3SpuPcrXGxqSgy/VzL2AlHOP?= =?iso-8859-1?q?JJrN9BXDz+u9u40ic6Oo1Fito8A74CwW9RDio2Fk7wdJbLE1HoAkb4Tx/sE1?= =?iso-8859-1?q?JgO36XxeTVQLoL4UZ0QYywxKHszCRIWGQMeby9zYVE5xO3l6l9pLlo1rAIl3?= =?iso-8859-1?q?wfgSmWdqDVuVQZkkw+m7Sq4rrvjKfnx0VKJ0dsWU7OqWQr3eW0Q/vp9kLJDq?= =?iso-8859-1?q?hSeZsmcDFBB15aKGzbX5S25In2ea6cvu5GG+dr8q/66m79uOqM4b3aeTgqRK?= =?iso-8859-1?q?81monScRIAC63GubdrVhuoOiPSItw6gkwI2j2qHYUTihCPubsTLVd/ai12QJ?= =?iso-8859-1?q?eiyi0XS2v4MlDtClXGHpImjkyHQuDtjhPTdbNLWFmeTCegCAyQNppEVvuGTI?= =?iso-8859-1?q?GJ?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:GVXPR83MB0629.EURPRD83.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(1800799024)(38070700018); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?7lK4vMq/nkYfE0eolSCHpZr?= =?iso-8859-1?q?pFumsTpnXQ/VU/a6CMyea1ZRqJaKXqLS2FhzqXuL0Imhtf3C2zDScUpjtek9?= =?iso-8859-1?q?iO7AO0ueKzRLxwf4gxeSGB2WAgH7furdZp8Yn+Hg/aq/+gWFML0rX4v1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N44iIcy779VLfpW1v7S9M97Bo4w0ZjJxrfN/M79KcTLR1xy/n?= =?iso-8859-1?q?iXOD0Dzz8Loi4ekzmwzvD5OxU08Bg+snzRwPHMgYQl/RCMDbnLxWTMDTmX6I?= =?iso-8859-1?q?pf5TLc1W/ZLx+rAnveQ7XFcsCGCRhhqf8hOT9DAYvTfwUeC9IBmOqZskeP5X?= =?iso-8859-1?q?BSxkkr5q9tsm2lOCndE30f6f/uYyvnP6SNN8FgteNO+bVybmj4SnjP44RPq/?= =?iso-8859-1?q?x3y2kTxP6bd0KL2/JJEVEiuUoVR/z/JezK+Ws143zVXecxKptoef4ihaaDYN?= =?iso-8859-1?q?hhmIpshmG1gKbMPdChcPRz1DqjcMvtiqAWCvtFi8FxWgY/iyZlK3zL+xw38e?= =?iso-8859-1?q?sfOBBUu8oS3iYCQWO1S21ICzdSo6vyCc6aSpxSHIKxKqURVmi9NPlyR1lYCV?= =?iso-8859-1?q?VmWSdLz/SiEBL1LpJoWqqvOhNGZwrOKzcSwP2vvWEQt5+AVmc3agrklRBhfd?= =?iso-8859-1?q?hCvu6ge3RfjRlxu9H60ppyVMBnTe4TKmmkAfgtukjloC9JJd37Atj+orcs9P?= =?iso-8859-1?q?mShl00CTYw1qP6B1Jr69T84A5/0JxsdU1eHnQxunJj9vSCQQp80Jb3GLnr7d?= =?iso-8859-1?q?rOQhfvBNXi6ECG7PN?= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: GVXPR83MB0629.EURPRD83.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: aab541b9-298e-4be4-724b-08dcf3658292 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Oct 2024 13:20:48.7419 (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: jdMhlTfbWtGEGRBPAlp32Ee/HgF6I0sFLWlURf9RpA9c2PQk9lH/fRyae5KABXKNmG7NqSvAWc6loJ3jpTAEjA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI2PR83MB0815 X-Spam-Status: No, score=-11.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, 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org |
Series |
None
|
|
Commit Message
Evgeny Karpov
Oct. 23, 2024, 1:20 p.m. UTC
Tuesday, October 22, 2024 Richard Sandiford <richard.sandiford@arm.com> wrote: >> If ASM_OUTPUT_ALIGNED_LOCAL uses an alignment less than BIGGEST_ALIGNMENT, >> it might trigger a relocation issue. >> >> relocation truncated to fit: IMAGE_REL_ARM64_PAGEOFFSET_12L > > Sorry to press the issue, but: why does that happen? #define IMAGE_REL_ARM64_PAGEOFFSET_12L 0x0007 /* The 12-bit page offset of the target, for instruction LDR (indexed, unsigned immediate). */ Based on the documentation for LDR https://developer.arm.com/documentation/ddi0596/2020-12/Base-Instructions/LDR--immediate---Load-Register--immediate-- "For the 64-bit variant: is the optional positive immediate byte offset, a multiple of 8 in the range 0 to 32760, defaulting to 0 and encoded in the "imm12" field as <pimm>/8" This means BIGGEST_ALIGNMENT (128) could be replaced with 64. auto rounded = ROUND_UP (MAX ((SIZE), 1), \ MAX ((ALIGNMENT), 64) / BITS_PER_UNIT); It works for most cases, however, not for all of them. cross-aarch64-w64-mingw32-msvcrt/lib/gcc/aarch64-w64-mingw32/15.0.0/libgomp.a(oacc-profiling.o): in function `goacc_profiling_initialize': mingw-woarm64-build/code/gcc/libgomp/oacc-profiling.c:105:(.text+0x2c): relocation truncated to fit: IMAGE_REL_ARM64_PAGEOFFSET_12L against `no symbol' This case should be investigated separately and fixed in the following patch series and BIGGEST_ALIGNMENT should be used for now. >>> Better to use "auto" rather than "unsigned". >> It looks like "auto" cannot be used there. > >What goes wrong if you use it? > >The reason for asking for "auto" was to avoid silent truncation. After the second try and recompiling, it looks like it works. Regards, Evgeny
Comments
Evgeny Karpov <Evgeny.Karpov@microsoft.com> writes: > Tuesday, October 22, 2024 > Richard Sandiford <richard.sandiford@arm.com> wrote: > >>> If ASM_OUTPUT_ALIGNED_LOCAL uses an alignment less than BIGGEST_ALIGNMENT, >>> it might trigger a relocation issue. >>> >>> relocation truncated to fit: IMAGE_REL_ARM64_PAGEOFFSET_12L >> >> Sorry to press the issue, but: why does that happen? > > #define IMAGE_REL_ARM64_PAGEOFFSET_12L 0x0007 /* The 12-bit page offset of the target, for instruction LDR (indexed, unsigned immediate). */ > > Based on the documentation for LDR > https://developer.arm.com/documentation/ddi0596/2020-12/Base-Instructions/LDR--immediate---Load-Register--immediate-- > "For the 64-bit variant: is the optional positive immediate byte offset, a multiple of 8 in the range 0 to 32760, defaulting to 0 and encoded in the "imm12" field as <pimm>/8" This in itself is relatively standard thouugh. We can't assume without checking that any given offset will be "nicely" aligned. So... > This means BIGGEST_ALIGNMENT (128) could be replaced with 64. > > auto rounded = ROUND_UP (MAX ((SIZE), 1), \ > MAX ((ALIGNMENT), 64) / BITS_PER_UNIT); > > It works for most cases, however, not for all of them. ...although this will work for, say, loading all of: unsigned char x[8]; using a single LDR, it doesn't look like it would cope with: struct __attribute__((packed)) { char x; void *y; } foo; void *f() { return foo.y; } Or, even if that does work, it isn't clear to me why patching ASM_OUTPUT_ALIGNED_LOCAL is a complete solution to the problem. ISTM that we should be checking the known alignment during code generation, and only using relocations if their alignment requirements are known to be met. Once that's done, it would make sense to increase the default alignment if that improves code quality. But it would be good to fix the correctness issue first, while the problem is still easily visible. If we do want to increase the default alignment to improve code quality, the normal way would be via macros like DATA_ALIGNMENT or LOCAL_ALIGNMENT. The advantage of those macros is that the increased alignment is visible during code generation, rather than something that is only applied at output time. Thanks, Richard
diff --git a/gcc/config/aarch64/aarch64-coff.h b/gcc/config/aarch64/aarch64-coff.h index 8fc6ca0440d..52c8c8d99c2 100644 --- a/gcc/config/aarch64/aarch64-coff.h +++ b/gcc/config/aarch64/aarch64-coff.h @@ -58,6 +58,13 @@ assemble_name ((FILE), (NAME)), \ fprintf ((FILE), "," HOST_WIDE_INT_PRINT_UNSIGNED "\n", (ROUNDED))) +#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGNMENT) \ + { \ + auto rounded = ROUND_UP (MAX ((SIZE), 1), \ + MAX ((ALIGNMENT), BIGGEST_ALIGNMENT) / BITS_PER_UNIT); \ + ASM_OUTPUT_LOCAL (FILE, NAME, SIZE, rounded); \ + } + #define ASM_OUTPUT_SKIP(STREAM, NBYTES) \ fprintf (STREAM, "\t.space\t%d // skip\n", (int) (NBYTES))