Re: [RFC PATCH 07/10] arm: efi_loader: discard hash, unwind information

2023-05-22 Thread Heinrich Schuchardt



Am 22. Mai 2023 21:25:50 MESZ schrieb Sam Edwards :
>Hi Ilias,
>
>On 5/22/23 01:00, Ilias Apalodimas wrote:
>> The reason we end up with both hash and gnu.hash is because the hash
>> style is set to 'both'.  Should we perhaps use (and strip) only one of
>> them?
>
>If we do keep one, it should probably be .hash -- see commit b02bfc4dfc.
>
>I admit I'm completely mystified as to why we need the hash tables at all. The 
>ELF spec says those are just for the dynamic linker, but neither the EFI code 
>nor the self-relocating thunk require it, and I don't know of any target where 
>the u-boot ELF itself is the shipped binary. For all I know, there never was a 
>need to include .hash and Albert's commit fixed whatever problem he was facing 
>only accidentally. Do you have any insights?
>

Ubuntu's and Debian's u-boot-qemu package ships uboot.elf for multiple 
architectures. Cf. https://packages.debian.org/bullseye/all/u-boot-qemu/filelist

You can pass uboot.elf as -kernel parameter to QEMU.

Best regards

Heinrich 


>LLD's --hash-style option doesn't appear to have a "none" option or I'd just 
>be making use of that here.
>
>Cheers,
>Sam


Re: [RFC PATCH 07/10] arm: efi_loader: discard hash, unwind information

2023-05-22 Thread Ilias Apalodimas
Hi Sam,

On Mon, 22 May 2023 at 22:25, Sam Edwards  wrote:
>
> Hi Ilias,
>
> On 5/22/23 01:00, Ilias Apalodimas wrote:
> > The reason we end up with both hash and gnu.hash is because the hash
> > style is set to 'both'.  Should we perhaps use (and strip) only one of
> > them?
>
> If we do keep one, it should probably be .hash -- see commit b02bfc4dfc.
>
> I admit I'm completely mystified as to why we need the hash tables at
> all. The ELF spec says those are just for the dynamic linker, but
> neither the EFI code nor the self-relocating thunk require it, and I
> don't know of any target where the u-boot ELF itself is the shipped
> binary.

Me neither

> For all I know, there never was a need to include .hash and
> Albert's commit fixed whatever problem he was facing only accidentally.
> Do you have any insights?

Unfortunately not.  I just started looking up the linker scripts myself.

>
> LLD's --hash-style option doesn't appear to have a "none" option or I'd
> just be making use of that here.

Indeed.  I am fine with the patch regardless, switching the makefile
to only produce one of them is a nit anyway, since we'll eventually
get rid of them

Thanks
/Ilias
>
> Cheers,
> Sam


Re: [RFC PATCH 07/10] arm: efi_loader: discard hash, unwind information

2023-05-22 Thread Sam Edwards

Hi Ilias,

On 5/22/23 01:00, Ilias Apalodimas wrote:

The reason we end up with both hash and gnu.hash is because the hash
style is set to 'both'.  Should we perhaps use (and strip) only one of
them?


If we do keep one, it should probably be .hash -- see commit b02bfc4dfc.

I admit I'm completely mystified as to why we need the hash tables at 
all. The ELF spec says those are just for the dynamic linker, but 
neither the EFI code nor the self-relocating thunk require it, and I 
don't know of any target where the u-boot ELF itself is the shipped 
binary. For all I know, there never was a need to include .hash and 
Albert's commit fixed whatever problem he was facing only accidentally. 
Do you have any insights?


LLD's --hash-style option doesn't appear to have a "none" option or I'd 
just be making use of that here.


Cheers,
Sam


Re: [RFC PATCH 07/10] arm: efi_loader: discard hash, unwind information

2023-05-22 Thread Ilias Apalodimas
Hi Sam

On Sat, 20 May 2023 at 23:56, Sam Edwards  wrote:
>
> LLD tends to put these at the very beginning of the file, only
> for the .text 0x0 directive to end up going backward and
> overlapping them, creating an error.
>
> Since they don't appear to be used at runtime, just discard them.
>
> Signed-off-by: Sam Edwards 
> ---
>
>  arch/arm/lib/elf_arm_efi.lds | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/arch/arm/lib/elf_arm_efi.lds b/arch/arm/lib/elf_arm_efi.lds
> index 767ebda635..0b6cc5bcb6 100644
> --- a/arch/arm/lib/elf_arm_efi.lds
> +++ b/arch/arm/lib/elf_arm_efi.lds
> @@ -62,5 +62,8 @@ SECTIONS
> *(.dynstr)
> *(.note.gnu.build-id)
> *(.comment)
> +   *(.hash)
> +   *(.gnu.hash)

The reason we end up with both hash and gnu.hash is because the hash
style is set to 'both'.  Should we perhaps use (and strip) only one of
them?

Thanks
/Ilias

> +   *(.ARM.exidx)
> }
>  }
> --
> 2.39.2
>


[RFC PATCH 07/10] arm: efi_loader: discard hash, unwind information

2023-05-21 Thread Sam Edwards
LLD tends to put these at the very beginning of the file, only
for the .text 0x0 directive to end up going backward and
overlapping them, creating an error.

Since they don't appear to be used at runtime, just discard them.

Signed-off-by: Sam Edwards 
---

 arch/arm/lib/elf_arm_efi.lds | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/lib/elf_arm_efi.lds b/arch/arm/lib/elf_arm_efi.lds
index 767ebda635..0b6cc5bcb6 100644
--- a/arch/arm/lib/elf_arm_efi.lds
+++ b/arch/arm/lib/elf_arm_efi.lds
@@ -62,5 +62,8 @@ SECTIONS
*(.dynstr)
*(.note.gnu.build-id)
*(.comment)
+   *(.hash)
+   *(.gnu.hash)
+   *(.ARM.exidx)
}
 }
-- 
2.39.2