On 11/8/10 10:52 AM, André Hentschel wrote: > @@ -321,7 +321,8 @@ static int check_platform( struct options *opts, const > char *file ) > unsigned char header[16]; > if (read( fd, header, sizeof(header) ) == sizeof(header)) > { > - /* FIXME: only ELF is supported, platform is not checked beyond > 32/64 */ > + /* FIXME: only ELF and Macho-o is supported, platform is not > checked beyond 32/64 */ Typo 'Macho-o'. > @@ -331,6 +332,15 @@ static int check_platform( struct options *opts, const > char *file ) > ret = (opts->force_pointer_size == 4 || > (!opts->force_pointer_size && opts->target_cpu != > CPU_x86_64)); > } > + /* Big Endian or Little Endian Mach-o File */ > + else if (!memcmp( header, "\376\355\372\316", 4 ) || !memcmp( > header, "\316\372\355\376", 4 )) For 64-bit files, the magic number is 0xfeedfacf, not 0xfeedface. (Notice how the 64-bit magic is one more than the 32-bit magic.) You should check for that, too.
I would like to take this time to point out that on Mac OS, there are no separate 32-bit and 64-bit library directories (i.e. no lib32 and lib64, only lib). If you want a 32-bit and a 64-bit version of a binary or library installed, you're expected to build a fat binary/library. Nearly all of the system libraries and binaries installed with Mac OS X are in fact fat. Chip