From 1dac06d95f52858796c5ac4e58ea9aaf131e1e38 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 4 Nov 2009 23:15:07 +0000 Subject: [PATCH] Hey Arch, next time you change 3rdparty code, either make sure, it's merged upstream or provide a diff, please. Adding back MSVC fixes. svn path=/branches/ros-amd64-bringup/; revision=43964 --- reactos/include/reactos/mingw-w64/internal.h | 10 +++ reactos/include/reactos/mingw-w64/oscalls.h | 9 ++ .../include/reactos/mingw-w64/reactos.diff | 83 ++++++++++++++++++ .../include/reactos/mingw-w64/sect_attribs.h | 10 ++- reactos/lib/3rdparty/mingw/CRT_fp10.c | 12 ++- reactos/lib/3rdparty/mingw/CRT_fp8.c | 4 + reactos/lib/3rdparty/mingw/crtexe.c | 5 ++ reactos/lib/3rdparty/mingw/gs_support.c | 10 +++ reactos/lib/3rdparty/mingw/reactos.diff | 87 +++++++++++++++++++ 9 files changed, 228 insertions(+), 2 deletions(-) create mode 100644 reactos/include/reactos/mingw-w64/reactos.diff create mode 100644 reactos/lib/3rdparty/mingw/reactos.diff diff --git a/reactos/include/reactos/mingw-w64/internal.h b/reactos/include/reactos/mingw-w64/internal.h index 13376e28ed9..235e13cbe64 100644 --- a/reactos/include/reactos/mingw-w64/internal.h +++ b/reactos/include/reactos/mingw-w64/internal.h @@ -32,6 +32,12 @@ extern "C" { #define __IOINFO_TM_UTF8 1 #define __IOINFO_TM_UTF16LE 2 +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:4214) +#pragma warning(disable:4820) +#endif + typedef struct { intptr_t osfhnd; char osfile; @@ -43,6 +49,10 @@ extern "C" { char pipech2[2]; } ioinfo; +#ifdef _MSC_VER +#pragma warning(pop) +#endif + #define IOINFO_ARRAY_ELTS (1 << 5) #define _pioinfo(i) (__pioinfo[(i) >> 5] + ((i) & (IOINFO_ARRAY_ELTS - 1))) diff --git a/reactos/include/reactos/mingw-w64/oscalls.h b/reactos/include/reactos/mingw-w64/oscalls.h index cdcb23e51db..132686d15c4 100644 --- a/reactos/include/reactos/mingw-w64/oscalls.h +++ b/reactos/include/reactos/mingw-w64/oscalls.h @@ -30,6 +30,11 @@ #endif #endif +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:4214) +#endif + typedef struct _FTIME { unsigned short twosecs : 5; @@ -46,6 +51,10 @@ typedef struct _FDATE unsigned short year : 7; } FDATE; +#ifdef _MSC_VER +#pragma warning(pop) +#endif + typedef FDATE *PFDATE; #endif diff --git a/reactos/include/reactos/mingw-w64/reactos.diff b/reactos/include/reactos/mingw-w64/reactos.diff new file mode 100644 index 00000000000..412066108cf --- /dev/null +++ b/reactos/include/reactos/mingw-w64/reactos.diff @@ -0,0 +1,83 @@ +Index: internal.h +=================================================================== +--- internal.h (Revision 43956) ++++ internal.h (Arbeitskopie) +@@ -32,6 +32,12 @@ + #define __IOINFO_TM_UTF8 1 + #define __IOINFO_TM_UTF16LE 2 + ++#ifdef _MSC_VER ++#pragma warning(push) ++#pragma warning(disable:4214) ++#pragma warning(disable:4820) ++#endif ++ + typedef struct { + intptr_t osfhnd; + char osfile; +@@ -43,6 +49,10 @@ + char pipech2[2]; + } ioinfo; + ++#ifdef _MSC_VER ++#pragma warning(pop) ++#endif ++ + #define IOINFO_ARRAY_ELTS (1 << 5) + + #define _pioinfo(i) (__pioinfo[(i) >> 5] + ((i) & (IOINFO_ARRAY_ELTS - 1))) +Index: oscalls.h +=================================================================== +--- oscalls.h (Revision 43956) ++++ oscalls.h (Arbeitskopie) +@@ -30,6 +30,11 @@ + #endif + #endif + ++#ifdef _MSC_VER ++#pragma warning(push) ++#pragma warning(disable:4214) ++#endif ++ + typedef struct _FTIME + { + unsigned short twosecs : 5; +@@ -46,6 +51,10 @@ + unsigned short year : 7; + } FDATE; + ++#ifdef _MSC_VER ++#pragma warning(pop) ++#endif ++ + typedef FDATE *PFDATE; + + #endif +Index: sect_attribs.h +=================================================================== +--- sect_attribs.h (Revision 43956) ++++ sect_attribs.h (Arbeitskopie) +@@ -10,7 +10,7 @@ + #define _ATTRIBUTES shared + #endif + +-#if 0 ++#if defined(_MSC_VER) + /* Reference list of existing section for msvcrt. */ + #pragma section(".CRTMP$XCA",long,_ATTRIBUTES) + #pragma section(".CRTMP$XCZ",long,_ATTRIBUTES) +@@ -55,6 +55,14 @@ + #pragma section(".rtc$IZZ",long,read) + #pragma section(".rtc$TAA",long,read) + #pragma section(".rtc$TZZ",long,read) ++#pragma section(".tls",long,read,write) ++#pragma section(".tls$ZZZ",long,read,write) + #endif + ++#if defined(_MSC_VER) ++#define _CRTALLOC(x) __declspec(allocate(x)) ++#elif defined(__GNUC__) + #define _CRTALLOC(x) __attribute__ ((section (x) )) ++#else ++#error ++#endif diff --git a/reactos/include/reactos/mingw-w64/sect_attribs.h b/reactos/include/reactos/mingw-w64/sect_attribs.h index 681b0cb3197..da09e9bbad2 100644 --- a/reactos/include/reactos/mingw-w64/sect_attribs.h +++ b/reactos/include/reactos/mingw-w64/sect_attribs.h @@ -10,7 +10,7 @@ #define _ATTRIBUTES shared #endif -#if 0 +#if defined(_MSC_VER) /* Reference list of existing section for msvcrt. */ #pragma section(".CRTMP$XCA",long,_ATTRIBUTES) #pragma section(".CRTMP$XCZ",long,_ATTRIBUTES) @@ -55,6 +55,14 @@ #pragma section(".rtc$IZZ",long,read) #pragma section(".rtc$TAA",long,read) #pragma section(".rtc$TZZ",long,read) +#pragma section(".tls",long,read,write) +#pragma section(".tls$ZZZ",long,read,write) #endif +#if defined(_MSC_VER) +#define _CRTALLOC(x) __declspec(allocate(x)) +#elif defined(__GNUC__) #define _CRTALLOC(x) __attribute__ ((section (x) )) +#else +#error +#endif diff --git a/reactos/lib/3rdparty/mingw/CRT_fp10.c b/reactos/lib/3rdparty/mingw/CRT_fp10.c index 4069ad7c204..34384b09458 100644 --- a/reactos/lib/3rdparty/mingw/CRT_fp10.c +++ b/reactos/lib/3rdparty/mingw/CRT_fp10.c @@ -7,6 +7,16 @@ void _fpreset (void); void _fpreset (void) - { __asm__ ("fninit" ) ;} +{ +#ifdef __GNUC__ + __asm__ ("fninit" ); +#else + __asm fninit; +#endif +} +#ifdef __GNUC__ void __attribute__ ((alias ("_fpreset"))) fpreset(void); +#else +void fpreset(void) { _fpreset(); } +#endif diff --git a/reactos/lib/3rdparty/mingw/CRT_fp8.c b/reactos/lib/3rdparty/mingw/CRT_fp8.c index 13240e5e04a..7e46c15fbe9 100644 --- a/reactos/lib/3rdparty/mingw/CRT_fp8.c +++ b/reactos/lib/3rdparty/mingw/CRT_fp8.c @@ -14,4 +14,8 @@ void _fpreset (void) (* __MINGW_IMP_SYMBOL(_fpreset))(); } +#ifdef __GNUC__ void __attribute__ ((alias ("_fpreset"))) fpreset(void); +#else +void fpreset(void) { _fpreset(); } +#endif diff --git a/reactos/lib/3rdparty/mingw/crtexe.c b/reactos/lib/3rdparty/mingw/crtexe.c index 9fabd0e338f..409b76bbdfa 100644 --- a/reactos/lib/3rdparty/mingw/crtexe.c +++ b/reactos/lib/3rdparty/mingw/crtexe.c @@ -20,6 +20,7 @@ #include #include #include +#include #ifndef __winitenv extern wchar_t *** __MINGW_IMP_SYMBOL(__winitenv); @@ -51,7 +52,11 @@ extern int * __MINGW_IMP_SYMBOL(_commode); #define _commode (* __MINGW_IMP_SYMBOL(_commode)) extern int _dowildcard; +#if defined(__GNUC__) int _MINGW_INSTALL_DEBUG_MATHERR __attribute__((weak)) = 0; +#else +int _MINGW_INSTALL_DEBUG_MATHERR = 0; +#endif extern int __defaultmatherr; extern _CRTIMP void __cdecl _initterm(_PVFV *, _PVFV *); diff --git a/reactos/lib/3rdparty/mingw/gs_support.c b/reactos/lib/3rdparty/mingw/gs_support.c index eafb2216d59..cb9ba11a700 100644 --- a/reactos/lib/3rdparty/mingw/gs_support.c +++ b/reactos/lib/3rdparty/mingw/gs_support.c @@ -112,12 +112,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 } diff --git a/reactos/lib/3rdparty/mingw/reactos.diff b/reactos/lib/3rdparty/mingw/reactos.diff new file mode 100644 index 00000000000..88d81ed1570 --- /dev/null +++ b/reactos/lib/3rdparty/mingw/reactos.diff @@ -0,0 +1,87 @@ +Index: CRT_fp10.c +=================================================================== +--- CRT_fp10.c (Revision 43956) ++++ CRT_fp10.c (Arbeitskopie) +@@ -7,6 +7,16 @@ + void _fpreset (void); + + void _fpreset (void) +- { __asm__ ("fninit" ) ;} ++{ ++#ifdef __GNUC__ ++ __asm__ ("fninit" ); ++#else ++ __asm fninit; ++#endif ++} + ++#ifdef __GNUC__ + void __attribute__ ((alias ("_fpreset"))) fpreset(void); ++#else ++void fpreset(void) { _fpreset(); } ++#endif +Index: CRT_fp8.c +=================================================================== +--- CRT_fp8.c (Revision 43956) ++++ CRT_fp8.c (Arbeitskopie) +@@ -14,4 +14,8 @@ + (* __MINGW_IMP_SYMBOL(_fpreset))(); + } + ++#ifdef __GNUC__ + void __attribute__ ((alias ("_fpreset"))) fpreset(void); ++#else ++void fpreset(void) { _fpreset(); } ++#endif +Index: crtexe.c +=================================================================== +--- crtexe.c (Revision 43956) ++++ crtexe.c (Arbeitskopie) +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + + #ifndef __winitenv + extern wchar_t *** __MINGW_IMP_SYMBOL(__winitenv); +@@ -51,7 +52,11 @@ + #define _commode (* __MINGW_IMP_SYMBOL(_commode)) + extern int _dowildcard; + ++#if defined(__GNUC__) + int _MINGW_INSTALL_DEBUG_MATHERR __attribute__((weak)) = 0; ++#else ++int _MINGW_INSTALL_DEBUG_MATHERR = 0; ++#endif + extern int __defaultmatherr; + extern _CRTIMP void __cdecl _initterm(_PVFV *, _PVFV *); + +Index: gs_support.c +=================================================================== +--- gs_support.c (Revision 43956) ++++ gs_support.c (Arbeitskopie) +@@ -112,6 +112,7 @@ + else + #endif + { ++#ifdef __GNUC__ + #ifdef _WIN64 + GS_ContextRecord.Rip = (ULONGLONG) __builtin_return_address (0); + GS_ContextRecord.Rsp = (ULONGLONG) __builtin_frame_address (0) + 8; +@@ -119,6 +120,15 @@ + 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 + } + + #ifdef _WIN64