3 ms·
Hey, good to see you and liblinux again. I'll just add that yes, things are actually way simple from ELF point of view. If you generate an ELF file by hand (or
by titzer 5y ago
Hey, good to see you and liblinux again.
I'll just add that yes, things are actually way simple from ELF point of view. If you generate an ELF file by hand (or from a compiler you write), you can simply point it to the first instruction and the argv, argc, and environment pointers arrive as described above.
Virgil startup code is ~15 assembly instructions (even less for test binaries), and then it calls into the Virgil runtime source to get the heap setup and start allocating the first objects (array of strings for arguments).
I love low level posts like these. It's important we don't forget that C is just one alternative.
- matheusmoreira 5y agoGood to see you and Virgil again! > I love low level posts like these. It's important we don't forget that C is just one alternative. Yes!! It's good to know where Linux ends and all the other stuff begins. Existing documentation makes things really confusing, it assumes people want the C stuff. Sometimes it even tells readers they aren't supposed to touch these "internals". It takes a lot of work to unravel this mess and get to the essential stuff.