Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
fix Win64 eh
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Sep 22, 2012
1 parent 627d25c commit 09c70d9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/rt/deh2.d
Expand Up @@ -248,6 +248,17 @@ extern (C) void _d_throwc(Object *h)
continue;
}
auto funcoffset = cast(size_t)func_table.fptr;
version (Win64)
{
/* If linked with /DEBUG, the linker rewrites it so the function pointer points
* to a JMP to the actual code. The address will be in the actual code, so we
* need to follow the JMP.
*/
if ((cast(ubyte*)funcoffset)[0] == 0xE9)
{ // JMP target = RIP of next instruction + signed 32 bit displacement
funcoffset = funcoffset + 5 + *cast(int*)(funcoffset + 1);
}
}
auto spoff = handler_table.espoffset;
auto retoffset = handler_table.retoffset;

Expand Down

0 comments on commit 09c70d9

Please sign in to comment.