summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rts/Linker.c2
-rw-r--r--rts/linker/MachO.c4
2 files changed, 5 insertions, 1 deletions
diff --git a/rts/Linker.c b/rts/Linker.c
index 7366904831..b214e9c01f 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -1215,6 +1215,8 @@ mkOc( pathchar *path, char *image, int imageSize,
IF_DEBUG(linker, debugBelch("mkOc: start\n"));
oc = stgMallocBytes(sizeof(ObjectCode), "mkOc(oc)");
+ oc->info = NULL;
+
# if defined(OBJFORMAT_ELF)
oc->formatName = "ELF";
# elif defined(OBJFORMAT_PEi386)
diff --git a/rts/linker/MachO.c b/rts/linker/MachO.c
index 16b712a804..e09d151c14 100644
--- a/rts/linker/MachO.c
+++ b/rts/linker/MachO.c
@@ -130,7 +130,9 @@ ocInit_MachO(ObjectCode * oc)
oc->info->nlist = oc->info->symCmd == NULL
? NULL
: (MachONList *)(oc->image + oc->info->symCmd->symoff);
- oc->info->names = oc->image + oc->info->symCmd->stroff;
+ oc->info->names = oc->info->symCmd == NULL
+ ? NULL
+ : (oc->image + oc->info->symCmd->stroff);
/* If we have symbols, allocate and fill the macho_symbols
* This will make relocation easier.