diff options
author | Ben Gamari <ben@well-typed.com> | 2022-07-12 20:14:37 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2022-07-14 19:49:10 -0400 |
commit | 5a69a9ff9119df5947c37852825f8a865cfab96b (patch) | |
tree | af90ebae3b067821167b3187bb18d5f3a43b62a6 /rts | |
parent | 7c5a8ca69b754382861e0e957693b11d98fb005b (diff) | |
download | haskell-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)
Diffstat (limited to 'rts')
-rw-r--r-- | rts/linker/PEi386.c | 17 |
1 files changed, 9 insertions, 8 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. |