I wanted to play with ia_64
assembly and linker(s).
In the beginning, I wanted to learn more about linking and system calls, two different subjects. I thought that the simplest program is done in assembly and that this simplest program needs the simplest linking command. After that, system calls where an evidence because the easiest way to ensure a program works well is writing something on the console.
I use nasm
which use the Intel assembly syntax that I learned nearly 40 years ago. Ghidra
shows me all the internals of the final program.
This program do only one thing: copy stdout
to stdin
. With redirections and pipes, we can do things like that:
$ ./acat < *.asm | grep -w db | wc
16 89 431
$
It was done to test the syscall
instruction.
Note: why acat
? Because acat ze bluez.
ld
can be used as linker because we don't call libc
, we just make 3 syscall
:
read
fromstdin
,write
tostdout
orstderr
,exit
from the program.
Today, it only prints one line of the processor characteristics. It only exists to play with the cpuid
instruction.
ld
can be used as linker because we don't call libc
, we just make 2 syscall
:
write
tostdout
orstderr
,exit
from the program.