summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2010-07-23 20:08:22 +0000
committerIan Lynagh <igloo@earth.li>2010-07-23 20:08:22 +0000
commitae8cc32e169e8d958f257714c1ae727e1a56a5e0 (patch)
tree5509a033506eac5258302df4f59a59eca1e1474b
parent8f0f835d8fdfe5d69e91289fd0a591dc7ec91cee (diff)
downloadhaskell-ae8cc32e169e8d958f257714c1ae727e1a56a5e0.tar.gz
Add some error belchs to the linker, when we find bad magic numbers
-rw-r--r--rts/Linker.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/rts/Linker.c b/rts/Linker.c
index 7a321dcc65..beaf19e4a5 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -4039,11 +4039,17 @@ static int ocVerifyImage_MachO(ObjectCode* oc)
struct mach_header *header = (struct mach_header*) image;
#if x86_64_HOST_ARCH || powerpc64_HOST_ARCH
- if(header->magic != MH_MAGIC_64)
+ if(header->magic != MH_MAGIC_64) {
+ errorBelch("%s: Bad magic. Expected: %08x, got: %08x.\n",
+ oc->fileName, MH_MAGIC_64, header->magic);
return 0;
+ }
#else
- if(header->magic != MH_MAGIC)
+ if(header->magic != MH_MAGIC) {
+ errorBelch("%s: Bad magic. Expected: %08x, got: %08x.\n",
+ oc->fileName, MH_MAGIC, header->magic);
return 0;
+ }
#endif
// FIXME: do some more verifying here
return 1;
@@ -4830,11 +4836,17 @@ static int machoGetMisalignment( FILE * f )
rewind(f);
#if x86_64_HOST_ARCH || powerpc64_HOST_ARCH
- if(header.magic != MH_MAGIC_64)
+ if(header.magic != MH_MAGIC_64) {
+ errorBelch("Bad magic. Expected: %08x, got: %08x.\n",
+ MH_MAGIC_64, header->magic);
return 0;
+ }
#else
- if(header.magic != MH_MAGIC)
+ if(header.magic != MH_MAGIC) {
+ errorBelch("Bad magic. Expected: %08x, got: %08x.\n",
+ MH_MAGIC, header->magic);
return 0;
+ }
#endif
misalignment = (header.sizeofcmds + sizeof(header))