From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web11.50280.1680254090084497784 for ; Fri, 31 Mar 2023 02:14:50 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AGaNxQ6h; spf=pass (domain: kernel.org, ip: 139.178.84.217, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 727B2625F8; Fri, 31 Mar 2023 09:14:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CCCFC4339C; Fri, 31 Mar 2023 09:14:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680254088; bh=hobogsoPt8qdJssgKGeRwIf7HkYQDggHrhgU4uZfuz0=; h=From:To:Cc:Subject:Date:From; b=AGaNxQ6hxNTcFqfNPmu+VeWtCZypbI2+BZdhCezM1KQpNEmEW6cabHtVpB0ryoJJd 2+Gza/Zh48e2LoamoU9ttEI5J0dmK0kuGhRQ8rsFwcJAu+EFvTrhyJo/inraY+kQHR Bv11Elo4r5EZfAO5tSrPcDEgz4CdVP9U3rrPaaJwGpuMd/VQQmULT/3Lf2XNo1nsXx PDTyw30w/TyoABbdfyR8ncHDwMQo9NIxcGLk8fxqFOm7Z6uLZgmILiE6slNBPDcLzj fIwUx6aEG1SCpfl6S6P9Y+bV9/6JEv6tBa1F18K5uJw45lC1Xe2zF+vmNvlbVx1Cp9 NXRD9z06aMrTw== From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , "Ni, Ray" , Andrew Fish , "Kinney, Michael D" , "Liu, Zhiguang" , Rebecca Cran , Tom Lendacky , =?UTF-8?q?Marvin=20H=C3=A4user?= Subject: [RFT PATCH v3 0/5] UefiCpuPkg, OvmfPkg: Simplify CpuExceptionHandlerLib Date: Fri, 31 Mar 2023 11:14:32 +0200 Message-Id: <20230331091437.1593337-1-ardb@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable We have a special version of CpuExceptionHandlerLib for XCODE5, whose=0D linker (LLD) does not permit absolute symbol references in read-only=0D sections.=0D =0D Instead of fixing this up at runtime for all toolchains (which is done=0D by writing the fixed up values to the .text section, which we'd prefer=0D to avoid), tweak the SEC/PEI version so it does not need this, and=0D update the remaining versions to only incorporate this logic when using=0D the XCODE toolchain.=0D =0D Changes since v3:=0D - As Marvin points out, using '-read_only_relocs suppress' with the X64=0D XCODE linker is a terrible idea, as it corrupts the resulting PE=0D binaries, so instead, let's do the following:=0D . tweak the SEC/PEI version of the library so the relocs are emitted=0D into .data when using XCODE;=0D . tweak the other versions so the runtime fixups are only done when=0D using XCODE=0D - add acks from Jiewen and Ray=0D =0D Changes since v2:=0D - pass linker switches to permit absolute relocations in read-only=0D regions, and keep all code in .text=0D =0D Cc: "Ni, Ray" =0D Cc: Andrew Fish =0D Cc: "Kinney, Michael D" =0D Cc: "Liu, Zhiguang" =0D Cc: Rebecca Cran =0D Cc: Tom Lendacky =0D Cc: Marvin H=C3=A4user =0D =0D Ard Biesheuvel (5):=0D BaseTools/tools_def CLANGDWARF: Permit text relocations=0D UefiCpuPkg/CpuExceptionHandlerLib: Use single SEC/PEI version=0D UefiCpuPkg/CpuExceptionHandlerLib: Make runtime fixups XCODE-only=0D OvmfPkg: Drop special Xcode5 version of exception handler library=0D UefiCpuPkg/CpuExceptionHandlerLib: Drop special XCODE5 version=0D =0D BaseTools/Conf/tools_def.template = | 2 +-=0D OvmfPkg/AmdSev/AmdSevX64.dsc = | 4 -=0D OvmfPkg/CloudHv/CloudHvX64.dsc = | 4 -=0D OvmfPkg/IntelTdx/IntelTdxX64.dsc = | 4 -=0D OvmfPkg/Microvm/MicrovmX64.dsc = | 4 -=0D OvmfPkg/OvmfPkgIa32.dsc = | 4 -=0D OvmfPkg/OvmfPkgIa32X64.dsc = | 4 -=0D OvmfPkg/OvmfPkgX64.dsc = | 4 -=0D OvmfPkg/OvmfXen.dsc = | 4 -=0D UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf = | 5 +-=0D UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf = | 4 +-=0D UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf= | 4 +-=0D UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf = | 4 +-=0D UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nasm = | 116 +++++++++++++++++---=0D UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/{Xcode5ExceptionHandlerAsm.n= asm =3D> SecPeiExceptionHandlerAsm.nasm} | 108 +++---------------=0D UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerL= ib.inf | 65 -----------=0D UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHandlerL= ib.uni | 18 ---=0D UefiCpuPkg/UefiCpuPkg.dsc = | 7 --=0D 18 files changed, 133 insertions(+), 232 deletions(-)=0D rename UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/{Xcode5ExceptionHandl= erAsm.nasm =3D> SecPeiExceptionHandlerAsm.nasm} (70%)=0D delete mode 100644 UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiC= puExceptionHandlerLib.inf=0D delete mode 100644 UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiC= puExceptionHandlerLib.uni=0D =0D -- =0D 2.39.2=0D =0D