I want to be able to write in pure machine code, aka. writing the bytes myself and not using assembly (why? just for fun). For starters, I have this very simple assembly program.
Linux x86-64 Assembly:
section .text
global _start
_start:
mov rax, 60
mov rdi, 0
syscall
Using nasm
and ld
to compile gives me a 5 KB executable. On looking into the file, I realised that most of the space was just occupied by zeroes.
Is it possible to remove these zeroes and to filter everything unnecessary so that I could somehow copy the commands for mov instructions, etc and write in machine code from scratch?