The bFLT loader in Linux and QEMU, and the ELF -> bFLT converters, are full-featured, open source, standard and maintainable, and explicitly support dynamic, shared libraries :)
FWIW, I had started to look at porting a bFLT loader to the Nspire platform: http://ourl.ca/14975/284471 . bFLT is simple, can easily be converted from ELF, and does the job we need, AFAICT. It can handle dynamic libraries, too.
But as I mentioned in that topic, I can't handle the port alone :)
[edit]One thing I would like to be improved: the relocator currently replaces Ndless's crt0.S. Which means any startup feature non-related to relocation (such as __crt0_savedsp's initialization) will be lost when switching to ndless-standalone-relocator. What could be done to keep Ndless's crt0.S, and use startup.S as the program entry point?
Looking closer: is crt0.s actually kept, and startup.S added before it?
[edit2]
I'm trying to use it on my Windows computer, but I'm always getting the error:
makeself.exe: Unable to parse ELF file "testlibm.elf".
I'm using libelf v0.8.13 and GNU v2.21. How can we diagnose this?
P R G \0 [ branch instruction ] [number of relocation entries ] [relocation code ] (startup.S finishes here) [array of relocations ] [ original tns file ]
Would it be easier just to write a bFLT loader from scratch?I don't know.
Most likely, this will be abandoned at one point for bFLT anywayMaybe, but for this to happen, other people than ExtendeD or I need to work on the task ;)
@edit2
If you could send me the ELF file you're trying to link, I can take a look at it for you.
@edit2
If you could send me the ELF file you're trying to link, I can take a look at it for you.
Here it is, I'm just trying to troubleshoot this: http://ourl.ca/14975/294135
QuoteWould it be easier just to write a bFLT loader from scratch?I don't know.QuoteMost likely, this will be abandoned at one point for bFLT anywayMaybe, but for this to happen, other people than ExtendeD or I need to work on the task ;)
Neither ExtendeD nor I have enough time to move bFLT forward at the required rate.
I looked at the specifications for bFLT and it's insanely simple.Indeed, which is several of us had thought about it :)
It's not worth trying to port a loader. I spent a few hours today and wrote a basic bFLT loader from scratch.Good job, as usual :)
It's really a trivial task compared to ELF loading. Spend a little extra time on it and dynamic libraries should be easily supported too.And compressed files would be the icing on the cake.
I put up the source code on Github (https://github.com/tangrs/ndless-bflt-loader) with a README with all the information needed to get the loader and a elf2flt toolchain working.Cloned and watched.
@edit: if there's a place with comprehensive documentation about the structure of bFLT files, please do tell me. Most of the 'documentation' I've read are header files and comments in code of existing implementations.The main source of information I know of is http://retired.beyondlogic.org/uClinux/bflt.htm .
QuoteI looked at the specifications for bFLT and it's insanely simple.Indeed, which is several of us had thought about it :)QuoteIt's not worth trying to port a loader. I spent a few hours today and wrote a basic bFLT loader from scratch.Good job, as usual :)QuoteIt's really a trivial task compared to ELF loading. Spend a little extra time on it and dynamic libraries should be easily supported too.And compressed files would be the icing on the cake.QuoteI put up the source code on Github (https://github.com/tangrs/ndless-bflt-loader) with a README with all the information needed to get the loader and a elf2flt toolchain working.Cloned and watched.
I'm sure this will get a lot of testing soon :)Quote@edit: if there's a place with comprehensive documentation about the structure of bFLT files, please do tell me. Most of the 'documentation' I've read are header files and comments in code of existing implementations.The main source of information I know of is http://retired.beyondlogic.org/uClinux/bflt.htm .
EDIT: I created a news about the topic of loading programs at http://tiplanet.org/forum/viewtopic.php?t=8978 :)
Good job tangrs. You may want to create a new topic for the bFLT loader and leave this for you standalone relocator.
Also I know this is going to sound newbish but what exactly do things like bFLT and relocators let you do?
@edit2
If you could send me the ELF file you're trying to link, I can take a look at it for you.
Here it is, I'm just trying to troubleshoot this: http://ourl.ca/14975/294135
That's really weird, it works perfectly on my machine.
I added some extra debugging lines into the latest commit. Could you check it out and recompile and see where it conks out?
ELF: call to elf_begin() failed
makeself.exe: Unable to parse ELF file "testlibm.elf"
I'm now getting:ELF: call to elf_begin() failed
makeself.exe: Unable to parse ELF file "testlibm.elf"
Tell me if you want more tests, or maybe you now prefer to invest efforts on the bflt loader.
static int
xread(int fd, char *buffer, size_t len) {
//...
while (done < len) {
n = read(fd, buffer + done, len - done);
if (n == 0) {
/* premature end of file */
// HERE
return -1;
}
//...
}