From baf7d1b796ebfef26ec56af5e127b2547196f958 Mon Sep 17 00:00:00 2001 From: Stefan Ginsberg Date: Fri, 18 Sep 2009 15:22:28 +0000 Subject: [PATCH] - _mingw.h: Don't define __attribute__ to nothing -- this is only good for creating bugs. - sect_attribs.h: Define _CRTALLOC for msvc. Enable #pragma section and add missing .tls and .tls$ZZZ. - mingw runtime: Only use __attribute__((weak)) for gcc. - freeldr: Use #pragma pack instead of __attribute__((packed)). - kernel32: Only alias __cxa_pure_virtual to _purecall for gcc. svn path=/trunk/; revision=43073 --- reactos/boot/freeldr/freeldr/arch/i386/hwpci.c | 8 ++++++-- reactos/dll/win32/kernel32/misc/icustubs.cpp | 2 ++ reactos/include/crt/_mingw.h | 2 -- reactos/include/reactos/mingw-w64/sect_attribs.h | 10 +++++++++- reactos/lib/3rdparty/mingw/crtexe.c | 4 ++++ 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c b/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c index 6f962cfa0de..cd774b8bb61 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c @@ -23,6 +23,8 @@ #define NDEBUG #include +#include + typedef struct _ROUTING_SLOT { UCHAR BusNumber; @@ -37,7 +39,7 @@ typedef struct _ROUTING_SLOT USHORT BitmapD; UCHAR SlotNumber; UCHAR Reserved; -} __attribute__((packed)) ROUTING_SLOT, *PROUTING_SLOT; +} ROUTING_SLOT, *PROUTING_SLOT; typedef struct _PCI_IRQ_ROUTING_TABLE { @@ -52,7 +54,9 @@ typedef struct _PCI_IRQ_ROUTING_TABLE UCHAR Reserved[11]; UCHAR Checksum; ROUTING_SLOT Slot[1]; -} __attribute__((packed)) PCI_IRQ_ROUTING_TABLE, *PPCI_IRQ_ROUTING_TABLE; +} PCI_IRQ_ROUTING_TABLE, *PPCI_IRQ_ROUTING_TABLE; + +#include typedef struct _PCI_REGISTRY_INFO { diff --git a/reactos/dll/win32/kernel32/misc/icustubs.cpp b/reactos/dll/win32/kernel32/misc/icustubs.cpp index bfdf5dee6e5..edc887005e1 100644 --- a/reactos/dll/win32/kernel32/misc/icustubs.cpp +++ b/reactos/dll/win32/kernel32/misc/icustubs.cpp @@ -65,7 +65,9 @@ int __cdecl _purecall() return 0; } +#if defined(__GNUC__) __attribute__((alias("_purecall"))) void __cxa_pure_virtual(void); +#endif void _assert() { diff --git a/reactos/include/crt/_mingw.h b/reactos/include/crt/_mingw.h index fc9a4910cae..a71b387c3fd 100644 --- a/reactos/include/crt/_mingw.h +++ b/reactos/include/crt/_mingw.h @@ -29,8 +29,6 @@ # if !defined(__MINGW32__) && !defined(__MINGW64__) && !defined(__CYGWIN32__) # define __declspec(x) __attribute__((x)) # endif -#else -# define __attribute__(x) /* nothing */ #endif #ifdef _MSC_VER 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/crtexe.c b/reactos/lib/3rdparty/mingw/crtexe.c index a3e613d7adc..a3421ff25d9 100644 --- a/reactos/lib/3rdparty/mingw/crtexe.c +++ b/reactos/lib/3rdparty/mingw/crtexe.c @@ -52,7 +52,11 @@ extern int *_imp___commode; #define _commode (*_imp___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 *);