BITS 32
org 08040000h
ehdr: ; Elf32_Ehdr
db 0x7F, "ELF", 1, 1, 1, 0 ; e_ident
times 8 db 0
dw 2 ; e_type
dw 3 ; e_machine
dd 1 ; e_version
dd _start ; e_entry
dd phdr - $$ ; e_phoff
dd 0 ; e_shoff
dd 0 ; e_flags
dw ehdrsize ; e_ehsize
dw phdrsize ; e_phentsize
dw 1 ; e_phnum
dw 0 ; e_shentsize
dw 0 ; e_shnum
dw 0 ; e_shstrndx
ehdrsize equ $ - ehdr
phdr: ; Elf32_Phdr
dd 1 ; p_type
dd 0 ; p_offset
dd $$ ; p_vaddr
dd $$ ; p_paddr
dd filesize ; p_filesz
dd filesize ; p_memsz
dd 5 ; p_flags
;; The relocation table. The addresses of the functions imported from
;; libX11 are stored in the program's bss area. Since they will be
;; used with indirect calls, the R_386_32 relocation is used throughout.
reltext:
dd XClearArea_rel
db 1, XClearArea_sym, 0, 0 dd 0x1000 ; p_align
phdrsize equ $ - phdr
reltext_size equ $ - reltext
;; The interpreter pathname. The final NUL byte appears in the next
;; section.
interp:
db '/lib/ld-linux.so.2'
interp_size equ $ - interp + 1
;; The string table for the dynamic symbol table.
dynstr:
db 0
dynamic_name equ $ - dynstr
db '_DYNAMIC', 0