View previous topic :: View next topic |
Author |
Message |
larsivi Site Admin
Joined: 27 Mar 2004 Posts: 453 Location: Trondheim, Norway
|
Posted: Sun Dec 25, 2005 6:04 am Post subject: ELF handler status |
|
|
I got some inspiration to do some work now, but silly me, I updated my SVN-copy, sortof breaking quite a lot and forcing me to do some refactoring myself. I suspect this will be like hitting a moving target for a while, but I doubt Eric will write a migration document anyway
The ELF-format itself isn't to difficult to grok, but getting it all to hang together is a somewhat mean task...at least to my fairly limited experience on the subject.
Since the relocation part of the spec is mostly (a simplification of the facts...) a layer on top of the rest, I start with getting something sensible out of the obj's. All of this sortof mean that there will be three ELF loaders:
ELFSoLoader (the most interesting part and I suppose most difficult)
ELFObjLoader (static object files with extension .o)
ELFArLoader (static library loader (mostly just archived .o-files with some possible extras like symbol tables))
I'm not sure yet, but I suppose the ArLoader might just be a wrapper around the ObjLoader, or to get some looser coupling, it might use the registry to get an ObjLoader. Currently I'm aiming at the last one, as I think this might be the best when going crossplatform. Even though ELF is a great spec, it depends on the inner workings across different Unices and machine types (and this is also true for the Ar-spec).
As I told Eric, I am now able to parse at least parts of the ELF object files, but it is slow going and the binary nature of the stuff makes it interesting to debug.
I will start to commit once I feel that I have something usable for at least introspection, but don't expect any wonders until at least the end of January. |
|
Back to top |
|
|
pragma
Joined: 28 May 2004 Posts: 607 Location: Washington, DC
|
Posted: Sun Dec 25, 2005 10:57 am Post subject: Re: ELF handler status |
|
|
larsivi wrote: | I got some inspiration to do some work now, but silly me, I updated my SVN-copy, sortof breaking quite a lot and forcing me to do some refactoring myself. I suspect this will be like hitting a moving target for a while, but I doubt Eric will write a migration document anyway |
Sorry about that. Such is the nature of Beta software I guess... If you have any questions as to where things dissapeared to, let me know.
Quote: |
The ELF-format itself isn't to difficult to grok, but getting it all to hang together is a somewhat mean task...at least to my fairly limited experience on the subject.
Since the relocation part of the spec is mostly (a simplification of the facts...) a layer on top of the rest, I start with getting something sensible out of the obj's. All of this sortof mean that there will be three ELF loaders:
ELFSoLoader (the most interesting part and I suppose most difficult)
ELFObjLoader (static object files with extension .o)
ELFArLoader (static library loader (mostly just archived .o-files with some possible extras like symbol tables))
I'm not sure yet, but I suppose the ArLoader might just be a wrapper around the ObjLoader, or to get some looser coupling, it might use the registry to get an ObjLoader. Currently I'm aiming at the last one, as I think this might be the best when going crossplatform. Even though ELF is a great spec, it depends on the inner workings across different Unices and machine types (and this is also true for the Ar-spec).
As I told Eric, I am now able to parse at least parts of the ELF object files, but it is slow going and the binary nature of the stuff makes it interesting to debug.
I will start to commit once I feel that I have something usable for at least introspection, but don't expect any wonders until at least the end of January. |
This is great news Lars. Keep up the good work and keep us all posted on your progress. _________________ -- !Eric.t.Anderton at gmail |
|
Back to top |
|
|
larsivi Site Admin
Joined: 27 Mar 2004 Posts: 453 Location: Trondheim, Norway
|
Posted: Sun Dec 25, 2005 4:22 pm Post subject: Re: ELF handler status |
|
|
Funny how trusting the spec blindly can eat your time. At the beginning of the ELF-spec, there is a schematic showing the placement of data in an ELF file. After about 4 hours of debugging, I found out that the sections could follow after the section header table anyway.... At least I'm now able to get all headers out of libphobos.a
pragma wrote: | larsivi wrote: | I got some inspiration to do some work now, but silly me, I updated my SVN-copy, sortof breaking quite a lot and forcing me to do some refactoring myself. I suspect this will be like hitting a moving target for a while, but I doubt Eric will write a migration document anyway |
Sorry about that. Such is the nature of Beta software I guess... If you have any questions as to where things dissapeared to, let me know.
|
I'm fully aware of that I have one question about streams though. When parsing the files, I find the std.stream interface to be the simplest way forward. I looked at the ddl.Utils.ReadCursor, but I found it rather not to my liking, but then I don't know if you intend to use it like it is. I saw you mentioned FileConduit somewhere, and that one seems more like it. Anyway, I might need a more specialized version, as much of the data is endiany challenged. Currently I use some small shifting functions to read uints and ushorts the other way round, but I don't find it very elegant, and it makes it tough to use readExact to read entire structs. |
|
Back to top |
|
|
larsivi Site Admin
Joined: 27 Mar 2004 Posts: 453 Location: Trondheim, Norway
|
Posted: Sun Jan 29, 2006 2:45 am Post subject: |
|
|
Time for another update, I suppose. It is slow going, to me this stuff is really complex, and even though there is a lot of documentation out there, it don't tell me how to do what I want to do
I'm currently making a small tool that will help me debug my progress. This tool will then turn into a standard linker to create executables and such. Currently I'm doing the code to assemble the images, and next up is the symbol handling and relocation. When this is done, the linker should supposedly work When that is done, I hopefully will understand enough of the underlying system to achieve the DDL objectives. |
|
Back to top |
|
|
larsivi Site Admin
Joined: 27 Mar 2004 Posts: 453 Location: Trondheim, Norway
|
Posted: Mon May 29, 2006 3:44 pm Post subject: |
|
|
Hmm, the previous post here is definately outdated, as RL caught me back then. I'm trying to ease myself back into this, while Eric has joined the linux world/crew too (good news for the ELF handler!).
I have spent some time refactoring ArchiveLibrary to do lazy loading (when it works as it should, it will still be easy to load all at once). One tricky area is actually figuring out the D symbols (the demangling/mangling support come in handy here). Next up in the ELF part is doing something to the symbols, afaics, there is some mismatch between the symbols pointer to a namestring and the actual namestrings. Actually, most of the symbols just points to \0 as it's namestring, which isn't correct as the stringtable holds many, many D mangled symbols (using phobos as the test lib). |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|