summaryrefslogtreecommitdiff
path: root/rts/linker
diff options
context:
space:
mode:
authorArtem Pyanykh <artempyanykh@gmail.com>2019-03-16 18:32:00 +0300
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-03-20 19:52:39 -0400
commit3fb10fcfc03d5590579743494450fc8b06b179ad (patch)
treec1b45b355afd34253204fa2a015e323ba9349042 /rts/linker
parentd950f11eff0a5dc0ad950fbd47e3ee32649d1d62 (diff)
downloadhaskell-3fb10fcfc03d5590579743494450fc8b06b179ad.tar.gz
Gracefully handle error condition in Mach-O relocateSection
Diffstat (limited to 'rts/linker')
-rw-r--r--rts/linker/MachO.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/rts/linker/MachO.c b/rts/linker/MachO.c
index 6e109e592d..21e46a30d2 100644
--- a/rts/linker/MachO.c
+++ b/rts/linker/MachO.c
@@ -814,7 +814,11 @@ relocateSection(ObjectCode* oc, int curSection)
// symbol address (symbol->n_value)
if ((symbol->nlist->n_type & N_TYPE) == N_SECT) {
- ASSERT(symbol->addr != NULL);
+ if (symbol->addr == NULL) {
+ errorBelch("relocateSection: address of internal symbol %s was not resolved\n", nm);
+ return 0;
+ }
+
addr = symbol->addr;
IF_DEBUG(linker, debugBelch("relocateSection: calculated relocation of "
@@ -823,6 +827,7 @@ relocateSection(ObjectCode* oc, int curSection)
} else {
errorBelch("\nrelocateSection: %s is not exported,"
" and should be defined in a section, but isn't!\n", nm);
+ return 0;
}
}