This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Universal Mach-O target for BFD
- From: Ryan Govostes <rgovostes at gmail dot com>
- To: binutils at sourceware dot org
- Date: Thu, 8 Oct 2009 16:59:44 -0400
- Subject: Universal Mach-O target for BFD
I noticed that GDB 7, while it supports single-architecture Mach-O
files, does not like "universal" (fat) binaries.
I haven't done any hacking on gdb / binutils before, so I'm not sure
of the extent of changes that need to be made. I expect it's something
like,
1. Add support for universal binaries to BFD.
2. Add flags to GDB to select which architecture to extract.
For the first one, I'm not sure if there is precedent in BFD on how to
handle fat binaries, but here's the gist of how a multiarchitecture
file is laid out[1] (all in big-endian byte ordering):
1. The 4-byte magic number 0xCAFEBABE.
2. A 4-byte unsigned integer expressing the number of architectures:
3. A number of structs, one per object file, as follows:
a. A cpu_type_t specifying the CPU family.
b. A cpu_subtype_t specifying the CPU family member.
c. A 4-byte offset from the beginning of the file to the start of the
Mach-O header for the object file.
d. A 4-byte size of the object file, in octets.
e. A 4-byte alignment value for the offset == log(offset) / log(2)
I'd be glad to try my hand at implementing it; does anyone have any
pointers for where to get started?
Regards,
Ryan Govostes
1: http://developer.apple.com/mac/library/DOCUMENTATION/DeveloperTools/Conceptual/MachORuntime/Reference/reference.html#//apple_ref/doc/uid/20001298-154889Attachment:
smime.p7s
Description: S/MIME cryptographic signature