[bits 64]

file_load_va: equ 4096 * 40

db 0x7f, 'E', 'L', 'F'
db 2
db 1
db 1
db 0
dq 0
dw 2
dw 0x3e
dd 1
dq entry_point + file_load_va
dq program_headers_start
; Section header offset. We don't have any sections, so set it to 0 for now.
dq 0
dd 0
dw 64
dw 0x38
dw 1
; Size of a section header entry.
dw 0x40
; Number of section header entries. Now 0, since we don't have them.
dw 0
; The section containing section names. Not used anymore, so set to 0.
dw 0

program_headers_start:
dd 1
dd 5
dq 0
dq file_load_va
dq file_load_va
; We'll change our single program header to include the entire file.
dq file_end
dq file_end
dq 0x200000

entry_point:
  mov rax, 1
  mov rdi, 1
  mov rsi, file_load_va + message
  mov rdx, message_length
  syscall
  mov rax, 60
  mov rdi, 0
  syscall
code_end:

message: db `Hello, world!\n`
message_length: equ $ - message

file_end: