diff options
author | Ben Gamari <ben@well-typed.com> | 2022-07-12 20:14:37 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-07-16 23:50:36 -0400 |
commit | 6f3816af374f5c5b70f37e14a23ca8f209c365c2 (patch) | |
tree | 0cacde1dee7ac27ab1c60064e2ae1ae0fc4edf3d | |
parent | 1001952f147e8837d1dea08be4cebec87592fdde (diff) | |
download | haskell-6f3816af374f5c5b70f37e14a23ca8f209c365c2.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.
-rw-r--r-- | rts/linker/PEi386.c | 17 | ||||
-rw-r--r-- | testsuite/tests/rts/linker/all.T | 1 | ||||
-rw-r--r-- | testsuite/tests/rts/linker/unload_multiple_objs/all.T | 1 |
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']) |