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]

Re: [PATCH] Mach-O: Remove ambiguity of mach-o-le and mach-o-x86-64


Hi...

On 15 Dec 2011, at 18:26, shinichiro hamaji wrote:

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).

I was wondering recently whether there is any value to retaining this generic mach-o-le when we have specific vecs for the actual targets?


(I have a local implementation for the powerpc* vecs, to post at some stage too).
Iain


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

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;


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