U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
To: Patrick Zacharias <littlefighter19@web.de>
Cc: u-boot@lists.denx.de, Ilias Apalodimas <ilias.apalodimas@linaro.org>
Subject: Re: [PATCH] efi: arm,arm64: Fix relocations from not being loaded
Date: Sun, 6 Nov 2022 10:20:45 +0100	[thread overview]
Message-ID: <6f2b45fb-8b2e-e1cf-e3f5-5a30f0cefe39@gmx.de> (raw)
In-Reply-To: <7eeee0cc-2652-83d1-149e-6b5c0eb3b3ef@web.de>

On 10/31/22 21:01, Patrick Zacharias wrote:
> Prior to this commit, the relocations would not get loaded by the efi
> loader.
>
> This lead to none of the relocations being applied.
>
> Signed-off-by: Fighter19 <1475802+Fighter19@users.noreply.github.com>

Thanks Patrick for your contribution.

You can use scripts/get_maintainer.pl to determine to whom a patch
should be sent.

Where did you actually see relocations?
Which code is not position independent?

> ---
>   arch/arm/lib/elf_aarch64_efi.lds | 2 +-
>   arch/arm/lib/elf_arm_efi.lds     | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/lib/elf_aarch64_efi.lds
> b/arch/arm/lib/elf_aarch64_efi.lds
> index c0604dad46..1982864d17 100644
> --- a/arch/arm/lib/elf_aarch64_efi.lds
> +++ b/arch/arm/lib/elf_aarch64_efi.lds
> @@ -46,12 +46,12 @@ SECTIONS
>           *(COMMON)
>           . = ALIGN(512);
>           _bss_end = .;
> -        _edata = .;
>       }
>       .rela.dyn : { *(.rela.dyn) }
>       .rela.plt : { *(.rela.plt) }
>       .rela.got : { *(.rela.got) }
>       .rela.data : { *(.rela.data) *(.rela.data*) }
> +    _edata = .;
>       _data_size = . - _etext;
>
>       . = ALIGN(4096);
> diff --git a/arch/arm/lib/elf_arm_efi.lds b/arch/arm/lib/elf_arm_efi.lds
> index 767ebda635..c1b58a8033 100644
> --- a/arch/arm/lib/elf_arm_efi.lds
> +++ b/arch/arm/lib/elf_arm_efi.lds
> @@ -46,12 +46,12 @@ SECTIONS
>           *(COMMON)
>           . = ALIGN(512);
>           _bss_end = .;
> -        _edata = .;
>       }
>       .rel.dyn : { *(.rel.dyn) }
>       .rel.plt : { *(.rel.plt) }
>       .rel.got : { *(.rel.got) }
>       .rel.data : { *(.rel.data) *(.rel.data*) }
> +    _edata = .;

Relocations (if they exist) should be in the .reloc section, not in the
.data section.

If we want to create a .reloc section, we have to change
arch/arm/lib/crt0_*_efi.S too. Furthermore the relocation section must
be pointed to by field BaseRelocationTable of the Optional Header Data
Directories (see PE-COFF specification).

Please, consider the other UEFI architectures (x86 and RISC-V) too.

Best regards

Heinrich

>       _data_size = . - _etext;
>
>       /DISCARD/ : {


  reply	other threads:[~2022-11-06  9:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-31 20:01 [PATCH] efi: arm,arm64: Fix relocations from not being loaded Patrick Zacharias
2022-11-06  9:20 ` Heinrich Schuchardt [this message]
2022-11-06 17:03   ` Patrick Zacharias
2022-11-06 18:36     ` Patrick Zacharias
2022-11-06 22:02       ` Heinrich Schuchardt
2022-11-06 21:37     ` Heinrich Schuchardt
2022-11-07 16:47       ` Patrick Zacharias

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-all 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=6f2b45fb-8b2e-e1cf-e3f5-5a30f0cefe39@gmx.de \
    --to=xypron.glpk@gmx.de \
    --cc=ilias.apalodimas@linaro.org \
    --cc=littlefighter19@web.de \
    --cc=u-boot@lists.denx.de \
    /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