Author: cfinck
Date: Sat Mar 14 03:50:23 2009
New Revision: 40006
URL:
http://svn.reactos.org/svn/reactos?rev=40006&view=rev
Log:
- Sync the common mingw stuff with mingw-w64 HEAD
Only few modifications were necessary to get it to work flawlessy with our tree:
-> getopt.c, which should rather be a part of "mingwex" (if we need the
two Unix apps using it at all..)
-> Adding an 'extern int __globallocalestatus;' to the
"internal.h"
-> Disabling the custom __mingw_get_crt_info, which depends on defines inside the
mingw-w64 tree
-> Small warning fixes, which will be submitted to mingw-w64
- Add an include directory "include/reactos/mingw-w64" for their header stuff to
make synchronizations easier.
- Remove remainders of our previous initialization routines, which still co-existed beside
the new ones
- Remove misleading and unnecessary files (i.e. "binmode.c")
Added:
trunk/reactos/include/reactos/mingw-w64/ (with props)
trunk/reactos/include/reactos/mingw-w64/internal.h (with props)
trunk/reactos/include/reactos/mingw-w64/oscalls.h (with props)
trunk/reactos/include/reactos/mingw-w64/sect_attribs.h (with props)
Removed:
trunk/reactos/lib/3rdparty/mingw/_wgetopt.c
trunk/reactos/lib/3rdparty/mingw/binmode.c
trunk/reactos/lib/3rdparty/mingw/internal.h
trunk/reactos/lib/3rdparty/mingw/isascii.c
trunk/reactos/lib/3rdparty/mingw/iscsym.c
trunk/reactos/lib/3rdparty/mingw/iscsymf.c
trunk/reactos/lib/3rdparty/mingw/oscalls.h
trunk/reactos/lib/3rdparty/mingw/tgetopt.h
trunk/reactos/lib/3rdparty/mingw/toascii.c
trunk/reactos/lib/3rdparty/mingw/wcrt1.c
Modified:
trunk/reactos/lib/3rdparty/mingw/CRT_fp10.c
trunk/reactos/lib/3rdparty/mingw/CRT_fp8.c
trunk/reactos/lib/3rdparty/mingw/_newmode.c
trunk/reactos/lib/3rdparty/mingw/atonexit.c
trunk/reactos/lib/3rdparty/mingw/charmax.c
trunk/reactos/lib/3rdparty/mingw/cinitexe.c
trunk/reactos/lib/3rdparty/mingw/crt0_c.c
trunk/reactos/lib/3rdparty/mingw/crt0_w.c
trunk/reactos/lib/3rdparty/mingw/crtdll.c
trunk/reactos/lib/3rdparty/mingw/crtexe.c
trunk/reactos/lib/3rdparty/mingw/dllargv.c
trunk/reactos/lib/3rdparty/mingw/dllentry.c
trunk/reactos/lib/3rdparty/mingw/dllmain.c
trunk/reactos/lib/3rdparty/mingw/gccmain.c
trunk/reactos/lib/3rdparty/mingw/getopt.c (contents, props changed)
trunk/reactos/lib/3rdparty/mingw/gs_support.c
trunk/reactos/lib/3rdparty/mingw/merr.c
trunk/reactos/lib/3rdparty/mingw/mingw.rbuild
trunk/reactos/lib/3rdparty/mingw/mingw_helpers.c
trunk/reactos/lib/3rdparty/mingw/moldname-msvcrt.def
trunk/reactos/lib/3rdparty/mingw/natstart.c
trunk/reactos/lib/3rdparty/mingw/pesect.c
trunk/reactos/lib/3rdparty/mingw/pseudo-reloc-list.c
trunk/reactos/lib/3rdparty/mingw/pseudo-reloc.c
trunk/reactos/lib/3rdparty/mingw/tlssup.c
trunk/reactos/lib/3rdparty/mingw/wildcard.c
trunk/reactos/lib/3rdparty/mingw/xncommod.c
trunk/reactos/lib/3rdparty/mingw/xthdloc.c
trunk/reactos/lib/3rdparty/mingw/xtxtmode.c
Propchange: trunk/reactos/include/reactos/mingw-w64/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Sat Mar 14 03:50:23 2009
@@ -1,0 +1,2 @@
+([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))?
+(\d+)
Propchange: trunk/reactos/include/reactos/mingw-w64/
------------------------------------------------------------------------------
bugtraq:message = See issue #%BUGID% for more details.
Propchange: trunk/reactos/include/reactos/mingw-w64/
------------------------------------------------------------------------------
bugtraq:url =
http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: trunk/reactos/include/reactos/mingw-w64/
------------------------------------------------------------------------------
tsvn:logminsize = 10
Added: trunk/reactos/include/reactos/mingw-w64/internal.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/mingw-w64/…
==============================================================================
--- trunk/reactos/include/reactos/mingw-w64/internal.h (added)
+++ trunk/reactos/include/reactos/mingw-w64/internal.h [iso-8859-1] Sat Mar 14 03:50:23
2009
@@ -1,0 +1,176 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ */
+
+#ifndef _INC_INTERNAL
+#define _INC_INTERNAL
+
+#include <crtdefs.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <limits.h>
+#include <windows.h>
+
+#pragma pack(push,_CRT_PACKING)
+
+ typedef void (__cdecl *_PVFV)(void);
+ typedef int (__cdecl *_PIFV)(void);
+ typedef void (__cdecl *_PVFI)(int);
+
+#if defined (SPECIAL_CRTEXE) && defined (_DLL)
+ extern int _commode;
+#else
+ _CRTIMP extern int _commode;
+#endif
+
+#define __IOINFO_TM_ANSI 0
+#define __IOINFO_TM_UTF8 1
+#define __IOINFO_TM_UTF16LE 2
+
+ typedef struct {
+ intptr_t osfhnd;
+ char osfile;
+ char pipech;
+ int lockinitflag;
+ CRITICAL_SECTION lock;
+ char textmode : 7;
+ char unicode : 1;
+ char pipech2[2];
+ } ioinfo;
+
+#define IOINFO_ARRAY_ELTS (1 << 5)
+
+#define _pioinfo(i) (__pioinfo[(i) >> 5] + ((i) & (IOINFO_ARRAY_ELTS - 1)))
+#define _osfile(i) (_pioinfo(i)->osfile)
+#define _pipech2(i) (_pioinfo(i)->pipech2)
+#define _textmode(i) (_pioinfo(i)->textmode)
+#define _tm_unicode(i) (_pioinfo(i)->unicode)
+#define _pioinfo_safe(i) ((((i) != -1) && ((i) != -2)) ? _pioinfo(i) :
&__badioinfo)
+#define _osfhnd_safe(i) (_pioinfo_safe(i)->osfhnd)
+#define _osfile_safe(i) (_pioinfo_safe(i)->osfile)
+#define _pipech_safe(i) (_pioinfo_safe(i)->pipech)
+#define _pipech2_safe(i) (_pioinfo_safe(i)->pipech2)
+#define _textmode_safe(i) (_pioinfo_safe(i)->textmode)
+#define _tm_unicode_safe(i) (_pioinfo_safe(i)->unicode)
+
+#ifndef __badioinfo
+ extern ioinfo ** _imp____badioinfo[];
+#define __badioinfo (*_imp____badioinfo)
+#endif
+
+#ifndef __pioinfo
+ extern ioinfo ** _imp____pioinfo[];
+#define __pioinfo (*_imp____pioinfo)
+#endif
+
+#define _NO_CONSOLE_FILENO (intptr_t)-2
+
+#ifndef _FILE_DEFINED
+#define _FILE_DEFINED
+ struct _iobuf {
+ char *_ptr;
+ int _cnt;
+ char *_base;
+ int _flag;
+ int _file;
+ int _charbuf;
+ int _bufsiz;
+ char *_tmpfname;
+ };
+ typedef struct _iobuf FILE;
+#endif
+
+#if !defined (_FILEX_DEFINED) && defined (_WINDOWS_)
+#define _FILEX_DEFINED
+ typedef struct {
+ FILE f;
+ CRITICAL_SECTION lock;
+ } _FILEX;
+#endif
+
+ extern int _dowildcard;
+ extern int _newmode;
+
+#ifndef __winitenv
+extern wchar_t ***_imp____winitenv;
+#define __winitenv (*_imp____winitenv)
+#endif
+
+#ifndef __initenv
+extern char ***_imp____initenv;
+#define __initenv (*_imp____initenv)
+#endif
+
+#ifndef _acmdln
+extern char **_imp___acmdln;
+#define _acmdln (*_imp___acmdln)
+/* _CRTIMP extern char *_acmdln; */
+#endif
+
+#ifndef _wcmdln
+extern char **_imp___wcmdln;
+#define _wcmdln (*_imp___wcmdln)
+/* __CRTIMP extern wchar_t *_wcmdln; */
+#endif
+
+ _CRTIMP void __cdecl _amsg_exit(int);
+
+ int __CRTDECL _setargv(void);
+ int __CRTDECL __setargv(void);
+ int __CRTDECL _wsetargv(void);
+ int __CRTDECL __wsetargv(void);
+
+ int __CRTDECL main(int _Argc, char **_Argv, char **_Env);
+ int __CRTDECL wmain(int _Argc, wchar_t **_Argv, wchar_t **_Env);
+
+#ifndef _STARTUP_INFO_DEFINED
+#define _STARTUP_INFO_DEFINED
+ typedef struct {
+ int newmode;
+ } _startupinfo;
+#endif
+
+ _CRTIMP int __cdecl __getmainargs(int * _Argc, char *** _Argv, char ***_Env, int
_DoWildCard, _startupinfo *_StartInfo);
+ _CRTIMP int __cdecl __wgetmainargs(int * _Argc, wchar_t ***_Argv, wchar_t ***_Env, int
_DoWildCard, _startupinfo *_StartInfo);
+
+#define _CONSOLE_APP 1
+#define _GUI_APP 2
+
+ typedef enum __enative_startup_state {
+ __uninitialized, __initializing, __initialized
+ } __enative_startup_state;
+
+ extern volatile __enative_startup_state __native_startup_state;
+ extern volatile void *__native_startup_lock;
+
+ extern volatile unsigned int __native_dllmain_reason;
+ extern volatile unsigned int __native_vcclrit_reason;
+
+ _CRTIMP void __cdecl __set_app_type (int);
+
+ typedef LONG NTSTATUS;
+
+#include <crtdbg.h>
+#include <errno.h>
+
+ void * __cdecl _encode_pointer(void *);
+ void * __cdecl _encoded_null();
+ void * __cdecl _decode_pointer(void *);
+
+ BOOL __cdecl _ValidateImageBase (PBYTE pImageBase);
+ PIMAGE_SECTION_HEADER __cdecl _FindPESection (PBYTE pImageBase, DWORD_PTR rva);
+ BOOL __cdecl _IsNonwritableInCurrentImage (PBYTE pTarget);
+
+ extern int __globallocalestatus;
+
+#ifdef __cplusplus
+}
+#endif
+
+#pragma pack(pop)
+#endif
Propchange: trunk/reactos/include/reactos/mingw-w64/internal.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/include/reactos/mingw-w64/oscalls.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/mingw-w64/…
==============================================================================
--- trunk/reactos/include/reactos/mingw-w64/oscalls.h (added)
+++ trunk/reactos/include/reactos/mingw-w64/oscalls.h [iso-8859-1] Sat Mar 14 03:50:23
2009
@@ -1,0 +1,51 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ */
+
+#ifndef _INC_OSCALLS
+#define _INC_OSCALLS
+
+#ifndef _CRTBLD
+#error ERROR: Use of C runtime library internal header file.
+#endif
+
+#include <crtdefs.h>
+
+#ifdef NULL
+#undef NULL
+#endif
+
+#define NOMINMAX
+
+#define _WIN32_FUSION 0x0100
+#include <windows.h>
+
+#ifndef NULL
+#ifdef __cplusplus
+#define NULL 0
+#else
+#define NULL ((void *)0)
+#endif
+#endif
+
+typedef struct _FTIME
+{
+ unsigned short twosecs : 5;
+ unsigned short minutes : 6;
+ unsigned short hours : 5;
+} FTIME;
+
+typedef FTIME *PFTIME;
+
+typedef struct _FDATE
+{
+ unsigned short day : 5;
+ unsigned short month : 4;
+ unsigned short year : 7;
+} FDATE;
+
+typedef FDATE *PFDATE;
+
+#endif
Propchange: trunk/reactos/include/reactos/mingw-w64/oscalls.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/include/reactos/mingw-w64/sect_attribs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/mingw-w64/…
==============================================================================
--- trunk/reactos/include/reactos/mingw-w64/sect_attribs.h (added)
+++ trunk/reactos/include/reactos/mingw-w64/sect_attribs.h [iso-8859-1] Sat Mar 14
03:50:23 2009
@@ -1,0 +1,60 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ */
+
+#if defined (__ia64__) || defined (__x86_64)
+#define _ATTRIBUTES
+#else
+#define _ATTRIBUTES shared
+#endif
+
+#if 0
+/* Reference list of existing section for msvcrt. */
+#pragma section(".CRTMP$XCA",long,_ATTRIBUTES)
+#pragma section(".CRTMP$XCZ",long,_ATTRIBUTES)
+#pragma section(".CRTMP$XIA",long,_ATTRIBUTES)
+#pragma section(".CRTMP$XIZ",long,_ATTRIBUTES)
+
+#pragma section(".CRTMA$XCA",long,_ATTRIBUTES)
+#pragma section(".CRTMA$XCZ",long,_ATTRIBUTES)
+#pragma section(".CRTMA$XIA",long,_ATTRIBUTES)
+#pragma section(".CRTMA$XIZ",long,_ATTRIBUTES)
+
+#pragma section(".CRTVT$XCA",long,_ATTRIBUTES)
+#pragma section(".CRTVT$XCZ",long,_ATTRIBUTES)
+
+#pragma section(".CRT$XCA",long,_ATTRIBUTES)
+#pragma section(".CRT$XCAA",long,_ATTRIBUTES)
+#pragma section(".CRT$XCC",long,_ATTRIBUTES)
+#pragma section(".CRT$XCZ",long,_ATTRIBUTES)
+#pragma section(".CRT$XDA",long,_ATTRIBUTES)
+#pragma section(".CRT$XDC",long,_ATTRIBUTES)
+#pragma section(".CRT$XDZ",long,_ATTRIBUTES)
+#pragma section(".CRT$XIA",long,_ATTRIBUTES)
+#pragma section(".CRT$XIAA",long,_ATTRIBUTES)
+#pragma section(".CRT$XIC",long,_ATTRIBUTES)
+#pragma section(".CRT$XID",long,_ATTRIBUTES)
+#pragma section(".CRT$XIY",long,_ATTRIBUTES)
+#pragma section(".CRT$XIZ",long,_ATTRIBUTES)
+#pragma section(".CRT$XLA",long,_ATTRIBUTES)
+#pragma section(".CRT$XLC",long,_ATTRIBUTES)
+#pragma section(".CRT$XLD",long,_ATTRIBUTES)
+#pragma section(".CRT$XLZ",long,_ATTRIBUTES)
+#pragma section(".CRT$XPA",long,_ATTRIBUTES)
+#pragma section(".CRT$XPX",long,_ATTRIBUTES)
+#pragma section(".CRT$XPXA",long,_ATTRIBUTES)
+#pragma section(".CRT$XPZ",long,_ATTRIBUTES)
+#pragma section(".CRT$XTA",long,_ATTRIBUTES)
+#pragma section(".CRT$XTB",long,_ATTRIBUTES)
+#pragma section(".CRT$XTX",long,_ATTRIBUTES)
+#pragma section(".CRT$XTZ",long,_ATTRIBUTES)
+#pragma section(".rdata$T",long,read)
+#pragma section(".rtc$IAA",long,read)
+#pragma section(".rtc$IZZ",long,read)
+#pragma section(".rtc$TAA",long,read)
+#pragma section(".rtc$TZZ",long,read)
+#endif
+
+#define _CRTALLOC(x) __attribute__ ((section (x) ))
Propchange: trunk/reactos/include/reactos/mingw-w64/sect_attribs.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/lib/3rdparty/mingw/CRT_fp10.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/CRT_fp1…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/CRT_fp10.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/CRT_fp10.c [iso-8859-1] Sat Mar 14 03:50:23 2009
@@ -1,3 +1,9 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ */
+
void _fpreset (void)
{ __asm__ ("fninit" ) ;}
Modified: trunk/reactos/lib/3rdparty/mingw/CRT_fp8.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/CRT_fp8…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/CRT_fp8.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/CRT_fp8.c [iso-8859-1] Sat Mar 14 03:50:23 2009
@@ -1,3 +1,9 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ */
+
extern void (*_imp___fpreset)(void) ;
void _fpreset (void)
{ (*_imp___fpreset)(); }
Modified: trunk/reactos/lib/3rdparty/mingw/_newmode.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/_newmod…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/_newmode.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/_newmode.c [iso-8859-1] Sat Mar 14 03:50:23 2009
@@ -1,1 +1,7 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ */
+
int _newmode = 0;
Removed: trunk/reactos/lib/3rdparty/mingw/_wgetopt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/_wgetop…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/_wgetopt.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/_wgetopt.c (removed)
@@ -1,15 +1,0 @@
-/* $Id$
-*/
-/*
- tgetopt -- POSIX-compliant implementation of getopt() with string-type-generic
- semantics
-
- This is public domain software
-*/
-
-#include <wchar.h>
-
-#define _UNICODE
-#include "getopt.c"
-
-/* EOF */
Modified: trunk/reactos/lib/3rdparty/mingw/atonexit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/atonexi…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/atonexit.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/atonexit.c [iso-8859-1] Sat Mar 14 03:50:23 2009
@@ -1,11 +1,18 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ */
+
#undef CRTDLL
#ifndef _DLL
#define _DLL
#endif
-#include "oscalls.h"
-#include "internal.h"
+#include <oscalls.h>
+#include <internal.h>
#include <stdlib.h>
+#include <crtdefs.h>
#include <limits.h>
#include <windows.h>
Removed: trunk/reactos/lib/3rdparty/mingw/binmode.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/binmode…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/binmode.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/binmode.c (removed)
@@ -1,4 +1,0 @@
-#define SPECIAL_CRTEXE
-
-#include <fcntl.h>
-#include <stdlib.h>
Modified: trunk/reactos/lib/3rdparty/mingw/charmax.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/charmax…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/charmax.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/charmax.c [iso-8859-1] Sat Mar 14 03:50:23 2009
@@ -1,9 +1,21 @@
-#include "internal.h"
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ */
-int __lconv_init (void);
+#include <sect_attribs.h>
+#include <internal.h>
+
+__declspec(dllimport) int __lconv_init (void);
int mingw_initcharmax = 0;
int _charmax = 255;
-_CRTALLOC(".CRT$XIC") _PIFV __mingw_pinit = __lconv_init;
+static int my_lconv_init(void)
+{
+ return __lconv_init();
+}
+
+_CRTALLOC(".CRT$XIC") _PIFV __mingw_pinit = my_lconv_init;
Modified: trunk/reactos/lib/3rdparty/mingw/cinitexe.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/cinitex…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/cinitexe.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/cinitexe.c [iso-8859-1] Sat Mar 14 03:50:23 2009
@@ -1,5 +1,6 @@
#include <stdio.h>
-#include "internal.h"
+#include <internal.h>
+#include <sect_attribs.h>
_CRTALLOC(".CRT$XIA") _PVFV __xi_a[] = { NULL };
_CRTALLOC(".CRT$XIZ") _PVFV __xi_z[] = { NULL };
Modified: trunk/reactos/lib/3rdparty/mingw/crt0_c.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/crt0_c.…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/crt0_c.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/crt0_c.c [iso-8859-1] Sat Mar 14 03:50:23 2009
@@ -1,3 +1,9 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ */
+
#include <windows.h>
int main (int flags, char **cmdline, char **inst)
Modified: trunk/reactos/lib/3rdparty/mingw/crt0_w.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/crt0_w.…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/crt0_w.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/crt0_w.c [iso-8859-1] Sat Mar 14 03:50:23 2009
@@ -1,13 +1,20 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ */
+
#include <windows.h>
+
+extern void __main(void);
int WINAPI wWinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPWSTR lpCmdLine,int
nShowCmd);
-void __main(void);
int wmain (int flags, wchar_t **cmdline, wchar_t **inst)
{
#ifdef __GNUC__
- /* C++ initialization. (gcc inserts this call automatically for
- * a function called "main", but not for "wmain") */
+ /* C++ initialization.
+ gcc inserts this call automatically for a function called main , but not for wmain.
*/
__main();
#endif
return (int) wWinMain ((HINSTANCE) inst, NULL, (LPWSTR) cmdline,(DWORD) flags);
Modified: trunk/reactos/lib/3rdparty/mingw/crtdll.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/crtdll.…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/crtdll.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/crtdll.c [iso-8859-1] Sat Mar 14 03:50:23 2009
@@ -1,3 +1,9 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ */
+
#ifdef CRTDLL
#undef CRTDLL
#define _DLL
Modified: trunk/reactos/lib/3rdparty/mingw/crtexe.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/crtexe.…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/crtexe.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/crtexe.c [iso-8859-1] Sat Mar 14 03:50:23 2009
@@ -1,15 +1,22 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ */
+
#undef CRTDLL
//#define _DLL
#define SPECIAL_CRTEXE
-#include "oscalls.h"
-#include "internal.h"
+#include <oscalls.h>
+#include <internal.h>
#include <process.h>
#include <signal.h>
#include <math.h>
#include <stdlib.h>
#include <tchar.h>
+#include <sect_attribs.h>
#include <locale.h>
#ifndef __winitenv
@@ -42,6 +49,7 @@
#define _commode (*_imp___commode)
extern int _dowildcard;
+int _MINGW_INSTALL_DEBUG_MATHERR __attribute__((weak)) = 0;
extern int __defaultmatherr;
extern _CRTIMP void __cdecl _initterm(_PVFV *, _PVFV *);
@@ -76,7 +84,7 @@
extern void _pei386_runtime_relocator (void);
static CALLBACK long _gnu_exception_handler (EXCEPTION_POINTERS * exception_data);
-//static LONG __mingw_vex(EXCEPTION_POINTERS * exception_data);
+static LONG __mingw_vex(EXCEPTION_POINTERS * exception_data);
#ifdef WPRFLAG
static void duplicate_ppstrings (int ac, wchar_t ***av);
#else
@@ -107,9 +115,14 @@
#else
_setargv();
#endif
-
- if (! __defaultmatherr)
- __setusermatherr (_matherr);
+ if (_MINGW_INSTALL_DEBUG_MATHERR)
+ {
+ if (! __defaultmatherr)
+ {
+ __setusermatherr (_matherr);
+ __defaultmatherr = 1;
+ }
+ }
if (__globallocalestatus == -1)
{
@@ -202,23 +215,23 @@
if (__dyn_tls_init_callback != NULL && _IsNonwritableInCurrentImage ((PBYTE)
&__dyn_tls_init_callback))
__dyn_tls_init_callback (NULL, DLL_THREAD_ATTACH, NULL);
-#if defined(__i386__) || defined(__x86_64__)
_pei386_runtime_relocator ();
-#endif
- #if defined(__x86_64__)
+ #ifdef _WIN64
__asm__ __volatile__ (
"xorq %rax,%rax\n\t"
"decq %rax\n\t"
"movq %rax,%gs:0" "\n");
- #elif defined(__i386__)
+ #else
__asm__ __volatile__ (
"xorl %eax,%eax\n\t"
"decl %eax\n\t"
"movl %eax,%fs:0" "\n");
#endif
- //AddVectoredExceptionHandler (0, (PVECTORED_EXCEPTION_HANDLER)__mingw_vex);
+ AddVectoredExceptionHandler (0, (PVECTORED_EXCEPTION_HANDLER)__mingw_vex);
SetUnhandledExceptionFilter (_gnu_exception_handler);
+
+ _fpreset ();
if (mingw_app_type)
{
@@ -229,10 +242,10 @@
#else
lpszCommandLine = (char *) _acmdln;
#endif
- while (*lpszCommandLine > SPACECHAR || (*lpszCommandLine &&
inDoubleQuote))
+ while (*lpszCommandLine > SPACECHAR || (*lpszCommandLine&&inDoubleQuote))
{
if (*lpszCommandLine == DQUOTECHAR)
- inDoubleQuote = TRUE;
+ inDoubleQuote = !inDoubleQuote;
#ifdef _MBCS
if (_ismbblead (*lpszCommandLine))
{
@@ -289,10 +302,9 @@
PIMAGE_OPTIONAL_HEADER64 pNTHeader64;
/* Force to be linked. */
- //TLS sections
- //mingw_initltsdrot_force=1;
- //mingw_initltsdyn_force=1;
- //mingw_initltssuo_force=1;
+ mingw_initltsdrot_force=1;
+ mingw_initltsdyn_force=1;
+ mingw_initltssuo_force=1;
mingw_initcharmax=1;
pDOSHeader = (PIMAGE_DOS_HEADER) &__ImageBase;
@@ -319,8 +331,6 @@
return 0;
}
-int __defaultmatherr;
-
static CALLBACK long
_gnu_exception_handler (EXCEPTION_POINTERS * exception_data)
{
@@ -400,7 +410,6 @@
return action;
}
-#if 0
static LONG __mingw_vex(EXCEPTION_POINTERS * exception_data)
{
/* TODO this is not chainablem, therefore need rewrite. Disabled the ill code. */
@@ -425,7 +434,6 @@
#endif
return _gnu_exception_handler(exception_data);
}
-#endif
#ifdef WPRFLAG
Modified: trunk/reactos/lib/3rdparty/mingw/dllargv.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/dllargv…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/dllargv.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/dllargv.c [iso-8859-1] Sat Mar 14 03:50:23 2009
@@ -1,10 +1,14 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ */
+
#ifdef CRTDLL
#undef CRTDLL
#endif
-#include "internal.h"
-
-extern int _dowildcard;
+#include <internal.h>
#ifdef WPRFLAG
int __CRTDECL
@@ -16,15 +20,3 @@
{
return 0;
}
-
-#ifdef WPRFLAG
-int __CRTDECL
-__wsetargv (void)
-#else
-int __CRTDECL
-__setargv (void)
-#endif
-{
- _dowildcard = 1;
- return 0;
-}
Modified: trunk/reactos/lib/3rdparty/mingw/dllentry.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/dllentr…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/dllentry.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/dllentry.c [iso-8859-1] Sat Mar 14 03:50:23 2009
@@ -1,5 +1,11 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ */
+
+#include <oscalls.h>
#define _DECL_DLLMAIN
-#include <windows.h>
#include <process.h>
BOOL WINAPI DllEntryPoint(HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved)
Modified: trunk/reactos/lib/3rdparty/mingw/dllmain.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/dllmain…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/dllmain.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/dllmain.c [iso-8859-1] Sat Mar 14 03:50:23 2009
@@ -1,6 +1,5 @@
+#include <oscalls.h>
#define _DECL_DLLMAIN
-#define _WINDOWS_
-#include <windows.h>
#include <process.h>
BOOL WINAPI DllMain(HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved)
Modified: trunk/reactos/lib/3rdparty/mingw/gccmain.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/gccmain…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/gccmain.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/gccmain.c [iso-8859-1] Sat Mar 14 03:50:23 2009
@@ -1,15 +1,9 @@
-/*
- * gccmain.c
+/**
* This file has no copyright assigned and is placed in the Public Domain.
- * This file is a part of the mingw-runtime package.
- * No warranty is given; refer to the file DISCLAIMER within the package.
- *
- * A separate version of __main, __do_global_ctors and __do_global_dtors for
- * Mingw32 for use with Cygwin32 b19. Hopefully this object file will only
- * be linked if the libgcc.a doesn't include __main, __do_global_dtors and
- * __do_global_ctors.
- *
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
*/
+
#include <windows.h>
#include <stdlib.h>
#include <setjmp.h>
Modified: trunk/reactos/lib/3rdparty/mingw/getopt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/getopt.…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/getopt.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/getopt.c [iso-8859-1] Sat Mar 14 03:50:23 2009
@@ -1,137 +1,394 @@
-/* $Id$
-*/
-/*
- tgetopt -- POSIX-compliant implementation of getopt() with string-type-generic
- semantics
-
- This is public domain software
-*/
-
-#include <tchar.h>
+#include <assert.h>
+#include <errno.h>
+#include <stdlib.h>
#include <string.h>
+#include <getopt.h>
+#include <stdarg.h>
#include <stdio.h>
-#include "tgetopt.h"
-
-int _topterr = 1;
-int _toptind = 1;
-int _toptopt;
-_TCHAR * _toptarg;
-
-int _tgetopt(int argc, _TCHAR * const argv[], const _TCHAR * optstring)
-{
- static int s_nArgChar = 0;
- _TCHAR * pcOptChar;
-
- /* we're done */
- if(_toptind >= argc) return -1;
-
- /* last time we reached the end of argv[_toptind] */
- if(s_nArgChar != 0 && argv[_toptind][s_nArgChar] == 0)
- {
- /* scan the next argument */
- ++ _toptind;
-
- /* we're done */
- if(_toptind >= argc) return -1;
-
- s_nArgChar = 0;
- }
-
- /* first time we scan argv[_toptind] */
- if(s_nArgChar == 0)
- {
- /* argument is NULL - we're done */
- if(argv[_toptind] == NULL)
- return (int)-1;
- /* argument is empty - we're done */
- else if(argv[_toptind][0] == 0)
- return (int)-1;
- /* argument begins with '-' */
- else if(argv[_toptind][0] == _T('-'))
- {
- /* argument is "--" */
- if(argv[_toptind][1] == _T('-'))
- {
- /* increment optind */
- ++ _toptind;
- s_nArgChar = 0;
-
- /* we're done */
- return (int)-1;
- }
- /* argument is "-" */
- else if(argv[_toptind][1] == 0)
- {
- /* we're done */
- return (int)-1;
- }
- /* possible option */
- else
- ++ s_nArgChar;
- }
- /* argument doesn't begin with a dash - we're done */
- else
- return (int)-1;
- }
-
- /* return the current character */
- _toptopt = argv[_toptind][s_nArgChar];
-
- /* advance to the next character */
- ++ s_nArgChar;
-
- /* unrecognized option */
- if(_toptopt == _T(':') || (pcOptChar = _tcschr(optstring, _toptopt)) == NULL)
- {
- /* print an error message */
- if(_topterr && optstring[0] != _T(':'))
- _ftprintf(stderr, _T("%s: illegal option -- %c\n"), argv[0], _toptopt);
-
- /* return an error */
- return _T('?');
- }
-
- /* the option requires an argument */
- if(pcOptChar[1] == _T(':'))
- {
- /* we are at the end of the argument */
- if(argv[_toptind][s_nArgChar] == 0)
- {
- /* the argument of the option is the next argument */
- ++ _toptind;
- s_nArgChar = 0;
-
- /* this is the last argument */
- if(_toptind >= argc)
- {
- /* print an error message */
- if(_topterr && optstring[0] != _T(':'))
- {
- _ftprintf
- (
- stderr,
- _T("%s: option requires an argument -- %c\n"),
- argv[0],
- _toptopt
- );
- }
-
- /* return an error */
- return ((optstring[0] == _T(':')) ? _T(':') : _T('?'));
- }
-
- /* return the argument */
- _toptarg = argv[_toptind];
- ++ _toptind;
- }
- /* the rest of the argument is the argument of the option */
- else
- _toptarg = argv[_toptind] + s_nArgChar;
- }
-
- /* success */
- return _toptopt;
-}
-
-/* EOF */
+#define REPLACE_GETOPT
+
+#define _DIAGASSERT(x) do {} while (0)
+
+#ifdef REPLACE_GETOPT
+#ifdef __weak_alias
+__weak_alias(getopt,_getopt)
+#endif
+int opterr = 1;
+int optind = 1;
+int optopt = '?';
+int optreset;
+char *optarg;
+#endif
+
+#ifdef __weak_alias
+__weak_alias(getopt_long,_getopt_long)
+#endif
+
+#ifndef __CYGWIN__
+#define __progname __argv[0]
+#else
+extern char __declspec(dllimport) *__progname;
+#endif
+
+#define IGNORE_FIRST (*options == '-' || *options == '+')
+#define PRINT_ERROR ((opterr) && ((*options != ':') || (IGNORE_FIRST
&& options[1] != ':')))
+
+#ifndef IS_POSIXLY_CORRECT
+#define IS_POSIXLY_CORRECT (getenv("POSIXLY_CORRECT") != NULL)
+#endif
+
+#define PERMUTE (!IS_POSIXLY_CORRECT && !IGNORE_FIRST)
+
+#define IN_ORDER (!IS_POSIXLY_CORRECT && *options == '-')
+
+#define BADCH (int)'?'
+#define BADARG ((IGNORE_FIRST && options[1] == ':') || (*options ==
':') ? (int)':' : (int)'?')
+#define INORDER (int)1
+
+static char EMSG[1];
+
+static int getopt_internal (int,char * const *,const char *);
+static int gcd (int,int);
+static void permute_args (int,int,int,char * const *);
+
+static char *place = EMSG;
+
+static int nonopt_start = -1;
+static int nonopt_end = -1;
+
+static const char recargchar[] = "option requires an argument -- %c";
+static const char recargstring[] = "option requires an argument -- %s";
+static const char ambig[] = "ambiguous option -- %.*s";
+static const char noarg[] = "option doesn't take an argument -- %.*s";
+static const char illoptchar[] = "unknown option -- %c";
+static const char illoptstring[] = "unknown option -- %s";
+
+static void
+_vwarnx(const char *fmt,va_list ap)
+{
+ (void)fprintf(stderr,"%s: ",__progname);
+ if (fmt != NULL)
+ (void)vfprintf(stderr,fmt,ap);
+ (void)fprintf(stderr,"\n");
+}
+
+static void
+warnx(const char *fmt,...)
+{
+ va_list ap;
+ va_start(ap,fmt);
+ _vwarnx(fmt,ap);
+ va_end(ap);
+}
+
+static int
+gcd(a,b)
+ int a;
+ int b;
+{
+ int c;
+
+ c = a % b;
+ while (c != 0) {
+ a = b;
+ b = c;
+ c = a % b;
+ }
+
+ return b;
+}
+
+static void
+permute_args(panonopt_start,panonopt_end,opt_end,nargv)
+ int panonopt_start;
+ int panonopt_end;
+ int opt_end;
+ char * const *nargv;
+{
+ int cstart,cyclelen,i,j,ncycle,nnonopts,nopts,pos;
+ char *swap;
+
+ _DIAGASSERT(nargv != NULL);
+
+ nnonopts = panonopt_end - panonopt_start;
+ nopts = opt_end - panonopt_end;
+ ncycle = gcd(nnonopts,nopts);
+ cyclelen = (opt_end - panonopt_start) / ncycle;
+
+ for (i = 0; i < ncycle; i++) {
+ cstart = panonopt_end+i;
+ pos = cstart;
+ for (j = 0; j < cyclelen; j++) {
+ if (pos >= panonopt_end)
+ pos -= nnonopts;
+ else
+ pos += nopts;
+ swap = nargv[pos];
+
+ ((char **) nargv)[pos] = nargv[cstart];
+
+ ((char **)nargv)[cstart] = swap;
+ }
+ }
+}
+
+static int
+getopt_internal(nargc,nargv,options)
+ int nargc;
+ char * const *nargv;
+ const char *options;
+{
+ char *oli;
+ int optchar;
+
+ _DIAGASSERT(nargv != NULL);
+ _DIAGASSERT(options != NULL);
+
+ optarg = NULL;
+
+ if (optind == 0)
+ optind = 1;
+
+ if (optreset)
+ nonopt_start = nonopt_end = -1;
+start:
+ if (optreset || !*place) {
+ optreset = 0;
+ if (optind >= nargc) {
+ place = EMSG;
+ if (nonopt_end != -1) {
+
+ permute_args(nonopt_start,nonopt_end,optind,nargv);
+ optind -= nonopt_end - nonopt_start;
+ }
+ else if (nonopt_start != -1) {
+
+ optind = nonopt_start;
+ }
+ nonopt_start = nonopt_end = -1;
+ return -1;
+ }
+ if ((*(place = nargv[optind]) != '-')
+ || (place[1] == '\0')) {
+ place = EMSG;
+ if (IN_ORDER) {
+
+ optarg = nargv[optind++];
+ return INORDER;
+ }
+ if (!PERMUTE) {
+
+ return -1;
+ }
+
+ if (nonopt_start == -1)
+ nonopt_start = optind;
+ else if (nonopt_end != -1) {
+ permute_args(nonopt_start,nonopt_end,optind,nargv);
+ nonopt_start = optind -
+ (nonopt_end - nonopt_start);
+ nonopt_end = -1;
+ }
+ optind++;
+
+ goto start;
+ }
+ if (nonopt_start != -1 && nonopt_end == -1)
+ nonopt_end = optind;
+ if (place[1] && *++place == '-') {
+ place++;
+ return -2;
+ }
+ }
+ if ((optchar = (int)*place++) == (int)':' ||
+ (oli = strchr(options + (IGNORE_FIRST ? 1 : 0),optchar)) == NULL) {
+
+ if (!*place)
+ ++optind;
+ if (PRINT_ERROR)
+ warnx(illoptchar,optchar);
+ optopt = optchar;
+ return BADCH;
+ }
+ if (optchar == 'W' && oli[1] == ';') {
+
+ if (*place)
+ return -2;
+
+ if (++optind >= nargc) {
+ place = EMSG;
+ if (PRINT_ERROR)
+ warnx(recargchar,optchar);
+ optopt = optchar;
+ return BADARG;
+ } else
+ place = nargv[optind];
+
+ return -2;
+ }
+ if (*++oli != ':') {
+ if (!*place)
+ ++optind;
+ } else {
+ optarg = NULL;
+ if (*place)
+ optarg = place;
+
+ else if (oli[1] != ':') {
+ if (++optind >= nargc) {
+ place = EMSG;
+ if (PRINT_ERROR)
+ warnx(recargchar,optchar);
+ optopt = optchar;
+ return BADARG;
+ } else
+ optarg = nargv[optind];
+ }
+ place = EMSG;
+ ++optind;
+ }
+
+ return optchar;
+}
+
+#ifdef REPLACE_GETOPT
+
+int
+getopt(nargc,nargv,options)
+ int nargc;
+ char * const *nargv;
+ const char *options;
+{
+ int retval;
+
+ _DIAGASSERT(nargv != NULL);
+ _DIAGASSERT(options != NULL);
+
+ if ((retval = getopt_internal(nargc,nargv,options)) == -2) {
+ ++optind;
+
+ if (nonopt_end != -1) {
+ permute_args(nonopt_start,nonopt_end,optind,nargv);
+ optind -= nonopt_end - nonopt_start;
+ }
+ nonopt_start = nonopt_end = -1;
+ retval = -1;
+ }
+ return retval;
+}
+#endif
+
+int
+getopt_long(nargc,nargv,options,long_options,idx)
+ int nargc;
+ char * const *nargv;
+ const char *options;
+ const struct option *long_options;
+ int *idx;
+{
+ int retval;
+
+ _DIAGASSERT(nargv != NULL);
+ _DIAGASSERT(options != NULL);
+ _DIAGASSERT(long_options != NULL);
+
+ if ((retval = getopt_internal(nargc,nargv,options)) == -2) {
+ char *current_argv,*has_equal;
+ size_t current_argv_len;
+ int i,match;
+
+ current_argv = place;
+ match = -1;
+
+ optind++;
+ place = EMSG;
+
+ if (*current_argv == '\0') {
+
+ if (nonopt_end != -1) {
+ permute_args(nonopt_start,nonopt_end,optind,nargv);
+ optind -= nonopt_end - nonopt_start;
+ }
+ nonopt_start = nonopt_end = -1;
+ return -1;
+ }
+ if ((has_equal = strchr(current_argv,'=')) != NULL) {
+
+ current_argv_len = has_equal - current_argv;
+ has_equal++;
+ } else
+ current_argv_len = strlen(current_argv);
+
+ for (i = 0; long_options[i].name; i++) {
+
+ if (strncmp(current_argv,long_options[i].name,current_argv_len))
+ continue;
+
+ if (strlen(long_options[i].name) ==
+ (unsigned)current_argv_len) {
+
+ match = i;
+ break;
+ }
+ if (match == -1)
+ match = i;
+ else {
+
+ if (PRINT_ERROR)
+ warnx(ambig,(int)current_argv_len,current_argv);
+ optopt = 0;
+ return BADCH;
+ }
+ }
+ if (match != -1) {
+ if (long_options[match].has_arg == no_argument
+ && has_equal) {
+ if (PRINT_ERROR)
+ warnx(noarg,(int)current_argv_len,current_argv);
+
+ if (long_options[match].flag == NULL)
+ optopt = long_options[match].val;
+ else
+ optopt = 0;
+ return BADARG;
+ }
+ if (long_options[match].has_arg == required_argument ||
+ long_options[match].has_arg == optional_argument) {
+ if (has_equal)
+ optarg = has_equal;
+ else if (long_options[match].has_arg ==
+ required_argument) {
+
+ optarg = nargv[optind++];
+ }
+ }
+ if ((long_options[match].has_arg == required_argument)
+ && (optarg == NULL)) {
+
+ if (PRINT_ERROR)
+ warnx(recargstring,current_argv);
+
+ if (long_options[match].flag == NULL)
+ optopt = long_options[match].val;
+ else
+ optopt = 0;
+ --optind;
+ return BADARG;
+ }
+ } else {
+ if (PRINT_ERROR)
+ warnx(illoptstring,current_argv);
+ optopt = 0;
+ return BADCH;
+ }
+ if (long_options[match].flag) {
+ *long_options[match].flag = long_options[match].val;
+ retval = 0;
+ } else
+ retval = long_options[match].val;
+ if (idx)
+ *idx = match;
+ }
+ return retval;
+}
Propchange: trunk/reactos/lib/3rdparty/mingw/getopt.c
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords (removed)
@@ -1,1 +1,0 @@
-author date id revision
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] Sat Mar 14 03:50:23 2009
@@ -1,3 +1,9 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ */
+
#include <windows.h>
#ifdef _WIN64
#include <intrin.h>
@@ -13,11 +19,12 @@
#ifdef _WIN64
PRUNTIME_FUNCTION RtlLookupFunctionEntry (ULONG64, PULONG64, PVOID);
PVOID RtlVirtualUnwind (ULONG HandlerType, ULONG64, ULONG64, PRUNTIME_FUNCTION,
- PCONTEXT, PVOID *, PULONG64, PKNONVOLATILE_CONTEXT_POINTERS);
+ PCONTEXT, PVOID *, PULONG64, PVOID);
#endif
typedef LONG NTSTATUS;
+#define UNW_FLAG_NHANDLER 0x00
#define STATUS_STACK_BUFFER_OVERRUN ((NTSTATUS)0xC0000409L)
typedef union
@@ -33,8 +40,8 @@
&GS_ExceptionRecord,&GS_ContextRecord
};
-__declspec(selectany) UINT_PTR __security_cookie = DEFAULT_SECURITY_COOKIE;
-__declspec(selectany) UINT_PTR __security_cookie_complement =
~(DEFAULT_SECURITY_COOKIE);
+DECLSPEC_SELECTANY UINT_PTR __security_cookie = DEFAULT_SECURITY_COOKIE;
+DECLSPEC_SELECTANY UINT_PTR __security_cookie_complement = ~(DEFAULT_SECURITY_COOKIE);
void __cdecl
__security_init_cookie (void)
@@ -89,7 +96,6 @@
PVOID hndData;
#endif
-
#ifdef _WIN64
RtlCaptureContext (&GS_ContextRecord);
controlPC = GS_ContextRecord.Rip;
Removed: trunk/reactos/lib/3rdparty/mingw/internal.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/interna…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/internal.h [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/internal.h (removed)
@@ -1,173 +1,0 @@
-#ifndef _INC_INTERNAL
-#define _INC_INTERNAL
-
-#include <_mingw.h>
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <limits.h>
-#include <windows.h>
-
-#define _CRTALLOC(x) __attribute__ ((section (x) ))
-
-#pragma pack(push,_CRT_PACKING)
-
- typedef void (__cdecl *_PVFV)(void);
- typedef int (__cdecl *_PIFV)(void);
- typedef void (__cdecl *_PVFI)(int);
-
-#if defined (SPECIAL_CRTEXE) && defined (_DLL)
- extern int _commode;
-#else
- _CRTIMP extern int _commode;
-#endif
-
-#define __IOINFO_TM_ANSI 0
-#define __IOINFO_TM_UTF8 1
-#define __IOINFO_TM_UTF16LE 2
-
- typedef struct {
- intptr_t osfhnd;
- char osfile;
- char pipech;
- int lockinitflag;
- CRITICAL_SECTION lock;
- char textmode : 7;
- char unicode : 1;
- char pipech2[2];
- } ioinfo;
-
-#define IOINFO_ARRAY_ELTS (1 << 5)
-
-#define _pioinfo(i) (__pioinfo[(i) >> 5] + ((i) & (IOINFO_ARRAY_ELTS - 1)))
-#define _osfile(i) (_pioinfo(i)->osfile)
-#define _pipech2(i) (_pioinfo(i)->pipech2)
-#define _textmode(i) (_pioinfo(i)->textmode)
-#define _tm_unicode(i) (_pioinfo(i)->unicode)
-#define _pioinfo_safe(i) ((((i) != -1) && ((i) != -2)) ? _pioinfo(i) :
&__badioinfo)
-#define _osfhnd_safe(i) (_pioinfo_safe(i)->osfhnd)
-#define _osfile_safe(i) (_pioinfo_safe(i)->osfile)
-#define _pipech_safe(i) (_pioinfo_safe(i)->pipech)
-#define _pipech2_safe(i) (_pioinfo_safe(i)->pipech2)
-#define _textmode_safe(i) (_pioinfo_safe(i)->textmode)
-#define _tm_unicode_safe(i) (_pioinfo_safe(i)->unicode)
-
-#ifndef __badioinfo
- extern ioinfo ** _imp____badioinfo[];
-#define __badioinfo (*_imp____badioinfo)
-#endif
-
-#ifndef __pioinfo
- extern ioinfo ** _imp____pioinfo[];
-#define __pioinfo (*_imp____pioinfo)
-#endif
-
-#define _NO_CONSOLE_FILENO (intptr_t)-2
-
-#ifndef _FILE_DEFINED
-#define _FILE_DEFINED
- struct _iobuf {
- char *_ptr;
- int _cnt;
- char *_base;
- int _flag;
- int _file;
- int _charbuf;
- int _bufsiz;
- char *_tmpfname;
- };
- typedef struct _iobuf FILE;
-#endif
-
-#if !defined (_FILEX_DEFINED) && defined (_WINDOWS_)
-#define _FILEX_DEFINED
- typedef struct {
- FILE f;
- CRITICAL_SECTION lock;
- } _FILEX;
-#endif
-
- extern int _dowildcard;
- extern int _newmode;
-
-#ifndef __winitenv
-extern wchar_t ***_imp____winitenv;
-#define __winitenv (*_imp____winitenv)
-#endif
-
-#ifndef __initenv
-extern char ***_imp____initenv;
-#define __initenv (*_imp____initenv)
-#endif
-
-#ifndef _acmdln
-extern char **_imp___acmdln;
-#define _acmdln (*_imp___acmdln)
-/* _CRTIMP extern char *_acmdln; */
-#endif
-
-#ifndef _wcmdln
-extern char **_imp___wcmdln;
-#define _wcmdln (*_imp___wcmdln)
-/* __CRTIMP extern wchar_t *_wcmdln; */
-#endif
-
- _CRTIMP void __cdecl _amsg_exit(int);
-
- int __CRTDECL _setargv(void);
- int __CRTDECL __setargv(void);
- int __CRTDECL _wsetargv(void);
- int __CRTDECL __wsetargv(void);
-
- int __CRTDECL main(int _Argc, char **_Argv, char **_Env);
- int __CRTDECL wmain(int _Argc, wchar_t **_Argv, wchar_t **_Env);
-
-#ifndef _STARTUP_INFO_DEFINED
-#define _STARTUP_INFO_DEFINED
- typedef struct {
- int newmode;
- } _startupinfo;
-#endif
-
- _CRTIMP int __cdecl __getmainargs(int * _Argc, char *** _Argv, char ***_Env, int
_DoWildCard, _startupinfo *_StartInfo);
- _CRTIMP int __cdecl __wgetmainargs(int * _Argc, wchar_t ***_Argv, wchar_t ***_Env, int
_DoWildCard, _startupinfo *_StartInfo);
-
-#define _CONSOLE_APP 1
-#define _GUI_APP 2
-
- typedef enum __enative_startup_state {
- __uninitialized, __initializing, __initialized
- } __enative_startup_state;
-
- extern volatile __enative_startup_state __native_startup_state;
- extern volatile void *__native_startup_lock;
-
- extern volatile unsigned int __native_dllmain_reason;
- extern volatile unsigned int __native_vcclrit_reason;
-
- _CRTIMP void __cdecl __set_app_type (int);
-
- typedef LONG NTSTATUS;
-
-#include <crtdbg.h>
-#include <errno.h>
-
- void * __cdecl _encode_pointer(void *);
- void * __cdecl _encoded_null();
- void * __cdecl _decode_pointer(void *);
-
- BOOL __cdecl _ValidateImageBase (PBYTE pImageBase);
- PIMAGE_SECTION_HEADER __cdecl _FindPESection (PBYTE pImageBase, DWORD_PTR rva);
- BOOL __cdecl _IsNonwritableInCurrentImage (PBYTE pTarget);
-
- extern int __globallocalestatus;
-
-#ifdef __cplusplus
-}
-#endif
-
-#pragma pack(pop)
-#endif
Removed: trunk/reactos/lib/3rdparty/mingw/isascii.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/isascii…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/isascii.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/isascii.c (removed)
@@ -1,25 +1,0 @@
-/*
- * isascii.c
- * This file has no copyright assigned and is placed in the Public Domain.
- * This file is a part of the mingw-runtime package.
- * No warranty is given; refer to the file DISCLAIMER within the package.
- *
- * Oldnames from ANSI header ctype.h
- *
- * Some wrapper functions for those old name functions whose appropriate
- * equivalents are not simply underscore prefixed.
- *
- */
-
-#include <ctype.h>
-
-#ifdef isascii
-#undef isascii
-#endif
-
-int
-isascii (int c)
-{
- return __isascii(c);
-}
-
Removed: trunk/reactos/lib/3rdparty/mingw/iscsym.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/iscsym.…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/iscsym.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/iscsym.c (removed)
@@ -1,24 +1,0 @@
-/*
- * iscsym.c
- * This file has no copyright assigned and is placed in the Public Domain.
- * This file is a part of the mingw-runtime package.
- * No warranty is given; refer to the file DISCLAIMER within the package.
- *
- * Oldnames from ANSI header ctype.h
- *
- * Some wrapper functions for those old name functions whose appropriate
- * equivalents are not simply underscore prefixed.
- *
- */
-
-#include <ctype.h>
-
-#ifdef iscsym
-#undef iscsym
-#endif
-
-int
-iscsym (int c)
-{
- return __iscsym(c);
-}
Removed: trunk/reactos/lib/3rdparty/mingw/iscsymf.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/iscsymf…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/iscsymf.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/iscsymf.c (removed)
@@ -1,25 +1,0 @@
-/*
- * iscsymf.c
- * This file has no copyright assigned and is placed in the Public Domain.
- * This file is a part of the mingw-runtime package.
- * No warranty is given; refer to the file DISCLAIMER within the package.
- *
- * Oldnames from ANSI header ctype.h
- *
- * Some wrapper functions for those old name functions whose appropriate
- * equivalents are not simply underscore prefixed.
- *
- */
-
-#include <ctype.h>
-
-#ifdef iscsymf
-#undef iscsymf
-#endif
-
-int
-iscsymf (int c)
-{
- return __iscsymf(c);
-}
-
Modified: trunk/reactos/lib/3rdparty/mingw/merr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/merr.c?…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/merr.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/merr.c [iso-8859-1] Sat Mar 14 03:50:23 2009
@@ -1,12 +1,53 @@
-#include "internal.h"
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ */
+
+#include <internal.h>
#include <math.h>
+#include <stdio.h>
-int __defaultmatherr = 1;
+int __defaultmatherr = 0;
int __CRTDECL
_matherr (struct _exception *pexcept)
{
- /* Make compiler happy. */
- pexcept = pexcept;
+ const char * type;
+
+ switch(pexcept->type)
+ {
+ case _DOMAIN:
+ type = "Argument domain error (DOMAIN)";
+ break;
+
+ case _SING:
+ type = "Argument singularity (SIGN)";
+ break;
+
+ case _OVERFLOW:
+ type = "Overflow range error (OVERFLOW)";
+ break;
+
+ case _PLOSS:
+ type = "Partial loss of significance (PLOSS)";
+ break;
+
+ case _TLOSS:
+ type = "Total loss of significance (TLOSS)";
+ break;
+
+ case _UNDERFLOW:
+ type = "The result is too small to be represented (UNDERFLOW)";
+ break;
+
+ default:
+ type = "Unknown error";
+ break;
+ }
+
+ fprintf(stderr, "_matherr(): %s in %s(%g, %g) (retval=%g)\n",
+ type, pexcept->name, pexcept->arg1, pexcept->arg2, pexcept->retval);
return 0;
}
+
Modified: trunk/reactos/lib/3rdparty/mingw/mingw.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/mingw.r…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/mingw.rbuild [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/mingw.rbuild [iso-8859-1] Sat Mar 14 03:50:23 2009
@@ -2,13 +2,12 @@
<!DOCTYPE group SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="mingw_common" type="staticlibrary"
isstartuplib="true" underscoresymbols="true" crt="dll">
+ <define name="_CRTBLD" />
<importlibrary definition="moldname-msvcrt.def"
dllname="msvcrt.dll" />
- <include base="mingw_common">include</include>
+ <include base="ReactOS">include/reactos/mingw-w64</include>
<library>kernel32</library>
<file>_newmode.c</file>
- <file>_wgetopt.c</file>
<file>atonexit.c</file>
- <file>binmode.c</file>
<file>charmax.c</file>
<file>cinitexe.c</file>
<file>CRT_fp10.c</file>
@@ -30,21 +29,24 @@
<file>xtxtmode.c</file>
</module>
<module name="mingw_main" type="staticlibrary"
isstartuplib="true" crt="dll">
- <include base="mingw_common">include</include>
+ <define name="_CRTBLD" />
+ <include base="ReactOS">include/reactos/mingw-w64</include>
<file>crt0_c.c</file>
<file>crtexe.c</file>
<file>dllargv.c</file>
</module>
<module name="mingw_wmain" type="staticlibrary"
isstartuplib="true" unicode="yes" crt="dll">
- <include base="mingw_common">include</include>
- <define name="WPRFLAG"/>
+ <define name="_CRTBLD" />
+ <define name="WPRFLAG" />
+ <include base="ReactOS">include/reactos/mingw-w64</include>
<file>crt0_w.c</file>
<file>crtexe.c</file>
<file>dllargv.c</file>
</module>
<module name="mingw_dllmain" type="staticlibrary"
isstartuplib="true" crt="dll">
- <include base="mingw_common">include</include>
+ <define name="_CRTBLD" />
+ <include base="ReactOS">include/reactos/mingw-w64</include>
+ <file>crtdll.c</file>
<file>dllargv.c</file>
- <file>crtdll.c</file>
</module>
</group>
Modified: trunk/reactos/lib/3rdparty/mingw/mingw_helpers.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/mingw_h…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/mingw_helpers.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/mingw_helpers.c [iso-8859-1] Sat Mar 14 03:50:23
2009
@@ -1,10 +1,20 @@
-#include "oscalls.h"
-#include "internal.h"
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ */
+
+#include <oscalls.h>
+#include <internal.h>
#include <process.h>
#include <math.h>
#include <stdlib.h>
#include <tchar.h>
+#include <sect_attribs.h>
#include <locale.h>
+#if 0
+#include "../revstamp.h"
+#endif
const PIMAGE_TLS_CALLBACK __dyn_tls_init_callback;
@@ -23,3 +33,11 @@
/* 0:console, 1:windows. */
int mingw_app_type = 0;
+#if 0
+const char *__mingw_get_crt_info (void)
+{
+ return "MinGW-W64 Runtime " __MINGW64_VERSION " ("
+ __MINGW64_VERSION_STATE " - "
+ "rev. " __MINGW_W64_REV ") " __MINGW_W64_REV_STAMP;
+}
+#endif
Modified: trunk/reactos/lib/3rdparty/mingw/moldname-msvcrt.def
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/moldnam…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/moldname-msvcrt.def [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/moldname-msvcrt.def [iso-8859-1] Sat Mar 14 03:50:23
2009
@@ -1,28 +1,3 @@
-;
-; moldname-msvcrt.def
-;
-; Exports from the runtime except that these exports are actually preceeded
-; by a underscore in the actual DLL. These correspond to functions which
-; are non-ANSI and were prefixed with an underscore to avoid name space
-; clutter. However many, in fact most programs still use a few of these
-; functions without the underscore. This .def file is specially processed
-; to make those non-underscored name function calls call the equivalent
-; underscored functions.
-;
-; Contributors:
-; Created by Colin Peters <colin(a)bird.fu.is.saga-u.ac.jp>
-; Maintained by Mumit Khan <khan(a)xraylith.wisc.edu>
-;
-; THIS SOFTWARE IS NOT COPYRIGHTED
-;
-; This source code is offered for use in the public domain. You may
-; use, modify or distribute it freely.
-;
-; This code is distributed in the hope that it will be useful but
-; WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
-; DISCLAMED. This includes but is not limited to warrenties of
-; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-;
EXPORTS
access
chdir
@@ -31,9 +6,7 @@
close
creat
cwait
-
daylight DATA
-
dup
dup2
ecvt
@@ -52,10 +25,10 @@
fgetwchar
filelength
fileno
-; Alias fpreset is set in CRT_fp10,c and CRT_fp8.c.
; fpreset
fputchar
fputwchar
+;fstat
ftime
gcvt
getch
@@ -95,6 +68,7 @@
spawnve
spawnvp
spawnvpe
+;stat
strcmpi
strdup
stricmp
@@ -108,10 +82,7 @@
swab
tell
tempnam
-
timezone DATA
-
-; export tzname for both. See <time.h>
tzname DATA
tzset
umask
@@ -127,9 +98,7 @@
wcsrev
wcsset
wcsupr
-
wpopen
-
write
; non-ANSI functions declared in math.h
j0
@@ -139,7 +108,7 @@
y1
yn
chgsign
-scalb
+;scalb
finite
fpclass
; C99 functions
Modified: trunk/reactos/lib/3rdparty/mingw/natstart.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/natstar…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/natstart.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/natstart.c [iso-8859-1] Sat Mar 14 03:50:23 2009
@@ -1,4 +1,11 @@
-#include "internal.h"
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ */
+
+#include <crtdefs.h>
+#include <internal.h>
_PGLOBAL
volatile unsigned int __native_dllmain_reason = UINT_MAX;
Removed: trunk/reactos/lib/3rdparty/mingw/oscalls.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/oscalls…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/oscalls.h [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/oscalls.h (removed)
@@ -1,41 +1,0 @@
-#ifndef _INC_OSCALLS
-#define _INC_OSCALLS
-
-#include <_mingw.h>
-
-#ifdef NULL
-#undef NULL
-#endif
-
-#define NOMINMAX
-
-#define _WIN32_FUSION 0x0100
-#include <windows.h>
-
-#ifndef NULL
-#ifdef __cplusplus
-#define NULL 0
-#else
-#define NULL ((void *)0)
-#endif
-#endif
-
-typedef struct _FTIME
-{
- unsigned short twosecs : 5;
- unsigned short minutes : 6;
- unsigned short hours : 5;
-} FTIME;
-
-typedef FTIME *PFTIME;
-
-typedef struct _FDATE
-{
- unsigned short day : 5;
- unsigned short month : 4;
- unsigned short year : 7;
-} FDATE;
-
-typedef FDATE *PFDATE;
-
-#endif
Modified: trunk/reactos/lib/3rdparty/mingw/pesect.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/pesect.…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/pesect.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/pesect.c [iso-8859-1] Sat Mar 14 03:50:23 2009
@@ -1,3 +1,9 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ */
+
#include <windows.h>
#if defined (_WIN64) && defined (__ia64__)
Modified: trunk/reactos/lib/3rdparty/mingw/pseudo-reloc-list.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/pseudo-…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/pseudo-reloc-list.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/pseudo-reloc-list.c [iso-8859-1] Sat Mar 14 03:50:23
2009
@@ -1,2 +1,8 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ */
+
char __RUNTIME_PSEUDO_RELOC_LIST_END__ = 0;
char __RUNTIME_PSEUDO_RELOC_LIST__ = 0;
Modified: trunk/reactos/lib/3rdparty/mingw/pseudo-reloc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/pseudo-…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/pseudo-reloc.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/pseudo-reloc.c [iso-8859-1] Sat Mar 14 03:50:23 2009
@@ -1,7 +1,13 @@
-/* Only necesary on x86 and amd64 targets */
-#if defined(__i386__) || defined(__x86_64__)
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ */
+
#include <windows.h>
#include <stdio.h>
+#include <stdlib.h>
+#include <memory.h>
extern char __RUNTIME_PSEUDO_RELOC_LIST__;
extern char __RUNTIME_PSEUDO_RELOC_LIST_END__;
@@ -23,6 +29,24 @@
DWORD magic2;
DWORD version;
} runtime_pseudo_reloc_v2;
+
+static void
+__write_memory (void *addr,const void *src,size_t len)
+{
+ MEMORY_BASIC_INFORMATION b;
+ DWORD oldprot;
+ if (!len)
+ return;
+ if (!VirtualQuery (addr, &b, sizeof(b)))
+ abort ();
+ // Protect
+ if (b.Protect != PAGE_EXECUTE_READWRITE && b.Protect != PAGE_READWRITE)
+ VirtualProtect (b.BaseAddress, b.RegionSize, PAGE_EXECUTE_READWRITE,
+ &oldprot);
+ memcpy (addr, src, len);
+ if (b.Protect != PAGE_EXECUTE_READWRITE && b.Protect != PAGE_READWRITE)
+ VirtualProtect (b.BaseAddress, b.RegionSize, oldprot, &oldprot);
+}
#define RP_VERSION_V1 0
#define RP_VERSION_V2 1
@@ -47,8 +71,10 @@
runtime_pseudo_reloc_item_v1 *o;
for (o = (runtime_pseudo_reloc_item_v1 *) v2_hdr; o <
(runtime_pseudo_reloc_item_v1 *)end; o++)
{
+ DWORD newval;
reloc_target = (ptrdiff_t) base + o->target;
- *((DWORD*) reloc_target) += o->addend;
+ newval = (*((DWORD*) reloc_target)) + o->addend;
+ __write_memory ((void *) reloc_target, &newval, sizeof(DWORD));
}
return;
}
@@ -102,17 +128,17 @@
switch ((r->flags & 0xff))
{
case 8:
- *((unsigned char*)reloc_target)=(unsigned char) reldata;
+ __write_memory ((void *) reloc_target, &reldata, 1);
break;
case 16:
- *((unsigned short*)reloc_target)=(unsigned short) reldata;
+ __write_memory ((void *) reloc_target, &reldata, 2);
break;
case 32:
- *((unsigned int*)reloc_target)=(unsigned int) reldata;
+ __write_memory ((void *) reloc_target, &reldata, 4);
break;
#ifdef _WIN64
case 64:
- *((unsigned long long*)reloc_target)=(unsigned long long) reldata;
+ __write_memory ((void *) reloc_target, &reldata, 8);
break;
#endif
}
@@ -122,6 +148,9 @@
void
_pei386_runtime_relocator ()
{
+ static int was_init = 0;
+ if (was_init)
+ return;
+ ++was_init;
do_pseudo_reloc
(&__RUNTIME_PSEUDO_RELOC_LIST__,&__RUNTIME_PSEUDO_RELOC_LIST_END__,&_image_base__);
}
-#endif
Removed: trunk/reactos/lib/3rdparty/mingw/tgetopt.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/tgetopt…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/tgetopt.h [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/tgetopt.h (removed)
@@ -1,90 +1,0 @@
-#ifndef _GETOPT_H
-#define _GETOPT_H 1
-
-#include <tchar.h>
-
-#ifdef _UNICODE
-#define _toption _woption
-#define _toptarg _woptarg
-#define _toptind _woptind
-#define _topterr _wopterr
-#define _toptopt _woptopt
-#define _tgetopt _wgetopt
-#define _tgetopt_long _wgetopt_long
-#define _tgetopt_long_only _wgetopt_long_only
-#define _tgetopt_internal _wgetopt_internal
-#else
-#define _toption option
-#define _toptarg optarg
-#define _toptind optind
-#define _topterr opterr
-#define _toptopt optopt
-#define _tgetopt getopt
-#define _tgetopt_long getopt_long
-#define _tgetopt_long_only getopt_long_only
-#define _tgetopt_internal _getopt_internal
-#endif
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-extern char *optarg;
-extern int optind;
-extern int opterr;
-extern int optopt;
-
-extern wchar_t *_woptarg;
-extern int _woptind;
-extern int _wopterr;
-extern int _woptopt;
-
-struct option
-{
- const char *name;
- int has_arg;
- int *flag;
- int val;
-};
-
-struct _woption
-{
- const wchar_t *name;
- int has_arg;
- int *flag;
- int val;
-};
-
-#define no_argument 0
-#define required_argument 1
-#define optional_argument 2
-
-extern int getopt (int argc, char *const *argv, const char *shortopts);
-extern int getopt_long (int argc, char *const *argv, const char *shortopts,
- const struct option *longopts, int *longind);
-extern int getopt_long_only (int argc, char *const *argv,
- const char *shortopts, const struct option *longopts, int *longind);
-
-extern int _wgetopt (int argc, wchar_t *const *argv, const wchar_t *shortopts);
-extern int _wgetopt_long (int argc, wchar_t *const *argv, const wchar_t *shortopts,
- const struct _woption *longopts, int *longind);
-extern int _wgetopt_long_only (int argc, wchar_t *const *argv,
- const wchar_t *shortopts,
- const struct _woption *longopts, int *longind);
-
-extern int _getopt_internal (int argc, char *const *argv,
- const char *shortopts, const struct option *longopts, int *longind,
- int long_only);
-
-extern int _wgetopt_internal (int argc, wchar_t *const *argv,
- const wchar_t *shortopts,
- const struct _woption *longopts, int *longind,
- int long_only);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _GETOPT_H */
-
Modified: trunk/reactos/lib/3rdparty/mingw/tlssup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/tlssup.…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/tlssup.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/tlssup.c [iso-8859-1] Sat Mar 14 03:50:23 2009
@@ -1,8 +1,15 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ */
+
#ifdef CRTDLL
#undef CRTDLL
#endif
-#include "internal.h"
+#include <internal.h>
+#include <sect_attribs.h>
#include <windows.h>
#include <malloc.h>
#include <crtdbg.h>
@@ -54,13 +61,11 @@
{
_PVFV *pfunc;
- //DbgPrint("__dyn_tls_init: hDllHandle %p, dwReason %d\n",
hDllHandle,dwReason);
if (dwReason != DLL_THREAD_ATTACH)
return TRUE;
for (pfunc = &__xd_a + 1; pfunc != &__xd_z; ++pfunc)
{
- //DbgPrint("pfunc at %p\n",pfunc);
if (*pfunc != NULL)
(*pfunc)();
}
@@ -74,9 +79,7 @@
int __cdecl
__tlregdtor (_PVFV func)
{
- //DbgPrint("__tlregdtor: func %p\n",func);
-
- if (dtor_list == NULL)
+ if (dtor_list == NULL)
{
dtor_list = &dtor_list_head;
dtor_list_head.count = 0;
@@ -99,11 +102,9 @@
static BOOL WINAPI
__dyn_tls_dtor (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved)
{
-
TlsDtorNode *pnode, *pnext;
int i;
- //DbgPrint("__dyn_tls_dtor: hDllHandle %p, dwReason %d\n");
if (dwReason != DLL_THREAD_DETACH && dwReason != DLL_PROCESS_DETACH)
return TRUE;
Removed: trunk/reactos/lib/3rdparty/mingw/toascii.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/toascii…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/toascii.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/toascii.c (removed)
@@ -1,25 +1,0 @@
-/*
- * toascii.c
- * This file has no copyright assigned and is placed in the Public Domain.
- * This file is a part of the mingw-runtime package.
- * No warranty is given; refer to the file DISCLAIMER within the package.
- *
- * Oldnames from ANSI header ctype.h
- *
- * Some wrapper functions for those old name functions whose appropriate
- * equivalents are not simply underscore prefixed.
- *
- */
-
-#include <ctype.h>
-
-#ifdef toascii
-#undef toascii
-#endif
-
-int
-toascii (int c)
-{
- return __toascii(c);
-}
-
Removed: trunk/reactos/lib/3rdparty/mingw/wcrt1.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/wcrt1.c…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/wcrt1.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/wcrt1.c (removed)
@@ -1,308 +1,0 @@
-/*
- * crt1.c
- * This file has no copyright assigned and is placed in the Public Domain.
- * This file is a part of the mingw-runtime package.
- * No warranty is given; refer to the file DISCLAIMER within the package.
- *
- * Source code for the startup proceedures used by all programs. This code
- * is compiled to make crt1.o, which should be located in the library path.
- *
- */
-
-/* Hide the declaration of _fmode with dllimport attribute in stdlib.h to
- avoid problems with older GCC. */
-#define __IN_MINGW_RUNTIME
-#include <stdlib.h>
-#include <stdio.h>
-#include <io.h>
-#include <process.h>
-#include <float.h>
-#include <math.h>
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <signal.h>
-
-/* NOTE: The code for initializing the _argv, _argc, and environ variables
- * has been moved to a separate .c file which is included in both
- * crt1.c and dllcrt1.c. This means changes in the code don't have to
- * be manually synchronized, but it does lead to this not-generally-
- * a-good-idea use of include. */
-#include "winit.c"
-#include "cpu_features.h"
-
-extern void _pei386_runtime_relocator (void);
-
-extern int wmain (int, wchar_t **, wchar_t **);
-
-/*
- * Must have the correct app type for MSVCRT.
- */
-
-#ifdef __MSVCRT__
-#define __UNKNOWN_APP 0
-#define __CONSOLE_APP 1
-#define __GUI_APP 2
-_CRTIMP void __set_app_type(int);
-#endif /* __MSVCRT__ */
-
-/* Global _fmode for this .exe, not the one in msvcrt.dll,
- The default is set in txtmode.o in libmingw32.a */
-/* Override the dllimport'd declarations in stdlib.h */
-#undef _fmode
-extern int _fmode;
-#ifdef __MSVCRT__
-extern int* __p__fmode(void); /* To access the dll _fmode */
-#endif
-
-/*
- * Setup the default file handles to have the _CRT_fmode mode, as well as
- * any new files created by the user.
- */
-extern int _CRT_fmode;
-
-static void
-_mingw32_init_fmode (void)
-{
- /* Don't set the std file mode if the user hasn't set any value for it. */
- if (_CRT_fmode)
- {
- _fmode = _CRT_fmode;
-
- /*
- * This overrides the default file mode settings for stdin,
- * stdout and stderr. At first I thought you would have to
- * test with isatty, but it seems that the DOS console at
- * least is smart enough to handle _O_BINARY stdout and
- * still display correctly.
- */
- if (stdin)
- {
- _setmode (_fileno (stdin), _CRT_fmode);
- }
- if (stdout)
- {
- _setmode (_fileno (stdout), _CRT_fmode);
- }
- if (stderr)
- {
- _setmode (_fileno (stderr), _CRT_fmode);
- }
- }
-
- /* Now sync the dll _fmode to the one for this .exe. */
-#ifdef __MSVCRT__
- *__p__fmode() = _fmode;
-#else
- *_imp___fmode_dll = _fmode;
-#endif
-}
-
-/* This function will be called when a trap occurs. Thanks to Jacob
- Navia for his contribution. */
-static LONG CALLBACK
-_gnu_exception_handler (EXCEPTION_POINTERS * exception_data)
-{
- void (*old_handler) (int);
- LONG action = EXCEPTION_CONTINUE_SEARCH;
- int reset_fpu = 0;
-
- switch (exception_data->ExceptionRecord->ExceptionCode)
- {
- case EXCEPTION_ACCESS_VIOLATION:
- /* test if the user has set SIGSEGV */
- old_handler = signal (SIGSEGV, SIG_DFL);
- if (old_handler == SIG_IGN)
- {
- /* this is undefined if the signal was raised by anything other
- than raise (). */
- signal (SIGSEGV, SIG_IGN);
- action = EXCEPTION_CONTINUE_EXECUTION;
- }
- else if (old_handler != SIG_DFL)
- {
- /* This means 'old' is a user defined function. Call it */
- (*old_handler) (SIGSEGV);
- action = EXCEPTION_CONTINUE_EXECUTION;
- }
- break;
-
- case EXCEPTION_ILLEGAL_INSTRUCTION:
- case EXCEPTION_PRIV_INSTRUCTION:
- /* test if the user has set SIGILL */
- old_handler = signal (SIGILL, SIG_DFL);
- if (old_handler == SIG_IGN)
- {
- /* this is undefined if the signal was raised by anything other
- than raise (). */
- signal (SIGILL, SIG_IGN);
- action = EXCEPTION_CONTINUE_EXECUTION;
- }
- else if (old_handler != SIG_DFL)
- {
- /* This means 'old' is a user defined function. Call it */
- (*old_handler) (SIGILL);
- action = EXCEPTION_CONTINUE_EXECUTION;
- }
- break;
-
- case EXCEPTION_FLT_INVALID_OPERATION:
- case EXCEPTION_FLT_DIVIDE_BY_ZERO:
- case EXCEPTION_FLT_DENORMAL_OPERAND:
- case EXCEPTION_FLT_OVERFLOW:
- case EXCEPTION_FLT_UNDERFLOW:
- case EXCEPTION_FLT_INEXACT_RESULT:
- reset_fpu = 1;
- /* fall through. */
-
- case EXCEPTION_INT_DIVIDE_BY_ZERO:
- /* test if the user has set SIGFPE */
- old_handler = signal (SIGFPE, SIG_DFL);
- if (old_handler == SIG_IGN)
- {
- signal (SIGFPE, SIG_IGN);
- if (reset_fpu)
- _fpreset ();
- action = EXCEPTION_CONTINUE_EXECUTION;
- }
- else if (old_handler != SIG_DFL)
- {
- /* This means 'old' is a user defined function. Call it */
- (*old_handler) (SIGFPE);
- action = EXCEPTION_CONTINUE_EXECUTION;
- }
- break;
-
- default:
- break;
- }
- return action;
-}
-
-/*
- * The function mainCRTStartup is the entry point for all console programs.
- */
-static void __declspec(noreturn)
-__mingw_wCRTStartup (void)
-{
- int nRet;
-
- /*
- * Set up the top-level exception handler so that signal handling
- * works as expected. The mapping between ANSI/POSIX signals and
- * Win32 SE is not 1-to-1, so caveat emptore.
- *
- */
- SetUnhandledExceptionFilter (_gnu_exception_handler);
-
- /*
- * Initialize floating point unit.
- */
- __cpu_features_init (); /* Do we have SSE, etc.*/
- _fpreset (); /* Supplied by the runtime library. */
-
- /*
- * Set up __argc, __argv and _wenviron.
- */
- _mingw32_init_wmainargs ();
-
- /*
- * Sets the default file mode.
- * If _CRT_fmode is set, also set mode for stdin, stdout
- * and stderr, as well
- * NOTE: DLLs don't do this because that would be rude!
- */
- _mingw32_init_fmode ();
-
- /* Adust references to dllimported data that have non-zero offsets. */
-#if defined(__i386__)
- _pei386_runtime_relocator ();
-#endif
-
-#if defined(__GNUC__)
-#if defined(__i386__)
- /* Align the stack to 16 bytes for the sake of SSE ops in main
- or in functions inlined into main. */
- asm __volatile__ ("andl $-16, %%esp" : : : "%esp");
-#elif defined(__mips__)
- /* Align the stack to 16 bytes */
- asm __volatile__ ("andi %sp,%sp,-16" : : : "%sp");
-#elif defined(__PowerPC__)
- /* Align the stack to 16 bytes */
- asm __volatile__ ("li 0,15\n\tandc 1,1,0" : : : "r1");
-#else
-#error Unsupported architecture
-#endif
-#endif
-
-#if defined(_MSC_VER)
-#if defined(_M_IX86)
- /* Align the stack to 16 bytes for the sake of SSE ops in main
- or in functions inlined into main. */
- __asm and esp, 0FFFFFFF0h
-#else
-#error Unsupported architecture
-#endif
-#endif
-
- /*
- * Call the main function. If the user does not supply one
- * the one in the 'libmingw32.a' library will be linked in, and
- * that one calls WinMain. See main.c in the 'lib' dir
- * for more details.
- */
- nRet = wmain (_argc, _wargv, _wenviron);
-
- /*
- * Perform exit processing for the C library. This means
- * flushing output and calling 'atexit' registered functions.
- */
- _cexit ();
-
- ExitProcess (nRet);
-}
-
-/*
- * The function mainCRTStartup is the entry point for all console programs.
- */
-void
-wmainCRTStartup (void)
-{
-#ifdef __MSVCRT__
- __set_app_type (__CONSOLE_APP);
-#endif
- __mingw_wCRTStartup ();
-}
-
-/*
- * For now the GUI startup function is the same as the console one.
- * This simply gets rid of the annoying warning about not being able
- * to find WinMainCRTStartup when linking GUI applications.
- */
-void
-wWinMainCRTStartup (void)
-{
-#ifdef __MSVCRT__
- __set_app_type (__GUI_APP);
-#endif
- __mingw_wCRTStartup ();
-}
-
-#if 0
-/*
- * We force use of library version of atexit, which is only
- * visible in import lib as _imp__atexit
- */
-extern int (*_imp__atexit)(void (*)(void));
-int atexit (void (* pfn )(void) )
-{
- return ( (*_imp__atexit)(pfn));
-}
-
-/* Likewise for non-ANSI _onexit */
-extern _onexit_t (*_imp___onexit)(_onexit_t);
-_onexit_t
-_onexit (_onexit_t pfn )
-{
- return (*_imp___onexit)(pfn);
-}
-#endif
Modified: trunk/reactos/lib/3rdparty/mingw/wildcard.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/wildcar…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/wildcard.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/wildcard.c [iso-8859-1] Sat Mar 14 03:50:23 2009
@@ -1,1 +1,7 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ */
+
int _dowildcard = 0;
Modified: trunk/reactos/lib/3rdparty/mingw/xncommod.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/xncommo…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/xncommod.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/xncommod.c [iso-8859-1] Sat Mar 14 03:50:23 2009
@@ -1,1 +1,7 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ */
+
int _commode = 0;
Modified: trunk/reactos/lib/3rdparty/mingw/xthdloc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/xthdloc…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/xthdloc.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/xthdloc.c [iso-8859-1] Sat Mar 14 03:50:23 2009
@@ -1,1 +1,7 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ */
+
int __globallocalestatus = ~0x1;
Modified: trunk/reactos/lib/3rdparty/mingw/xtxtmode.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/mingw/xtxtmod…
==============================================================================
--- trunk/reactos/lib/3rdparty/mingw/xtxtmode.c [iso-8859-1] (original)
+++ trunk/reactos/lib/3rdparty/mingw/xtxtmode.c [iso-8859-1] Sat Mar 14 03:50:23 2009
@@ -1,1 +1,7 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
+ */
+
int _fmode = 0;