summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@well-typed.com>2022-07-12 20:14:37 -0400
committerBen Gamari <ben@smart-cactus.org>2022-07-14 19:49:10 -0400
commit5a69a9ff9119df5947c37852825f8a865cfab96b (patch)
treeaf90ebae3b067821167b3187bb18d5f3a43b62a6
parent7c5a8ca69b754382861e0e957693b11d98fb005b (diff)
downloadhaskell-5a69a9ff9119df5947c37852825f8a865cfab96b.tar.gz
rts/linker/PEi386: Fix exception unwind unregistration
RtlDeleteFunctionTable expects a pointer to the .pdata section yet we passed it the .xdata section. Happily, this fixes #21354. (cherry picked from commit 8ad577ddad66f2a7a9bb334b6ee7f0837e0c19be)
-rw-r--r--rts/linker/PEi386.c17
-rw-r--r--testsuite/tests/rts/linker/all.T1
-rw-r--r--testsuite/tests/rts/linker/unload_multiple_objs/all.T1
3 files changed, 9 insertions, 10 deletions
diff --git a/rts/linker/PEi386.c b/rts/linker/PEi386.c
index 697768aa82..86c8cfdb03 100644
--- a/rts/linker/PEi386.c
+++ b/rts/linker/PEi386.c
@@ -532,8 +532,8 @@ void freePreloadObjectFile_PEi386(ObjectCode *oc)
if (oc->info) {
/* Release the unwinder information.
See Note [Exception Unwinding]. */
- if (oc->info->xdata) {
- if (!RtlDeleteFunctionTable (oc->info->xdata->start))
+ if (oc->info->pdata) {
+ if (!RtlDeleteFunctionTable (oc->info->pdata->start))
debugBelch ("Unable to remove Exception handlers for %" PATH_FMT "\n",
oc->fileName);
oc->info->xdata = NULL;
@@ -2105,15 +2105,16 @@ ocResolve_PEi386 ( ObjectCode* oc )
Note [Exception Unwinding]
~~~~~~~~~~~~~~~~~~~~~~~~~~
- Exception Unwinding on Windows is handle using two named sections.
+ Exception Unwinding on Windows is handled using two named sections.
.pdata: Exception registration tables.
- The .pdata section contains an array of function table entries that are used
- for exception handling. The entries must be sorted according to the
- function addresses (the first field in each structure) before being emitted
- into the final image. It is pointed to by the exception table entry in the
- image data directory. For x64 each entry contains:
+ The .pdata section contains an array of function table entries (of type
+ RUNTIME_FUNCTION) that are used for exception handling. The entries must be
+ sorted according to the function addresses (the first field in each
+ structure) before being emitted into the final image. It is pointed to by
+ the exception table entry in the image data directory. For x64 each entry
+ contains:
Offset Size Field Description
0 4 Begin Address The RVA of the corresponding function.
diff --git a/testsuite/tests/rts/linker/all.T b/testsuite/tests/rts/linker/all.T
index 12c02fdea9..4387bc2337 100644
--- a/testsuite/tests/rts/linker/all.T
+++ b/testsuite/tests/rts/linker/all.T
@@ -82,7 +82,6 @@ test('T5435_dyn_gcc', extra_files(['T5435.hs', 'T5435_gcc.c']) , makefile_test,
######################################
test('linker_unload',
[extra_files(['LinkerUnload.hs', 'Test.hs']),
- when(opsys('mingw32'), expect_broken(21354)),
req_rts_linker],
makefile_test, ['linker_unload'])
diff --git a/testsuite/tests/rts/linker/unload_multiple_objs/all.T b/testsuite/tests/rts/linker/unload_multiple_objs/all.T
index 85548af491..52f35b4e26 100644
--- a/testsuite/tests/rts/linker/unload_multiple_objs/all.T
+++ b/testsuite/tests/rts/linker/unload_multiple_objs/all.T
@@ -1,5 +1,4 @@
test('linker_unload_multiple_objs',
[extra_files(['../LinkerUnload.hs', 'A.hs', 'B.hs', 'C.hs', 'D.hs',]),
- when(opsys('mingw32'), expect_broken(21354)),
req_rts_linker],
run_command, ['$MAKE -s --no-print-directory linker_unload_multiple_objs'])