Today I was challenged to make a program in C, assembly and then pure ELF-64, I chose a "Hello world" program, and so, I wrote a program in C, then in (NASM x86_64 Linux) assembly and then, well pure ELF-64, Firstly I made a C program to generate the program, I took the bytes of it and put it into python...
Then I made a GitHub repo: https://github.com/TruncatedDinosour/low-hello-world
But before that I compiled the ones I needed to and the results shocked me:
- C89 (GCC, stripped):
gcc -std=c89 -s hello_world.c]
- Assembly (NASM, stripped):
nasm -felf64 hello_world.asm -s && ld -o a.out hello_world.o -s]
And the one that shocked me the most:
And that made me think, is assembly... Bloated? The difference is HUGE and they do the same think, it's so insane.
So now I got a project idea in mind, less Bloated assembly, but idk...
It's so wild how going lower than low level can make such huge difference, but then again, with using assembly and assemblers like NASM you get a lot more features and stuff.
But with manual elf generation you get infinite control, which is nice.
I know, you can probably "Shoot yourself in the foot" by manually generating ELF but the amount of space you can save is crazy.
Debugging will also be more painful with manually generating assembly, no sections and stuff, but it's still very interesting
Anyway, conclusion, rust is bloated, assembly is bloated, everything is bloated, the lower you go the less bloat you get apparently, it's nice :)
But besides that, assembly is still great, C is great, rust... Not so much but whatever, don't stop using it because "Ari said it's bloated", it's more than okay to use them, still very shocking results, assembly runs and will always run everything and you can't do anything about that generating ELF gave me like 947 mental illnesses so I think I will stay with assembly, but I will consider making less bloated assembly lol
Anyway, thanks for listening to me, sorry if I offended anyone, this wasn't my intention, just sharing the results lol :)
See you in the next blog, have a good rest of your day :)