tech-toolchain archive

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

Re: ELF sections vs. segments



In article <20170119160215.GI20228%pony.stderr.spb.ru@localhost>,
Valery Ushakov  <uwe%stderr.spb.ru@localhost> wrote:
>The question I have can probably be classified as a platonic
>essentialism problem, but it has some practical conseqeunces too.
>
>I've noticed that netbsd native elf signature check looks for a netbsd
>note _section_.
>
>  sys/kern/exec_elf.c
>  - netbsd_elf_signature
>
>
>OTOH, linunx compat looks for a linux note _segment_.
>
>  sys/compat/linux/common/linux_exec_elf32.c
>  - ELFNAME2(linux,signature)
>
>
>Normally, it doesn't matter, as there's a note segment for each note
>section.  However I'm playing with a forth system that cross-compiles
>and writes out its own ELF image and that standalone image only has
>segments, but no sections.
>
>I'm inclined to think that a standalone ELF binary should be able to
>get away with this kind of arrangement.  Sections are for linkers,
>segments are for loaders.  The binary is intended to be loaded, so it
>provides info about its segments and that should be enough.
>
>Comments?  Shall we fix the check to look for note segments?
>
>PS: Nit-picking - src/sys/kern/core_elf32.c ELFNAMEEND(coredump) uses
>several variable names with "section" to refer to segments.  This
>should probably be fixed.

Yup, go for it :-)

christos



Home | Main Index | Thread Index | Old Index