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.web10.71854.1680532171067079063 for ; Mon, 03 Apr 2023 07:29:31 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pRIKpk0X; 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 7DBC261DE3; Mon, 3 Apr 2023 14:29:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1035DC433EF; Mon, 3 Apr 2023 14:29:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680532169; bh=6oQMmDdhGvkw9/CV7mn5cq1xKtRj+EXLkCsXsUjIhjo=; h=From:To:Cc:Subject:Date:From; b=pRIKpk0Xk3zWHOHfgEokdrI4jJmKLTOPAa9Q9s0RbuhMADXsaIPwgLT7Q5YkSR9XX jhepOAfanvYhCtrbG3/eAyrc3rz+Yj7m2b0NELeXSukasGLflN9zlpoDlk46FmPM9d 4/O5cyh98Yt6wHHPTVmGOpcn8tpxnfaYl5gc9txHhwMr+xBLLKkbFeFE4BS0bmSyDP R8WOA5fvtk6r65w8g+uad9lKBFwazS6GYUHFwg/4Ndh7NsKl0sNwP2k9oHlJeT5HEc 9NMLC7d4b5Hoy1GnKmvV7KI674opEDkrBsi/jZCvpxPSXfyVAgywvkO8KcFHshU114 MjO8uxwaXyWOw== 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: [PATCH v4 0/6] UefiCpuPkg, OvmfPkg: Simplify CpuExceptionHandlerLib Date: Mon, 3 Apr 2023 16:29:14 +0200 Message-Id: <20230403142920.1921619-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 - Add another patch to move PeiCpuExceptionHandlerLib to SEC/PEI version=0D of the NASM source file=0D - Improve commit logs=0D =0D Changes since v2:=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 v1:=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 (6):=0D BaseTools/tools_def CLANGDWARF: Permit text relocations=0D UefiCpuPkg/CpuExceptionHandlerLib: Use single SEC/PEI version=0D UefiCpuPkg/PeiCpuExceptionHandlerLib: Use SEC/PEI specific asm=0D component=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