From: Julien Grall <julien@xen.org>
To: Ard Biesheuvel <ard.biesheuvel@arm.com>, devel@edk2.groups.io
Cc: Bob Feng <bob.c.feng@intel.com>,
Liming Gao <liming.gao@intel.com>,
Laszlo Ersek <lersek@redhat.com>,
Leif Lindholm <leif@nuviainc.com>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Jiewen Yao <jiewen.yao@intel.com>
Subject: Re: [PATCH 0/4] ArmVirtPkg: use PE/COFF metadata for self relocation
Date: Tue, 9 Jun 2020 11:29:33 +0100 [thread overview]
Message-ID: <ad9dbf27-aa9f-e973-8426-64fd12227ee5@xen.org> (raw)
In-Reply-To: <20200608173413.1100679-1-ard.biesheuvel@arm.com>
Hi Ard,
On 08/06/2020 18:34, Ard Biesheuvel wrote:
> As suggested by Jiewen in response to Ilias RFC [0], it is better to use
> the PE/COFF metadata for self-relocating executables than to rely on ELF
> metadata, given how the latter is only available when using ELF based
> toolchains. Also, we have had some maintenance issues with this code in
> the past, as PIE linking of non-position independent objects is not a well
> tested code path in toolchains in general.
>
> So implement this for the self-relocating PrePi in ArmVirtPkg first.
>
> First, we need to ensure that the module in question is emitted with its
> PE/COFF relocation metadata preserved, by creating a special FDF rule.
>
> We also need to provide a way for the code to refer to the start of the
> image directly, by adding it to the linker script.
>
> Then, it is simply a matter of swapping out the two assembly routines,
> and adding the C code that serves the same purpose but based on PE/COFF
> base relocations.
>
> Note that PE/COFF relocations are considerably more compact than ELF RELA
> relocations, so this does not impact the memory footprint of the resulting
> image adversely.
I have tested the change in a Xen guest. No issues reported.
Tested-by: Julien Grall <julien@xen.org>
Cheers,
--
Julien Grall
next prev parent reply other threads:[~2020-06-09 10:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-08 17:34 [PATCH 0/4] ArmVirtPkg: use PE/COFF metadata for self relocation Ard Biesheuvel
2020-06-08 17:34 ` [PATCH 1/4] ArmVirtPkg: add FDF rule for self-relocating PrePi Ard Biesheuvel
2020-06-09 20:33 ` [edk2-devel] " Laszlo Ersek
2020-06-08 17:34 ` [PATCH 2/4] BaseTools/Scripts/GccBase.lds: export image base symbol Ard Biesheuvel
2020-06-10 21:48 ` Ard Biesheuvel
2020-06-12 5:22 ` [edk2-devel] " Bob Feng
2020-06-08 17:34 ` [PATCH 3/4] ArmVirtPkg/PrePi: use standard PeCoff routines for self-relocation Ard Biesheuvel
2020-06-09 20:35 ` [edk2-devel] " Laszlo Ersek
2020-06-08 17:34 ` [PATCH 4/4] ArmVirtPkg: remove unused files Ard Biesheuvel
2020-06-09 20:36 ` [edk2-devel] " Laszlo Ersek
2020-06-09 0:00 ` [PATCH 0/4] ArmVirtPkg: use PE/COFF metadata for self relocation Yao, Jiewen
2020-06-09 10:29 ` Julien Grall [this message]
2020-06-10 20:35 ` [edk2-devel] " Sami Mujawar
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=ad9dbf27-aa9f-e973-8426-64fd12227ee5@xen.org \
--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