Best reference for understanding ELF format

Peng Yu pengyu.ut@gmail.com
Tue Apr 20 01:58:02 GMT 2021


On 4/19/21, Szabolcs Nagy <szabolcs.nagy@arm.com> wrote:
> The 04/17/2021 07:31, Peng Yu via Libc-help wrote:
>> That is a book. By definition, a book will not be complete since a
>> book is not written for completeness?
>>
>> For the best reference (as "reference" may have muliple meanings maybe
>> I should use the word "spec" to avoid ambiguity), I found the
>> following two documents. One is for 32-bit, the other is for 64-bit.
>> Are they the most current ones? Other there any other documents that
>> cover the things missed by them?
>>
>> https://refspecs.linuxfoundation.org/elf/elf.pdf
>> https://www.uclibc.org/docs/elf-64-gen.pdf
>
> elf spec is part of the system v abi document.
> the generic part is in
> http://www.sco.com/developers/gabi/
> the processor specific part is published separately by
> whoever does the tooling for the particular processor.
>
> (all this can be found out by 5 minute research on wikipedia)
>
> but since you asked for easy-to-follow and for
> understanding elf i think the book is better.

Updated is also needed. An outdated reference is not preferred even it
is easy to follow.

I found this book is quite outdated. It does not explain the current
gcc and clang.

For example, gcc mostly use RELA instead of REL. But this book says this.

"If the architecture has room for all the addends in the object code
like the x86 does, it uses REL, if not it uses RELA. But in principle
a compiler could save some space on architectures that need addends by
putting all the relocations with zero addends, e.g., procedure
references, in a SHT_REL section and the rest in a SHT_RELA."

64-bit details are not covered much.

So a better reference in terms of all three aspects that I mentioned is needed.

- up-to-date
- easy-to-follow
- complete

-- 
Regards,
Peng


More information about the Libc-help mailing list