From: "Ni, Ray" <ray.ni@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
"ardb@kernel.org" <ardb@kernel.org>
Cc: "Andrew Fish" <afish@apple.com>,
"Kinney, Michael D" <michael.d.kinney@intel.com>,
"Liu, Zhiguang" <zhiguang.liu@intel.com>,
"Rebecca Cran" <rebecca@bsdio.com>,
"Tom Lendacky" <thomas.lendacky@amd.com>,
"Marvin Häuser" <mhaeuser@posteo.de>
Subject: Re: [edk2-devel] [RFT PATCH v3 0/5] UefiCpuPkg, OvmfPkg: Simplify CpuExceptionHandlerLib
Date: Fri, 31 Mar 2023 10:08:51 +0000 [thread overview]
Message-ID: <MN6PR11MB8244A47E406BA5B279CB118A8C8F9@MN6PR11MB8244.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20230331091437.1593337-1-ardb@kernel.org>
Ard,
What does "-read_only_relocs suppress" control?
Linker doesn't produce relocation entries that modifies .text section silently
so the final .text just cannot run at all?
Thanks,
Ray
> -----Original Message-----
> From: devel@edk2.groups.io <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 <ardb@kernel.org>; Ni, Ray <ray.ni@intel.com>; Andrew
> Fish <afish@apple.com>; Kinney, Michael D <michael.d.kinney@intel.com>;
> Liu, Zhiguang <zhiguang.liu@intel.com>; Rebecca Cran
> <rebecca@bsdio.com>; Tom Lendacky <thomas.lendacky@amd.com>;
> Marvin Häuser <mhaeuser@posteo.de>
> Subject: [edk2-devel] [RFT PATCH v3 0/5] UefiCpuPkg, OvmfPkg: Simplify
> CpuExceptionHandlerLib
>
> We have a special version of CpuExceptionHandlerLib for XCODE5, whose
>
> linker (LLD) does not permit absolute symbol references in read-only
>
> sections.
>
>
>
> Instead of fixing this up at runtime for all toolchains (which is done
>
> by writing the fixed up values to the .text section, which we'd prefer
>
> to avoid), tweak the SEC/PEI version so it does not need this, and
>
> update the remaining versions to only incorporate this logic when using
>
> the XCODE toolchain.
>
>
>
> Changes since v3:
>
> - As Marvin points out, using '-read_only_relocs suppress' with the X64
>
> XCODE linker is a terrible idea, as it corrupts the resulting PE
>
> binaries, so instead, let's do the following:
>
> . tweak the SEC/PEI version of the library so the relocs are emitted
>
> into .data when using XCODE;
>
> . tweak the other versions so the runtime fixups are only done when
>
> using XCODE
>
> - add acks from Jiewen and Ray
>
>
>
> Changes since v2:
>
> - pass linker switches to permit absolute relocations in read-only
>
> regions, and keep all code in .text
>
>
>
> Cc: "Ni, Ray" <ray.ni@intel.com>
>
> Cc: Andrew Fish <afish@apple.com>
>
> Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>
>
> Cc: "Liu, Zhiguang" <zhiguang.liu@intel.com>
>
> Cc: Rebecca Cran <rebecca@bsdio.com>
>
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
>
> Cc: Marvin Häuser <mhaeuser@posteo.de>
>
>
>
> Ard Biesheuvel (5):
>
> BaseTools/tools_def CLANGDWARF: Permit text relocations
>
> UefiCpuPkg/CpuExceptionHandlerLib: Use single SEC/PEI version
>
> UefiCpuPkg/CpuExceptionHandlerLib: Make runtime fixups XCODE-only
>
> OvmfPkg: Drop special Xcode5 version of exception handler library
>
> UefiCpuPkg/CpuExceptionHandlerLib: Drop special XCODE5 version
>
>
>
> BaseTools/Conf/tools_def.template
> | 2 +-
>
> OvmfPkg/AmdSev/AmdSevX64.dsc
> | 4 -
>
> OvmfPkg/CloudHv/CloudHvX64.dsc
> | 4 -
>
> OvmfPkg/IntelTdx/IntelTdxX64.dsc |
> 4 -
>
> OvmfPkg/Microvm/MicrovmX64.dsc
> | 4 -
>
> OvmfPkg/OvmfPkgIa32.dsc | 4
> -
>
> OvmfPkg/OvmfPkgIa32X64.dsc |
> 4 -
>
> OvmfPkg/OvmfPkgX64.dsc | 4
> -
>
> OvmfPkg/OvmfXen.dsc | 4 -
>
>
> UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.in
> f | 5 +-
>
>
> UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf
> | 4 +-
>
>
> UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib
> .inf | 4 +-
>
>
> UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.i
> nf | 4 +-
>
>
> UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.nas
> m | 116 +++++++++++++++++---
>
>
> UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/{Xcode5ExceptionHandler
> Asm.nasm => SecPeiExceptionHandlerAsm.nasm} | 108 +++---------------
>
>
> UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHa
> ndlerLib.inf | 65 -----------
>
>
> UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHa
> ndlerLib.uni | 18 ---
>
> UefiCpuPkg/UefiCpuPkg.dsc | 7
> --
>
> 18 files changed, 133 insertions(+), 232 deletions(-)
>
> rename
> UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/{Xcode5ExceptionHandler
> Asm.nasm => SecPeiExceptionHandlerAsm.nasm} (70%)
>
> delete mode 100644
> UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHa
> ndlerLib.inf
>
> delete mode 100644
> UefiCpuPkg/Library/CpuExceptionHandlerLib/Xcode5SecPeiCpuExceptionHa
> ndlerLib.uni
>
>
>
> --
>
> 2.39.2
>
>
>
>
>
> -=-=-=-=-=-=
> 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]
> -=-=-=-=-=-=
>
next prev parent reply other threads:[~2023-03-31 10:09 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-31 9:14 [RFT PATCH v3 0/5] UefiCpuPkg, OvmfPkg: Simplify CpuExceptionHandlerLib Ard Biesheuvel
2023-03-31 9:14 ` [RFT PATCH v3 1/5] BaseTools/tools_def CLANGDWARF: Permit text relocations Ard Biesheuvel
2023-03-31 9:14 ` [RFT PATCH v3 2/5] UefiCpuPkg/CpuExceptionHandlerLib: Use single SEC/PEI version Ard Biesheuvel
2023-03-31 9:56 ` Ni, Ray
2023-03-31 10:12 ` [edk2-devel] " Ard Biesheuvel
2023-03-31 10:19 ` Ni, Ray
2023-03-31 10:49 ` Ard Biesheuvel
[not found] ` <17517877FE72B326.27612@groups.io>
2023-03-31 9:58 ` Ni, Ray
2023-03-31 10:14 ` Ard Biesheuvel
2023-03-31 10:16 ` Ni, Ray
2023-03-31 10:19 ` Ard Biesheuvel
2023-03-31 9:14 ` [RFT PATCH v3 3/5] UefiCpuPkg/CpuExceptionHandlerLib: Make runtime fixups XCODE-only Ard Biesheuvel
2023-03-31 10:03 ` [edk2-devel] " Ni, Ray
2023-03-31 10:20 ` Ni, Ray
2023-03-31 9:14 ` [RFT PATCH v3 4/5] OvmfPkg: Drop special Xcode5 version of exception handler library Ard Biesheuvel
2023-03-31 9:14 ` [RFT PATCH v3 5/5] UefiCpuPkg/CpuExceptionHandlerLib: Drop special XCODE5 version Ard Biesheuvel
2023-03-31 10:08 ` Ni, Ray [this message]
2023-03-31 10:15 ` [edk2-devel] [RFT PATCH v3 0/5] UefiCpuPkg, OvmfPkg: Simplify CpuExceptionHandlerLib Ard Biesheuvel
2023-03-31 10:41 ` Marvin Häuser
2023-03-31 11:03 ` Ard Biesheuvel
2023-03-31 11:09 ` Marvin Häuser
2023-03-31 14:39 ` Ni, Ray
2023-03-31 14:42 ` Marvin Häuser
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=MN6PR11MB8244A47E406BA5B279CB118A8C8F9@MN6PR11MB8244.namprd11.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox