
2. The BFD way
I just want to remark that anyone contemplating hacking on object files should steer well clear of BFD which is the most inconsistently implemented, poorly (though abundantly) documented obstacle to quality programming it has ever been my misfortune to use. Particularily galling is the fact that BFD provides little indication (in documentation, compile-time errors, etc.) that certain functionality is completely unimplemented on a particular platform. In contrast, libelf is widely available (multiple implementations exist), well documented, a joy to use and covers everything (well, everything that GHC runs on) but Windows. I once had a tool to manipulate .o files using BFD. When I needed to upgrade it slightly (to access debugging information as well as normal symbols), I spent the best part of a week failing to get this small piece of additional functionality to work with BFD and less than a day rewriting the whole thing from scratch with libelf. -- Alastair Reid alastair@reid-consulting-uk.ltd.uk Reid Consulting (UK) Limited http://www.reid-consulting-uk.ltd.uk/alastair/ ps It's not clear to me whether BFD uses the wrong abstractions or simply tries to do too much and so ends up doing a lot badly. There's even the (slim) possibility that BFD just needs better documentation and a few small, simple example programs instead of the multi-thousand line programs it ships with. It might be interesting to try to write a BFD2 which fixes BFDs most glaring problems based on the enormous amount of experience embodied by BFD's implementation.