Skip to content
This repository has been archived by the owner on Dec 29, 2023. It is now read-only.

ELF format

tyfkda edited this page Dec 2, 2018 · 3 revisions

Format

|  \   | 0| 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|13|14|15|
| 0x00 |   magic   |                                   |
| 0x10 | type|machi|  version  |         entry         |
| 0x20 |          phoff        |         shoff         |
| 0x30 |   flags   |ehsiz|phent|phnum|shent|shnum|shstr|
  • proghdr: 56 bytes
|  \   | 0| 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|13|14|15|
| 0x00 |    type   |   flags   |        offset         |
| 0x10 |          vaddr        |         paddr         |
| 0x20 |         filesz        |         memsz         |
| 0x30 |         align         |

Check

$ readelf -l <elfpath>

Elf file type is EXEC (Executable file)
Entry point 0x60
There are 2 program headers, starting at offset 64

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  LOAD           0x00000000000000c0 0x0000000000000000 0x0000000000000000
                 0x0000000000001871 0x0000000000001b00  RWE    20
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RWE    10

 Section to Segment mapping:
  Segment Sections...
   00     .text .rodata .eh_frame .data .bss
   01

How to load in XV6

//

Clone this wiki locally