[commit: ghc] master: Patch for #7628: improve error message when mixing 32 and 64 bit images (on Mac OS X) (12e3d3f)

Ian Lynagh igloo at earth.li
Tue Jan 29 17:43:46 CET 2013


Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/12e3d3f4690d76b57ca70cdfdbad049fabd79bde

>---------------------------------------------------------------

commit 12e3d3f4690d76b57ca70cdfdbad049fabd79bde
Author: Andy Adams-Moran <andy.adamsmoran at gmail.com>
Date:   Fri Jan 25 11:11:01 2013 -0800

    Patch for #7628: improve error message when mixing 32 and 64 bit images (on Mac OS X)

>---------------------------------------------------------------

 rts/Linker.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/rts/Linker.c b/rts/Linker.c
index b97a30c..39b7897 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -5523,14 +5523,18 @@ ocVerifyImage_MachO(ObjectCode * oc)
 
 #if x86_64_HOST_ARCH || powerpc64_HOST_ARCH
     if(header->magic != MH_MAGIC_64) {
-        errorBelch("%s: Bad magic. Expected: %08x, got: %08x.\n",
-                   oc->fileName, MH_MAGIC_64, header->magic);
+        errorBelch("Could not load image %s: bad magic!\n"
+                   "  Expected %08x (64bit), got %08x%s\n",
+                   oc->fileName, MH_MAGIC_64, header->magic,
+                   header->magic == MH_MAGIC ? " (32bit)." : ".");
         return 0;
     }
 #else
     if(header->magic != MH_MAGIC) {
-        errorBelch("%s: Bad magic. Expected: %08x, got: %08x.\n",
-                   oc->fileName, MH_MAGIC, header->magic);
+        errorBelch("Could not load image %s: bad magic!\n"
+                   "  Expected %08x (32bit), got %08x%s\n",
+                   oc->fileName, MH_MAGIC, header->magic,
+                   header->magic == MH_MAGIC_64 ? " (64bit)." : ".");
         return 0;
     }
 #endif





More information about the ghc-commits mailing list