We have _ReturnAddress() and _AddressOfReturnAddress defined in intrin_x86.h
sginsberg(a)svn.reactos.org wrote:
Author: sginsberg
Date: Mon Aug 3 20:02:07 2009
New Revision: 42369
URL:
http://svn.reactos.org/svn/reactos?rev=42369&view=rev
Log:
- 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)
Modified:
trunk/reactos/ReactOS-generic.rbuild
trunk/reactos/lib/3rdparty/mingw/gs_support.c
Modified: trunk/reactos/ReactOS-generic.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ReactOS-generic.rbuild?rev…
==============================================================================
--- trunk/reactos/ReactOS-generic.rbuild [iso-8859-1] (original)
+++ trunk/reactos/ReactOS-generic.rbuild [iso-8859-1] Mon Aug 3 20:02:07 2009
@@ -95,6 +95,7 @@
<group compilerset="msc">
<define name="inline" compiler="cc">__inline</define>
+ <define name="__STDC__" compiler="cc">1</define>
<compilerflag>/Zl</compilerflag>
<compilerflag>/Zi</compilerflag>
<compilerflag>/W1</compilerflag>
Modified: trunk/reactos/lib/3rdparty/mingw/gs_support.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/gs_supp…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/gs_support.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/gs_support.c [iso-8859-1] Mon Aug 3 20:02:07 2009
@@ -108,12 +108,22 @@
else
#endif
{
+#ifdef __GNUC__
#ifdef _WIN64
GS_ContextRecord.Rip = (ULONGLONG) __builtin_return_address (0);
GS_ContextRecord.Rsp = (ULONGLONG) __builtin_frame_address (0) + 8;
#else
GS_ContextRecord.Eip = (DWORD) __builtin_return_address (0);
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
}