I'm learning elf file layout, so I'm reading Executable_and_Linkable_Format.
In the beginning, I used `readelf -a` to exmine elf(.o file), but it provided is not my want, so I used hexdump -C to exmined it binaries form.
I used `as -Og -g ... -o ..., ld ... -o ...` and `hexdump -C ...` to examine elf file, below is my code.
I'm looking for `program header, section header`, .etc. But I'm not sure my search method is correct!
Please connect with above picture.
notice: `objdump -x can` display all headers, but I guess it maybe analyses binary file then displays something we want. So I try to understand the binary file format!
In the beginning, I used `readelf -a` to exmine elf(.o file), but it provided is not my want, so I used hexdump -C to exmined it binaries form.
I used `as -Og -g ... -o ..., ld ... -o ...` and `hexdump -C ...` to examine elf file, below is my code.
Code:
.section .data
iary:
.int 1, 2
lary:
.long 3, 4
.section .text
.globl _start
_start:
movq $0, %rdi
leaq iary(, %rdi, 4), %rbx
movl iary(, %rdi, 4), %ecx
movq $1, %rdi
leaq iary(, %rdi, 4), %rbx
movl iary(, %rdi, 4), %ecx
#===============================
movq $0, %rdi
leaq lary(, %rdi, 4), %rbx
movl lary(, %rdi, 4), %ecx
movq $1, %rdi
leaq lary(, %rdi, 4), %rbx
movl lary(, %rdi, 4), %ecx
movq $60, %rax
syscall
I'm looking for `program header, section header`, .etc. But I'm not sure my search method is correct!
Please connect with above picture.
notice: `objdump -x can` display all headers, but I guess it maybe analyses binary file then displays something we want. So I try to understand the binary file format!