This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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-154889

Attachment: smime.p7s
Description: S/MIME cryptographic signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]