- mingw: __builtin_return_address -> _ReturnAddress, __builtin_frame_address -> _AddressOfReturnAddress

- ReactOS-generic.rbuild: Define __STDC__ for MSVC to fix some code depending on it (not using /Za as it breaks other code)

svn path=/trunk/; revision=42369
This commit is contained in:
Stefan Ginsberg 2009-08-03 18:02:07 +00:00
parent f32da36427
commit 95cfd1d8da
2 changed files with 11 additions and 0 deletions

View file

@ -95,6 +95,7 @@
<group compilerset="msc"> <group compilerset="msc">
<define name="inline" compiler="cc">__inline</define> <define name="inline" compiler="cc">__inline</define>
<define name="__STDC__" compiler="cc">1</define>
<compilerflag>/Zl</compilerflag> <compilerflag>/Zl</compilerflag>
<compilerflag>/Zi</compilerflag> <compilerflag>/Zi</compilerflag>
<compilerflag>/W1</compilerflag> <compilerflag>/W1</compilerflag>

View file

@ -108,12 +108,22 @@ __report_gsfailure (ULONGLONG StackCookie)
else else
#endif #endif
{ {
#ifdef __GNUC__
#ifdef _WIN64 #ifdef _WIN64
GS_ContextRecord.Rip = (ULONGLONG) __builtin_return_address (0); GS_ContextRecord.Rip = (ULONGLONG) __builtin_return_address (0);
GS_ContextRecord.Rsp = (ULONGLONG) __builtin_frame_address (0) + 8; GS_ContextRecord.Rsp = (ULONGLONG) __builtin_frame_address (0) + 8;
#else #else
GS_ContextRecord.Eip = (DWORD) __builtin_return_address (0); GS_ContextRecord.Eip = (DWORD) __builtin_return_address (0);
GS_ContextRecord.Esp = (DWORD) __builtin_frame_address (0) + 4; GS_ContextRecord.Esp = (DWORD) __builtin_frame_address (0) + 4;
#endif
#else
#ifdef _WIN64
GS_ContextRecord.Rip = (ULONGLONG) _ReturnAddress();
GS_ContextRecord.Rsp = (ULONGLONG) _AddressOfReturnAddress();
#else
GS_ContextRecord.Eip = (DWORD) _ReturnAddress();
GS_ContextRecord.Esp = (DWORD) _AddressOfReturnAddress();
#endif
#endif #endif
} }