I am writing a simple user-space ELF loader under Linux (why? for \'fun\'). My loader at the moment is quite simple and is designed to load only statically-linked ELF files con
I don't see any way you can do that, unless you emulate the kernel-provided virtual address space completely, and run the code inside that virtual space. When you mmap the data section from the file, you are intrinsically relocating it to an unknown address of the virtual address space of your ELF interpreter, and your code will not be able to reference to it in any way.
Glad to be proven wrong. There's something very cool to learn here.