This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Mach-O: Remove ambiguity of mach-o-le and mach-o-x86-64
- From: Tristan Gingold <gingold at adacore dot com>
- To: shinichiro hamaji <shinichiro dot hamaji at gmail dot com>
- Cc: binutils Development <binutils at sourceware dot org>
- Date: Fri, 16 Dec 2011 09:28:09 +0100
- Subject: Re: [PATCH] Mach-O: Remove ambiguity of mach-o-le and mach-o-x86-64
- References: <CALOyH=++wnGQePk8YVFHsoE5pfF7H7==yjw75Xk8yAHp2TjW-A@mail.gmail.com>
On Dec 15, 2011, at 7:26 PM, shinichiro hamaji wrote:
> Hi,
>
> When we use objdump for x86-64 mach-o files without explicit -b flag,
> it says "File format is ambiguous" because there are two matching
> formats (mach-o-le and mach-o-x86-64). It's especially not useful when
> we run objdump for a fat binary which contains x86-64. Actually, I
> couldn't find any way to dump contents of x86-64 part of a fat binary.
> It seems i386 is OK as i386 mach-o doesn't match mach-o-le. This tiny
> patch does the same thing for x86-64:
> http://shinh.skr.jp/t/mach-o-64-le.patch
How did you configure binutils ? It worked for me.
I think it would be better to use the match_priority field.
Tristan.
>
> bfd/
> 2011-12-16 Shinichiro Hamaji <shinichiro.hamaji@gmail.com>
>
> * mach-o.c (bfd_mach_o_header_p): Don't handle x86-64 mach-o
> when cputype is not specified. This case should be handled by
> mach-o-x86-64.c.
> diff --git a/bfd/mach-o.c b/bfd/mach-o.c
> index 325cf61..a455b09 100644
> --- a/bfd/mach-o.c
> +++ b/bfd/mach-o.c
> @@ -3266,7 +3266,8 @@ bfd_mach_o_header_p (bfd *abfd,
> switch (header.cputype)
> {
> case BFD_MACH_O_CPU_TYPE_I386:
> - /* Handled by mach-o-i386 */
> + case BFD_MACH_O_CPU_TYPE_X86_64:
> + /* Handled by mach-o-i386 or mach-o-x86-64 */
> goto wrong;
> default:
> break;