As a quick follow-up to my previous post, BFD is only used on Mac OS X by gdb.
The Mac OS X binary tools don't use BFD, so for instance, ld has it's own
binary format reader, and provides its own nm, etc. Pretty much all BFD is
needed for in gdb is to open and parse the segments and sections of Mach-O
object files. That part of it works quite well. But no other part
has been tested, since the tools that exercise them are not supported.
For this reason, using BFD to load object code on Mac OS X isn't encouraged.
Instead, the dynamic loader comes with its own API's to do all this.
Below is a SPECIAL_RSYM file to grab external symbols from a Mach-O object
file.
Cheers,
Aurelien
/*
File rsym_macosx.c
Build an executable rsym for Mac OS X (31 July 2003).
Grab only the external symbols from a Mach-O object file, and put them
in a simple format. This information will be used for relocation.