- mingw: __builtin_return_address -> _ReturnAddress, __builtin_frame_address -> _Addr...
authorStefan Ginsberg <stefanginsberg@gmail.com>
Mon, 3 Aug 2009 18:02:07 +0000 (18:02 +0000)
committerStefan Ginsberg <stefanginsberg@gmail.com>
Mon, 3 Aug 2009 18:02:07 +0000 (18:02 +0000)
- 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

reactos/ReactOS-generic.rbuild
reactos/lib/3rdparty/mingw/gs_support.c

index fd53570..86d3a2d 100644 (file)
@@ -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>
index f7cdf6a..90bd883 100644 (file)
@@ -108,12 +108,22 @@ __report_gsfailure (ULONGLONG StackCookie)
   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
     }