Posts

Showing posts with the label ELF Executable

How an Executable File Operates

Image
1. Assembly The machine language understood by the CPU is binary code . Assembly expresses machine language in human-readable mnemonic instructions. Therefore, the programming language most similar to machine code is Assembly . To understand how machine code is executed, we will examine a simple Assembly program. The following Assembly code performs the operation of printing the result of "2 + 3". ; Ubuntu 24.04 x86-64 (NASM, ELF64) section .data msg db "result: " msg_len equ $ - msg newline db 0x0a section .bss buf resb 1 section .text global _start _start: mov al, 2 add al, 3 mov bl, al mov rax, 1 mov rdi, 1 mov rsi, msg mov rdx, msg_len syscall mov al, bl add al, '0' mov [buf], al mov rax, 1 mov rdi, 1 mov rsi, buf mov rdx, 1 syscall mov rax, 1 mov rdi, 1...