Patch for #7628: improve error message when mixing 32 and 64 bit images (on Mac OS X)
authorAndy Adams-Moran <andy.adamsmoran@gmail.com>
Fri, 25 Jan 2013 19:11:01 +0000 (11:11 -0800)
committerIan Lynagh <ian@well-typed.com>
Tue, 29 Jan 2013 16:00:12 +0000 (16:00 +0000)
rts/Linker.c

index b97a30c..39b7897 100644 (file)
@@ -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