Hacker News new | ask | show | jobs
by bregma 864 days ago
This ELF file is not minimal. A loadable ELF file needs no sections at all. The section header table can be empty and the .shrstr section does not need to be present. The .text entry is a just a pointer into one of the LOAD segments and can also be eliminated.
1 comments

This is acknowledged by the author:

> Technically, the section header table and the section header string table are not needed, but having them sets the stage for adding more sections in the future, namely dynamic linking and debug symbol sections.

The author sounds horribly mistaken.

Even dynamically linked executables tables do not need sections!!

It just so happens to be that the runtime symbol table is defined to be the same format as the normal symbol table. Although it shows up as .dynsym, the runtime linker doesn’t find it that way!

Dynamic linking doesn't require section headers, either, just a PT_DYNAMIC program header to refer to the .dynamic section (which in turn refers to .dynsym, .dynstr, .rela.dyn, .init_array, stc.).
> A loadable ELF file needs no sections at all.

Dynamic linking is a process that takes place with loadable ELF files. A loadable ELF file needs no sections at all.