summaryrefslogtreecommitdiff
path: root/rts/linker/MachO.c
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-11-23 18:12:15 -0500
committerBen Gamari <ben@smart-cactus.org>2020-11-27 13:22:47 -0500
commit0946529c941194902e7944d54cc3571301d6bf5f (patch)
treeed2683ab90da4d39799b6d70dff023cbe9df9e10 /rts/linker/MachO.c
parent32a4d677e5bc3bb006bf180a5d095101485e0f21 (diff)
downloadhaskell-wip/no-assert.tar.gz
rts/linker: Replace some ASSERTs with CHECKwip/no-assert
In the past some people have confused ASSERT, which is for checking internal invariants, which CHECK, which should be used when checking things that might fail due to bad input (and therefore should be enabled even in the release compiler). Change some of these cases in the linker to use CHECK.
Diffstat (limited to 'rts/linker/MachO.c')
-rw-r--r--rts/linker/MachO.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/rts/linker/MachO.c b/rts/linker/MachO.c
index b513c461db..d3da3ebdcf 100644
--- a/rts/linker/MachO.c
+++ b/rts/linker/MachO.c
@@ -252,7 +252,6 @@ resolveImports(
"%s: unknown symbol `%s'", oc->fileName, symbol->name);
return 0;
}
- ASSERT(addr);
checkProddableBlock(oc,
((void**)(oc->image + sect->offset)) + i,
@@ -847,7 +846,7 @@ relocateSection(ObjectCode* oc, int curSection)
IF_DEBUG(linker, debugBelch(" : value = %p\n", (void *)symbol->nlist->n_value));
if ((symbol->nlist->n_type & N_TYPE) == N_SECT) {
- ASSERT(symbol->addr != NULL);
+ CHECK(symbol->addr != NULL);
value = (uint64_t) symbol->addr;
IF_DEBUG(linker, debugBelch("relocateSection, defined external symbol %s, relocated address %p\n",
nm, (void *)value));
@@ -949,29 +948,29 @@ relocateSection(ObjectCode* oc, int curSection)
{
if((int32_t)(value - baseValue) != (int64_t)(value - baseValue))
{
- ASSERT(reloc->r_extern);
+ CHECK(reloc->r_extern);
value = (uint64_t) &makeSymbolExtra(oc, reloc->r_symbolnum, value)
-> jumpIsland;
}
- ASSERT((int32_t)(value - baseValue) == (int64_t)(value - baseValue));
+ CHECK((int32_t)(value - baseValue) == (int64_t)(value - baseValue));
type = X86_64_RELOC_SIGNED;
}
switch(type)
{
case X86_64_RELOC_UNSIGNED:
- ASSERT(!reloc->r_pcrel);
+ CHECK(!reloc->r_pcrel);
thing += value;
break;
case X86_64_RELOC_SIGNED:
case X86_64_RELOC_SIGNED_1:
case X86_64_RELOC_SIGNED_2:
case X86_64_RELOC_SIGNED_4:
- ASSERT(reloc->r_pcrel);
+ CHECK(reloc->r_pcrel);
thing += value - baseValue;
break;
case X86_64_RELOC_SUBTRACTOR:
- ASSERT(!reloc->r_pcrel);
+ CHECK(!reloc->r_pcrel);
thing -= value;
break;
default: