Resources on ELF:
- Making teensy programs
- goes down to 45 bytes
- Undestanding ELF
- Good high level overview / motivation explaner
- Overview of ELF and how to inspect it using tools
- Overview of basic format
- Spec for 64 bit
- has 64 bit program section format
- Full spec - includes a lot of extra stuff we don't need Overview of ELF:
- Used for linking, dynamic libraries, executables
- Format
Assembly:
; tiny.asm
BITS 64
GLOBAL _start
SECTION .bss
str:resb 1
SECTION .text
_start:
mov [str], byte 10
mov edx,1 ;message length
mov ecx,str ;message to write
mov ebx,1 ;file descriptor (stdout)
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel
mov eax, 1
mov ebx, 42
int 0x80