From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.65]) by mx.groups.io with SMTP id smtpd.web11.51494.1680259281794488824 for ; Fri, 31 Mar 2023 03:41:22 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@posteo.de header.s=2017 header.b=O3W7tOu+; spf=pass (domain: posteo.de, ip: 185.67.36.65, mailfrom: mhaeuser@posteo.de) Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 8797A240280 for ; Fri, 31 Mar 2023 12:41:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1680259279; bh=FuGCz63zxyRLJNfh9ynmAjizn+wNw0nUxah63s5KBng=; h=From:Subject:Date:Cc:To:From; b=O3W7tOu+Qi3wBB1XOQnhmiKbvrcLerNC1NXVc89oZgALX5IVuLULzqn4gfgocMlil XeMvTAIqwctPrUlyqAyg4KWE/VRHp7V3BdWWUzpeMGh2uy42heC77M4l/2Kj7CQ+9A JUcndiuctRciPyFABT+7n2f/TrWoU69ESF/daHxIc47Yx2aDHUkhJm70jEOaQ1QTBD qDkG+A44e4+H4kD4YZFvhCPfBzqCdim0UKdFB6nbDpRx0HZ9WXBEfCfi4i9sWUUsai pdsvzJmozaly8CyqQpd7PA8a+iEGYVSnfaSIvLafO9G0q7HCFb7XBFV3+j74mSgayD lY2KxKxJnOmew== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4PnxfQ3wrZz6tvd; Fri, 31 Mar 2023 12:41:18 +0200 (CEST) From: =?UTF-8?B?TWFydmluIEjDpHVzZXI=?= Mime-Version: 1.0 (1.0) Subject: Re: [edk2-devel] [RFT PATCH v3 0/5] UefiCpuPkg, OvmfPkg: Simplify CpuExceptionHandlerLib Date: Fri, 31 Mar 2023 10:41:17 +0000 Message-Id: References: Cc: devel@edk2.groups.io, ardb@kernel.org, Andrew Fish , "Kinney, Michael D" , "Liu, Zhiguang" , Rebecca Cran , Tom Lendacky In-Reply-To: To: "Ni, Ray" Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Ray, > On 31. Mar 2023, at 12:09, Ni, Ray wrote: >=20 > =EF=BB=BFArd, > What does "-read_only_relocs suppress" control? It controls whether relocs that target read-only segments yield a build erro= r or not. I think lld uses =E2=80=9C-z notext=E2=80=9D. > Linker doesn't produce relocation entries that modifies .text section sile= ntly > so the final .text just cannot run at all? Could you please rephrase? I=E2=80=99m not sure I understand, but I think it= =E2=80=99s important everyone understands the issues at play to make a good j= udgment call. Best regards, Marvin >=20 > Thanks, > Ray >=20 >> -----Original Message----- >> From: devel@edk2.groups.io On Behalf Of Ard >> Biesheuvel >> Sent: Friday, March 31, 2023 5:15 PM >> To: devel@edk2.groups.io >> Cc: Ard Biesheuvel ; Ni, Ray ; Andrew >> Fish ; Kinney, Michael D ; >> Liu, Zhiguang ; Rebecca Cran >> ; Tom Lendacky ; >> Marvin H=C3=A4user >> Subject: [edk2-devel] [RFT PATCH v3 0/5] UefiCpuPkg, OvmfPkg: Simplify >> CpuExceptionHandlerLib >>=20 >> We have a special version of CpuExceptionHandlerLib for XCODE5, whose >>=20 >> linker (LLD) does not permit absolute symbol references in read-only >>=20 >> sections. >>=20 >>=20 >>=20 >> Instead of fixing this up at runtime for all toolchains (which is done >>=20 >> by writing the fixed up values to the .text section, which we'd prefer >>=20 >> to avoid), tweak the SEC/PEI version so it does not need this, and >>=20 >> update the remaining versions to only incorporate this logic when using >>=20 >> the XCODE toolchain. >>=20 >>=20 >>=20 >> Changes since v3: >>=20 >> - As Marvin points out, using '-read_only_relocs suppress' with the X64 >>=20 >> XCODE linker is a terrible idea, as it corrupts the resulting PE >>=20 >> binaries, so instead, let's do the following: >>=20 >> . tweak the SEC/PEI version of the library so the relocs are emitted >>=20 >> into .data when using XCODE; >>=20 >> . tweak the other versions so the runtime fixups are only done when >>=20 >> using XCODE >>=20 >> - add acks from Jiewen and Ray >>=20 >>=20 >>=20 >> Changes since v2: >>=20 >> - pass linker switches to permit absolute relocations in read-only >>=20 >> regions, and keep all code in .text >>=20 >>=20 >>=20 >> Cc: "Ni, Ray" >>=20 >> Cc: Andrew Fish >>=20 >> Cc: "Kinney, Michael D" >>=20 >> Cc: "Liu, Zhiguang" >>=20 >> Cc: Rebecca Cran >>=20 >> Cc: Tom Lendacky >>=20 >> Cc: Marvin H=C3=83=C2=A4user >>=20 >>=20 >>=20 >> Ard Biesheuvel (5): >>=20 >> BaseTools/tools_def CLANGDWARF: Permit text relocations >>=20 >> UefiCpuPkg/CpuExceptionHandlerLib: Use single SEC/PEI version >>=20 >> UefiCpuPkg/CpuExceptionHandlerLib: Make runtime fixups XCODE-only >>=20 >> OvmfPkg: Drop special Xcode5 version of exception handler library >>=20 >> UefiCpuPkg/CpuExceptionHandlerLib: Drop special XCODE5 version >>=20 >>=20 >>=20 >> BaseTools/Conf/tools_def.template >> | 2 +- >>=20 >> OvmfPkg/AmdSev/AmdSevX64.dsc >> | 4 - >>=20 >> OvmfPkg/CloudHv/CloudHvX64.dsc >> | 4 - >>=20 >> OvmfPkg/IntelTdx/IntelTdxX64.dsc = | >> 4 - >>=20 >> OvmfPkg/Microvm/MicrovmX64.dsc >> | 4 - >>=20 >> OvmfPkg/OvmfPkgIa32.dsc = | 4 >> - >>=20 >> OvmfPkg/OvmfPkgIa32X64.dsc = | >> 4 - >>=20 >> OvmfPkg/OvmfPkgX64.dsc = | 4 >> - >>=20 >> OvmfPkg/OvmfXen.dsc = | 4 - >>=20 >>=20 >> UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.in >> f | 5 +- >>=20 >>=20 >> UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf >> | 4 +- >>=20 >>=20 >> UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib >> .inf | 4 +- >>=20 >>=20 >> UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.i >> nf | 4 +- >>=20 >>=20 >> UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nas >> m | 116 +++++++++++++++++--- >>=20 >>=20 >> UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/{Xcode5ExceptionHandler >> Asm.nasm =3D> SecPeiExceptionHandlerAsm.nasm} | 108 +++--------------- >>=20 >>=20 >> UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHa >> ndlerLib.inf | 65 ----------- >>=20 >>=20 >> UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHa >> ndlerLib.uni | 18 --- >>=20 >> UefiCpuPkg/UefiCpuPkg.dsc = | 7 >> -- >>=20 >> 18 files changed, 133 insertions(+), 232 deletions(-) >>=20 >> rename >> UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/{Xcode5ExceptionHandler >> Asm.nasm =3D> SecPeiExceptionHandlerAsm.nasm} (70%) >>=20 >> delete mode 100644 >> UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHa >> ndlerLib.inf >>=20 >> delete mode 100644 >> UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHa >> ndlerLib.uni >>=20 >>=20 >>=20 >> -- >>=20 >> 2.39.2 >>=20 >>=20 >>=20 >>=20 >>=20 >> -=3D-=3D-=3D-=3D-=3D-=3D >> Groups.io Links: You receive all messages sent to this group. >> View/Reply Online (#102255): >> https://edk2.groups.io/g/devel/message/102255 >> Mute This Topic: https://groups.io/mt/97969646/1712937 >> Group Owner: devel+owner@edk2.groups.io >> Unsubscribe: https://edk2.groups.io/g/devel/unsub [ray.ni@intel.com] >> -=3D-=3D-=3D-=3D-=3D-=3D >>=20 >=20