serge1 / ELFIO

ELFIO - ELF (Executable and Linkable Format) reader and producer implemented as a header only C++ library
http://serge1.github.io/ELFIO
MIT License
729 stars 158 forks source link

Entry of elf executable #49

Closed circutrider21 closed 3 years ago

circutrider21 commented 4 years ago

This is more of a question than a issue, but how do we determine the entry address of a elf executable. In the tutorial, the entry address was 0x08048000, but I have no idea where that number came from.

Any explanation would be be helpful

PS: Could someone also explain align and what is is, Thanks!

serge1 commented 3 years ago

Hi,

The entry address is the code location where a program starts its execution. Usually, a linker sets this address on base of ‘_start’ label.

For the case of the ‘writer’ example, the code starts at the first address. The code resides in ‘text_seg’ segment. This segment is placed at address 0x08048000. Therefore, the start address is also set to be equal to 0x08048000.

Best regards, Serge

serge1 commented 3 years ago

The similar comment has been added to the example source file

circutrider21 commented 3 years ago

Thanks!