A pure-Nim ELF loader for x86-64 systems
- Nim 100%
| src | ||
| tests | ||
| .gitignore | ||
| config.nims | ||
| neo.lock | ||
| neo.paths | ||
| neo.toml | ||
| nim.cfg | ||
| README.md | ||
elf_loader
This repo just has a tiny generic-ish ELF loader written entirely in Nim.
It doesn't aim to replace glibc's dlfcn entirely, rather just act as a generic loader for various different ELF variants on the same system (e.g loading a Bionic-compiled shared object on desktop GNU/Linux), regardless of compatibility, though this'll probably require a lot more work.
It does not depend on C library functions, but its underlying code (like the Nim runtime and external dependencies) do. That's a long-term goal to fix.
roadmap
- map segments and stuff
- open glibc
- perform enough relocations to make it happy
- call
.init_array - basic calls like
_exitwork (calls that reach into glibc's internal state either don't work, or end up deadlocking, say, if they try messing with a futex) - some calls like
openwork, but crash and/or cause UB if they try setting errno (probably TLS work is required) - loading bionic shared objects on glibc linux
- Proper TLS initialization (glibc-style)