Who needs ld.so anyways?

,

so, while waiting for a meeting at work i had nothing to do. so ofc i was just reading some manuals coz one was open anyways.

one manpage after another here i am at mmap(2). now I knew about its existence, but never used it, so i read a bit more and found out i can request executable pages.

well hun, i cannot resist that. let’s load some code at runtime! and where we’re going we don’t need no ld.so. bah.

a-ba-bam! that was too easy lol, apart from the fact that gnu as is garbage and i wasted 20 mins figuring out why it and ld produced bad elf.

anyways one pacman -S nasm later, and a rewrite from horrible at-t style asm to sane intel style, and here we are.

just map the file into executable mem, pass the args on the stack (kinda breaking sys v x86_64 abi here, but don’t care), and jump into that mem. done :wink:

i might research it more later.


@AnotherDev, and @whoever_else_might_be_interested_in_ this

3 Likes