diff options
author | Tamar Christina <tamar@zhox.com> | 2022-05-21 19:45:37 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-06-20 17:35:23 -0400 |
commit | 159b76282e50a138250557baa6aa4ed7cf031070 (patch) | |
tree | b1351e5a6bf669560b62018c817b63e9c09cef4b /rts | |
parent | d24afd9d7139d7a62f3b465af1be50b25c15e5b5 (diff) | |
download | haskell-159b76282e50a138250557baa6aa4ed7cf031070.tar.gz |
linker: only keep rtl exception tables if they have been relocated
Diffstat (limited to 'rts')
-rw-r--r-- | rts/linker/PEi386.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/rts/linker/PEi386.c b/rts/linker/PEi386.c index f6e87dd0e6..7549c67c57 100644 --- a/rts/linker/PEi386.c +++ b/rts/linker/PEi386.c @@ -1487,13 +1487,11 @@ ocGetNames_PEi386 ( ObjectCode* oc ) /* Exception Unwind information. See Note [Exception Unwinding]. */ if (0 == strncmp(".xdata" , section->info->name, 6 )) { kind = SECTIONKIND_EXCEPTION_UNWIND; - oc->info->xdata = &oc->sections[i]; } /* Exception handler tables, See Note [Exception Unwinding]. */ if (0 == strncmp(".pdata" , section->info->name, 6 )) { kind = SECTIONKIND_EXCEPTION_TABLE; - oc->info->pdata = &oc->sections[i]; } if (0==strncmp(".idata", section->info->name, 6)) { @@ -1556,10 +1554,10 @@ ocGetNames_PEi386 ( ObjectCode* oc ) // Allocate memory for the section. uint8_t *start; - if (kind == SECTIONKIND_CODE_OR_RODATA) { - start = m32_alloc(oc->rx_m32, sz, alignment); - } else { + if (section->info->props & IMAGE_SCN_MEM_WRITE) { start = m32_alloc(oc->rw_m32, sz, alignment); + } else { + start = m32_alloc(oc->rx_m32, sz, alignment); } if (!start) { barf("Could not allocate any heap memory from private heap (requested %" FMT_SizeT " bytes).", @@ -1994,6 +1992,7 @@ ocResolve_PEi386 ( ObjectCode* oc ) /* Register the exceptions inside this OC. See Note [Exception Unwinding]. */ if (section.kind == SECTIONKIND_EXCEPTION_TABLE) { + oc->info->pdata = &oc->sections[i]; #if defined(x86_64_HOST_ARCH) unsigned numEntries = section.size / sizeof(RUNTIME_FUNCTION); if (numEntries == 0) @@ -2010,6 +2009,8 @@ ocResolve_PEi386 ( ObjectCode* oc ) return false; } #endif /* x86_64_HOST_ARCH. */ + } else if (section.kind == SECTIONKIND_EXCEPTION_UNWIND) { + oc->info->xdata = &oc->sections[i]; } } |