226
Ndless / ELF Loader for Ndless - (now ready for non-dev use)
« on: December 15, 2011, 04:41:52 am »
The ELF loader has reached a stage where most people can use it to load basic stuff.
When you run the program, it installs a hook. After that, you can load ELF files as if you'd load a normal Ndless binary.
More instructions on how to compile the loader and how to develop applications that take advantage of it are described in the README.
You can get the source code on Github.
Happy deving!
I'd also like to thank everyone who contributed to Ndless. I did borrow some of Ndless's code for use in this loader.
Original post:
I'm not sure if it's relevant here, but I'm developing an opensource ELF loader for Ndless.
I'm writing this because the current Ndless way of loading binaries doesn't work for code that relies on static initialization of pointers.
I.e. code like this doesn't work:
Unfortunately, there's no way to fix this because Ndless binaries are converted into a memory image before running. That means the relocation code doesn't know what to update in the .data section of the memory because it doesn't know what symbols exist and need updating and where they're located.
Loading from an ELF file works because the symbol definitions are there and the relocation code knows where to find the bits that need patching. That's why I wrote this ELF loader.
Anyway, the core code is there, just needs a lot of polishing up.
If anyone wants to help, the source code is available on Github https://github.com/tangrs/ndless-elfloader
I'm hoping eventually, it will be integrated into the program loader on Ndless.
Thanks for your time,
Apologies if this is the wrong forum to post.
When you run the program, it installs a hook. After that, you can load ELF files as if you'd load a normal Ndless binary.
More instructions on how to compile the loader and how to develop applications that take advantage of it are described in the README.
You can get the source code on Github.
Happy deving!
I'd also like to thank everyone who contributed to Ndless. I did borrow some of Ndless's code for use in this loader.
Original post:
I'm not sure if it's relevant here, but I'm developing an opensource ELF loader for Ndless.
I'm writing this because the current Ndless way of loading binaries doesn't work for code that relies on static initialization of pointers.
I.e. code like this doesn't work:
Code: [Select]
void foo() {
//blah
}
int main() {
static void (*var)() = foo; //Since it's static, the address will be inserted at link time (which is 0x8000+offset on my machine)
var(); //The GOT based relocation code in Ndless currently does not update the static variable function pointer.
return 0; //Crash
}
Unfortunately, there's no way to fix this because Ndless binaries are converted into a memory image before running. That means the relocation code doesn't know what to update in the .data section of the memory because it doesn't know what symbols exist and need updating and where they're located.
Loading from an ELF file works because the symbol definitions are there and the relocation code knows where to find the bits that need patching. That's why I wrote this ELF loader.
Anyway, the core code is there, just needs a lot of polishing up.
If anyone wants to help, the source code is available on Github https://github.com/tangrs/ndless-elfloader
I'm hoping eventually, it will be integrated into the program loader on Ndless.
Thanks for your time,
Apologies if this is the wrong forum to post.