From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 89438740039 for ; Thu, 26 Oct 2023 18:47:05 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=/vrmL8+YZJtLF9piegNGvA++4i/hn3ZOVcA7Mfg2JO0=; c=relaxed/simple; d=groups.io; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20140610; t=1698346024; v=1; b=J34RmZQ4XQ3P4vYmRm73EGi/R7P5F6rg0myd3Hd7WwRzusnE1l6JVHkdCE6T5DinLjSeB0lS G1t1PMUmlSiWkVDMc+2fhxx//G+8VDT39zpjOY3xgm7ajMWTAi7sJupRqPP75hsfnMy2rCXcO6a MWxYuVYsNBnz+/t2KrSYhCL0= X-Received: by 127.0.0.2 with SMTP id ZraqYY7687511xZhcqG5zU43; Thu, 26 Oct 2023 11:47:04 -0700 X-Received: from mail-vs1-f50.google.com (mail-vs1-f50.google.com [209.85.217.50]) by mx.groups.io with SMTP id smtpd.web11.79295.1698346023330151283 for ; Thu, 26 Oct 2023 11:47:03 -0700 X-Received: by mail-vs1-f50.google.com with SMTP id ada2fe7eead31-457c2b6713fso1526252137.1 for ; Thu, 26 Oct 2023 11:47:03 -0700 (PDT) X-Gm-Message-State: VfRXz5fttOSRt09oOER1u9gSx7686176AA= X-Google-Smtp-Source: AGHT+IHJeGkuG97GmuEv7vY02CksqcODpl5P4R4PyhtzTWRxB7Xqk5BwRa2KmPXfyW3sGv3C60Yv4NykgQPLalA2+/M= X-Received: by 2002:a05:6102:208c:b0:452:d5cb:a211 with SMTP id h12-20020a056102208c00b00452d5cba211mr594985vsr.15.1698346020528; Thu, 26 Oct 2023 11:47:00 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "Pedro Falcato" Date: Thu, 26 Oct 2023 19:46:49 +0100 Message-ID: Subject: Re: [edk2-devel] [PATCH] BaseTools/GenFw: Change opcode when converting ADR to ADRP To: devel@edk2.groups.io, jake@nvidia.com Cc: rebecca@bsdio.com, gaoliming@byosoft.com.cn, bob.c.feng@intel.com, yuwei.chen@intel.com, ardb+tianocore@kernel.org Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pedro.falcato@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=J34RmZQ4; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On Thu, Oct 26, 2023 at 4:32=E2=80=AFPM Jake Garver via groups.io wrote: > > In the R_AARCH64_ADR_GOT_PAGE case on AARCH64, be sure to change the > opcode to ADRP. Prior to this change, we updated the address, but not > the opcode. > > This resolves an issue experienced when building a StandaloneMm image > with stack protection enabled on GCC 10.5. This scenario generates an > ADR where an ADRP is more common in other versions of GCC tested. That > explains the obscurity of the issue. However, an ADR is valid and > should be handled by GenFw. Is this not a toolchain bug? The aarch64 ELF ABI (https://github.com/ARM-software/abi-aa/blob/main/aaelf64/aaelf64.rst) says: "Set the immediate value of an ADRP to bits [32:12] of X; check that =E2=80=93232 <=3D X < 232" So it mentions this relocation pointing *to an ADRP* specifically. And AFAIK there's no way Page(G(GDAT(S+A)))-Page(P) would ever make sense if we're looking at an adr and not an adrp. Can you post the full disassembly for the function, plus relevant relocatio= ns? --=20 Pedro -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#110140): https://edk2.groups.io/g/devel/message/110140 Mute This Topic: https://groups.io/mt/102202314/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-