-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[x86/Linux] Fix WIN64EXCEPTIONS build error #8629
Changes from all commits
c814180
6677089
c2bad85
c8d8738
27cdda4
df7c9db
9a59ac6
9d391d6
8fa9fa5
b5fc9fd
50875b7
0b3d7c0
d4471e4
fcae39e
f733395
cf6be8c
67eb702
c280c94
4935445
8936dff
51990b4
acf7d0a
dc42954
abd974e
b22d9e2
53d121b
e991914
e9bccea
fcbdf54
8768e45
66d86af
3e4c917
2d534a2
0b43f76
92eb6f2
b0061b6
3c5f643
56f69ef
0b6f553
0977740
9bfae60
feb6956
1feba59
024af9b
ec97590
301c261
33fdeab
cf6b3b1
b95967a
285ef04
055abfd
1fd427c
a92ba63
2a7d295
e21fcd1
671923f
8f38336
442d763
1c30ee4
bf6ec0d
6019340
248dc87
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -837,6 +837,13 @@ RtlVirtualUnwind_Unsafe( | |
|
||
#ifdef _TARGET_X86_ | ||
#ifndef FEATURE_PAL | ||
// | ||
// x86 ABI does not define RUNTIME_FUNCTION. Define our own to allow unification between x86 and other platforms. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @parjong I am not sure I understand how could the Windows build get broken. Things that you change for the WIN64EXCEPTIONS should be done in a way that doesn't influence windows x86 stuff. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, I am trying not to affect windows x86 stuff via submitting small commits frequently (I have no mean to check windows build issue). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It turns out that windows build uses PORTABILITY_ASSERT that raises compile error (instead of runtime error). |
||
// | ||
typedef struct _RUNTIME_FUNCTION { | ||
DWORD BeginAddress; | ||
DWORD UnwindData; | ||
} RUNTIME_FUNCTION, *PRUNTIME_FUNCTION; | ||
|
||
typedef struct _DISPATCHER_CONTEXT { | ||
_EXCEPTION_REGISTRATION_RECORD* RegistrationPointer; | ||
|
@@ -845,6 +852,43 @@ typedef struct _DISPATCHER_CONTEXT { | |
#endif // !FEATURE_PAL | ||
|
||
#define RUNTIME_FUNCTION__BeginAddress(prf) (prf)->BeginAddress | ||
#define RUNTIME_FUNCTION__SetBeginAddress(prf,addr) ((prf)->BeginAddress = (addr)) | ||
|
||
#ifdef WIN64EXCEPTIONS | ||
EXTERN_C ULONG | ||
RtlpGetFunctionEndAddress ( | ||
__in PT_RUNTIME_FUNCTION FunctionEntry, | ||
__in ULONG ImageBase | ||
); | ||
|
||
#define RUNTIME_FUNCTION__EndAddress(prf, ImageBase) RtlpGetFunctionEndAddress(prf, ImageBase) | ||
|
||
#define RUNTIME_FUNCTION__GetUnwindInfoAddress(prf) (prf)->UnwindData | ||
#define RUNTIME_FUNCTION__SetUnwindInfoAddress(prf, addr) do { (prf)->UnwindData = (addr); } while(0) | ||
|
||
#define UNW_FLAG_NHANDLER 0x0 /* any handler */ | ||
#define UNW_FLAG_EHANDLER 0x1 /* filter handler */ | ||
#define UNW_FLAG_UHANDLER 0x2 /* unwind handler */ | ||
|
||
typedef struct _UNWIND_INFO { | ||
// dummy | ||
} UNWIND_INFO, *PUNWIND_INFO; | ||
|
||
EXTERN_C | ||
NTSYSAPI | ||
PEXCEPTION_ROUTINE | ||
NTAPI | ||
RtlVirtualUnwind ( | ||
__in DWORD HandlerType, | ||
__in DWORD ImageBase, | ||
__in DWORD ControlPc, | ||
__in PRUNTIME_FUNCTION FunctionEntry, | ||
__inout PT_CONTEXT ContextRecord, | ||
__out PVOID *HandlerData, | ||
__out PDWORD EstablisherFrame, | ||
__inout_opt PT_KNONVOLATILE_CONTEXT_POINTERS ContextPointers | ||
); | ||
#endif // WIN64EXCEPTIONS | ||
|
||
#endif // _TARGET_X86_ | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,7 +135,8 @@ | |
JITHELPER(CORINFO_HELP_FIELD_ACCESS_EXCEPTION,JIT_ThrowFieldAccessException, CORINFO_HELP_SIG_REG_ONLY) | ||
JITHELPER(CORINFO_HELP_CLASS_ACCESS_EXCEPTION,JIT_ThrowClassAccessException, CORINFO_HELP_SIG_REG_ONLY) | ||
|
||
#ifdef WIN64EXCEPTIONS | ||
// UNIXTODO: Disable JIT_EndCatch after revising the jitter not to use this (for x86/Linux) | ||
#ifndef _TARGET_X86_ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this change needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @janvorli It is a simple workaround. As JIT is not revised yet, JIT attempts to use JIT_EndCatch even when WIN64EXCEPTIONS is enabled while running simple 'Hello, World' example. This causes assert failure. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, thanks for the explanation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please add UNIXTODO here to revert this change once the JIT is revised? |
||
JITHELPER(CORINFO_HELP_ENDCATCH, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB) | ||
#else | ||
JITHELPER(CORINFO_HELP_ENDCATCH, JIT_EndCatch, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change also the same condition at src\debug\di\rsthread.cpp:5852
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@janvorli Revised.