bug-mes
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ELF header and footer


From: Jan Nieuwenhuizen
Subject: Re: ELF header and footer
Date: Tue, 02 Jun 2020 16:51:43 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Danny Milosavljevic writes:

Hello Danny,

> in wip-arm, I have lib/linux/arm-mes as completely independent directory.
>
> However, it's quite similar to lib/linux/x86-mes in content.
>
> Summary of diff:
>
> * lib/linux/arm-mes/elf32-footer-single-main.hex2 is identical
> * lib/linux/arm-mes/elf32-header.hex2 is almost identical
> * lib/linux/x86-mes/elf32-0header.hex2 is almost identical (!!)
> * lib/linux/arm-mes/elf32-0hello-mes.hex2 is different-ish
> * lib/linux/arm-mes/elf32-body-exit-42.hex2 is different-ish
> * lib/linux/arm-mes/elf32-body-hello-mes.hex2 is different-ish
> * lib/linux/arm-mes/elf32-0exit-42.hex2 is almost completely different

[..]

> diff -ru lib/linux/x86-mes/elf32-0exit-42.hex2 
> lib/linux/arm-mes/elf32-0exit-42.hex2

>  # @60
>  :ELF_text
> -b8 01 00 00 00                 # mov    $1, %eax
> -bb 2a 00 00 00                 # mov    $42, %ebx
> -cd 80                          # int    $0x80
> -f4                             # hlt
> -00 00 00                       # align to @70
> +01 70 a0 e3                    # mov    r7,$0x1
> +2a 00 a0 e3                    # mov    r0,$0x2a
> +00 00 00 ef                    # swi    0
> +03 f0 20 e3                    # wfi

Seems legit ;-)

>  :ELF_end

> diff -ru lib/linux/x86-mes/elf32-0header.hex2 
> lib/linux/arm-mes/elf32-0header.hex2
> --- lib/linux/x86-mes/elf32-0header.hex2      2020-06-01 21:28:22.903358379 
> +0200
> +++ lib/linux/arm-mes/elf32-0header.hex2      2020-06-02 00:56:17.617474310 
> +0200
> @@ -1,5 +1,6 @@
>  ### Copyright (C) 2016 Jeremiah Orians
>  ### Copyright (C) 2017,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
> +### Copyright (C) 2019 Danny Milosavljevic <dannym@scratchpost.org>

[..]

> +28 00                          # e_machine Indicating 32bit arm
>  01 00 00 00                    # e_version Indicating original elf


>  &ELF_text                      # e_entry Address of the entry point
>  %ELF_program_headers>ELF_base  # e_phoff Address of program header table
>  00 00 00 00                    # e_shoff Address of section header table
>  
> -00 00 00 00                    # e_flags
> +00 02 00 05                    # e_flags Indicating EABI5: 
> EF_ARM_ABI_FLOAT_SOFT

Almost trivial, but pretty essential...

> Do we want to share stuff between those, or is it too much work for
> too little gain?

Usually I'm a big champion for avoiding any duplication but I think it's
not worth it: I am not so much worried about any extra work, but I am a
bit worried that removing duplication makes it all much more complex.

One thing that would hope for Mes is to become more simple to understand
and to build*.  It's not overly complex, but many things could be
simpler.  We should try to do anything that helps transparency,
auditability is a good thing, I think.

Sorry if that sounds a "cheap" thing to say now that ARM just starts to
work; but I do not mean this in an ARM-specific way at all.  On the
contrary; I believe that having ARM too will make auditing x86 easier
because you can look for patterns.

But it could be that I'm missing an obvious way to avoid duplication
here!  WDYT?

Greetings,
Janneke

* build: I have this wip-auto* branches that I've been carrying for
  quite a while now.  I used to oppose autotools because of their
  complexity, using the file system as cache, and bootstrapping
  problems.  However, I have come to appreciate autotools in that
  it's pretty well documented, and much easier to understand than
  a home-grown system (like Mes has), if you already know it...

-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | AvatarĀ® http://AvatarAcademy.com



reply via email to

[Prev in Thread] Current Thread [Next in Thread]