From 832be2e11b5d3095e27d5731de31ef8b71ebff41 Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Thu, 21 Apr 2016 15:13:28 +0100 Subject: [PATCH] gcc-git: More missing patches --- ...rtran-incorrect-reading-of-values-fr.patch | 2 +- mingw-w64-gcc-git/0002-Relocate-libintl.patch | 855 ++++++++++++++++++ ...osix-dir-exists-semantics-more-close.patch | 130 +++ ...not-in-progpath-and-leave-case-as-is.patch | 60 ++ ...on-t-ignore-native-system-header-dir.patch | 28 + ...dows-New-feature-to-allow-overriding.patch | 2 +- .../0007-Build-EXTRA_GNATTOOLS-for-Ada.patch | 43 + .../0008-Prettify-linking-no-undefined.patch | 41 + ...in-header-cplusplus-compatible-depre.patch | 41 + .../0010-Fix-using-large-PCH.patch | 154 ++++ .../0011-Enable-shared-gnat-implib.patch | 39 + .../0012-MinGW-w64-Enable-libitm.patch | 112 +++ .../0013-MinGW-w64-Enable-shared-gnat.patch | 39 + ...ion_name_1-Retain-any-stdcall-suffix.patch | 112 +++ ...ing-to-libgcc_s_dw2-1.dll-deprecated.patch | 84 ++ 15 files changed, 1740 insertions(+), 2 deletions(-) create mode 100644 mingw-w64-gcc-git/0002-Relocate-libintl.patch create mode 100644 mingw-w64-gcc-git/0003-Windows-Follow-Posix-dir-exists-semantics-more-close.patch create mode 100644 mingw-w64-gcc-git/0004-Windows-Use-not-in-progpath-and-leave-case-as-is.patch create mode 100644 mingw-w64-gcc-git/0005-Windows-Don-t-ignore-native-system-header-dir.patch create mode 100644 mingw-w64-gcc-git/0007-Build-EXTRA_GNATTOOLS-for-Ada.patch create mode 100644 mingw-w64-gcc-git/0008-Prettify-linking-no-undefined.patch create mode 100644 mingw-w64-gcc-git/0009-gcc-make-xmmintrin-header-cplusplus-compatible-depre.patch create mode 100644 mingw-w64-gcc-git/0010-Fix-using-large-PCH.patch create mode 100644 mingw-w64-gcc-git/0011-Enable-shared-gnat-implib.patch create mode 100644 mingw-w64-gcc-git/0012-MinGW-w64-Enable-libitm.patch create mode 100644 mingw-w64-gcc-git/0013-MinGW-w64-Enable-shared-gnat.patch create mode 100644 mingw-w64-gcc-git/0014-clone_function_name_1-Retain-any-stdcall-suffix.patch create mode 100644 mingw-w64-gcc-git/0015-Force-linking-to-libgcc_s_dw2-1.dll-deprecated.patch diff --git a/mingw-w64-gcc-git/0001-gcc-5-branch-gfortran-incorrect-reading-of-values-fr.patch b/mingw-w64-gcc-git/0001-gcc-5-branch-gfortran-incorrect-reading-of-values-fr.patch index 0e993d3830..522e0c5be6 100644 --- a/mingw-w64-gcc-git/0001-gcc-5-branch-gfortran-incorrect-reading-of-values-fr.patch +++ b/mingw-w64-gcc-git/0001-gcc-5-branch-gfortran-incorrect-reading-of-values-fr.patch @@ -1,4 +1,4 @@ -From acb6f3434965cfc51b8303de7f8eb871383a0096 Mon Sep 17 00:00:00 2001 +From f57b4af0f3d1146f88063e3b986dd818446807e7 Mon Sep 17 00:00:00 2001 From: jvdelisle Date: Tue, 19 Apr 2016 19:24:28 +0000 Subject: [PATCH 01/15] gcc-5-branch gfortran incorrect reading of values from diff --git a/mingw-w64-gcc-git/0002-Relocate-libintl.patch b/mingw-w64-gcc-git/0002-Relocate-libintl.patch new file mode 100644 index 0000000000..0d44a6ed16 --- /dev/null +++ b/mingw-w64-gcc-git/0002-Relocate-libintl.patch @@ -0,0 +1,855 @@ +From b00d99e8c5b045acdacae73d946dd8147a8885c8 Mon Sep 17 00:00:00 2001 +From: Erwin Waterlander +Date: Wed, 5 Aug 2015 23:36:03 +0100 +Subject: [PATCH 02/15] Relocate libintl + +The relocatex-libintl patch adds builtin relocation for executables to the +libintl dll. With this patch the programs are automatically relocatable. There +is no need anymore to add relocation code to your program when you use this +libintl DLL. + +The patch was ported from the GnuWin32 port of libintl, which has also builtin +relacation support. + +At the moment the relocation support is only active if you compile with MinGW +for Windows. If you compile for Unix/Linux/Cygwin the functionality is +unchanged. + +See also: +http://waterlan.home.xs4all.nl/libintl.html +http://sourceforge.net/tracker/?func=detail&atid=302435&aid=3003879&group_id=2435 +GnuWin32: http://gnuwin32.sourceforge.net/ + +Great thanks to GnuWin32 maintainer Kees Zeelenberg. + +Erwin Waterlander +waterlan@xs4all.nl +http://waterlan.home.xs4all.nl/ + +Additional "bogus paths for *nix-style paths" fix by Alexey Pavlov + +[jes: fix for 64-bit] + +Signed-off-by: Johannes Schindelin +--- + intl/Makefile.in | 8 +- + intl/bindtextdom.c | 22 ++++ + intl/canonicalize.c | 343 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + intl/canonicalize.h | 18 +++ + intl/relocatex.c | 284 +++++++++++++++++++++++++++++++++++++++++++ + intl/relocatex.h | 41 +++++++ + 6 files changed, 715 insertions(+), 1 deletion(-) + create mode 100644 intl/canonicalize.c + create mode 100644 intl/canonicalize.h + create mode 100644 intl/relocatex.c + create mode 100644 intl/relocatex.h + +diff --git a/intl/Makefile.in b/intl/Makefile.in +index 3dd0b7f..e2b8666 100644 +--- a/intl/Makefile.in ++++ b/intl/Makefile.in +@@ -53,6 +53,7 @@ DEFS = -DHAVE_CONFIG_H + COMPILE = $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(DEFS-$@) $(INCLUDES) + + HEADERS = \ ++ canonicalize.h \ + gmo.h \ + gettextP.h \ + hash-string.h \ +@@ -61,6 +62,7 @@ HEADERS = \ + eval-plural.h \ + localcharset.h \ + relocatable.h \ ++ relocatex.h \ + libgnuintl.h + SOURCES = \ + bindtextdom.c \ +@@ -81,6 +83,8 @@ SOURCES = \ + plural-exp.c \ + localcharset.c \ + relocatable.c \ ++ relocatex.c \ ++ canonicalize.c \ + localename.c \ + log.c \ + osdep.c \ +@@ -104,6 +108,8 @@ OBJECTS = \ + plural-exp.o \ + localcharset.o \ + relocatable.o \ ++ relocatex.o \ ++ canonicalize.o \ + localename.o \ + log.o \ + osdep.o \ +@@ -158,7 +164,7 @@ install-info install-dvi install-ps install-pdf install-html: + $(OBJECTS): config.h libintl.h + bindtextdom.o dcgettext.o dcigettext.o dcngettext.o dgettext.o \ + dngettext.o finddomain.o gettext.o intl-compat.o loadmsgcat.o \ +-localealias.o ngettext.o textdomain.o: gettextP.h gmo.h loadinfo.h ++localealias.o ngettext.o textdomain.o: gettextP.h gmo.h loadinfo.h relocatex.h + dcigettext.o loadmsgcat.o: hash-string.h + explodename.o l10nflist.o: loadinfo.h + dcigettext.o loadmsgcat.o plural.o plural-exp.o: plural-exp.h +diff --git a/intl/bindtextdom.c b/intl/bindtextdom.c +index 6faac57..b7a62d5 100644 +--- a/intl/bindtextdom.c ++++ b/intl/bindtextdom.c +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + + #ifdef _LIBC + # include +@@ -91,6 +92,12 @@ static void set_binding_values PARAMS ((const char *domainname, + const char **dirnamep, + const char **codesetp)); + ++#if ENABLE_RELOCATABLE ++# include "relocatex.h" ++#else ++# define relocate(pathname) (pathname) ++#endif ++ + /* Specifies the directory name *DIRNAMEP and the output codeset *CODESETP + to be used for the DOMAINNAME message catalog. + If *DIRNAMEP or *CODESETP is NULL, the corresponding attribute is not +@@ -352,8 +359,23 @@ BINDTEXTDOMAIN (domainname, dirname) + const char *domainname; + const char *dirname; + { ++/* + set_binding_values (domainname, &dirname, NULL); + return (char *) dirname; ++*/ ++ if (!access (dirname, R_OK)) { ++ set_binding_values (domainname, &dirname, NULL); ++ return (char *) dirname; ++ } else { ++ char *locale_dirname, *installdir = strdup (dirname), *s; ++ if ((s = strrchr (installdir, '/'))) *s = '\0'; ++ if ((s = strrchr (installdir, '/'))) *s = '\0'; ++ locale_dirname = relocatex (installdir, dirname); ++ set_binding_values (domainname, (const char **) &locale_dirname, NULL); ++ if (installdir) ++ free (installdir); ++ return (char *) locale_dirname; ++ } + } + + /* Specify the character encoding in which the messages from the +diff --git a/intl/canonicalize.c b/intl/canonicalize.c +new file mode 100644 +index 0000000..5217f30 +--- /dev/null ++++ b/intl/canonicalize.c +@@ -0,0 +1,343 @@ ++/* Return the canonical absolute name of a given file. ++ Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#ifdef __WIN32__ ++# include ++# include ++//# include ++#endif /* __WIN32__ */ ++#include "canonicalize.h" ++ ++#ifndef MAXSYMLINKS ++# define MAXSYMLINKS 20 ++#endif ++ ++#ifndef __set_errno ++# define __set_errno(Val) errno = (Val) ++#endif ++ ++# ifdef VMS ++ /* We want the directory in Unix syntax, not in VMS syntax. */ ++# define __getcwd(buf, max) getcwd (buf, max, 0) ++# else ++# define __getcwd getcwd ++# endif ++ ++#define weak_alias(local, symbol) ++ ++#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__ ++ /* Win32, Cygwin, OS/2, DOS */ ++# define ISDIRSEP(C) ((C) == '/' || (C) == '\\') ++#else ++ /* Unix */ ++# define ISDIRSEP(C) ((C) == '/') ++#endif ++ ++#ifdef __WIN32__ ++char *win2unixpath (char *FileName) ++{ ++ char *s = FileName; ++ while (*s) { ++ if (*s == '\\') ++ *s = '/'; ++ *s++; ++ } ++ return FileName; ++} ++#endif ++ ++/* Return the canonical absolute name of file NAME. A canonical name ++ does not contain any `.', `..' components nor any repeated path ++ separators ('/') or symlinks. All path components must exist. If ++ RESOLVED is null, the result is malloc'd; otherwise, if the ++ canonical name is PATH_MAX chars or more, returns null with `errno' ++ set to ENAMETOOLONG; if the name fits in fewer than PATH_MAX chars, ++ returns the name in RESOLVED. If the name cannot be resolved and ++ RESOLVED is non-NULL, it contains the path of the first component ++ that cannot be resolved. If the path can be resolved, RESOLVED ++ holds the same value as the value returned. ++ RESOLVED must be at least PATH_MAX long */ ++ ++static char * ++canonicalize (const char *name, char *resolved) ++{ ++ char *rpath, *dest, *extra_buf = NULL; ++ const char *start, *end, *rpath_limit; ++ long int path_max; ++ int num_links = 0, old_errno; ++ ++ if (name == NULL) ++ { ++ /* As per Single Unix Specification V2 we must return an error if ++ either parameter is a null pointer. We extend this to allow ++ the RESOLVED parameter to be NULL in case the we are expected to ++ allocate the room for the return value. */ ++ __set_errno (EINVAL); ++ return NULL; ++ } ++ ++ if (name[0] == '\0') ++ { ++ /* As per Single Unix Specification V2 we must return an error if ++ the name argument points to an empty string. */ ++ __set_errno (ENOENT); ++ return NULL; ++ } ++#ifdef __WIN32__ ++ { ++ char *lpFilePart; ++ int len; ++// fprintf(stderr, "name: %s\n", name); ++ rpath = resolved ? __builtin_alloca (MAX_PATH) : malloc (MAX_PATH); ++// unix2winpath (name); ++// fprintf(stderr, "name: %s\n", name); ++len = GetFullPathName(name, MAX_PATH, rpath, &lpFilePart); ++/* GetFullPathName returns bogus paths for *nix-style paths, like ++ * /foo/bar - it just prepends current drive to them. Keep them ++ * intact (they need to be for relocation to work!). ++ */ ++if (name[0] == '/') { ++ strncpy (rpath, name, MAX_PATH - 1); ++ rpath[MAX_PATH - 1] = '\0'; ++ len = strlen (rpath); ++} ++// fprintf(stderr, "rpath: %s\n", rpath); ++ if (len == 0) { ++ //set_werrno; ++ return NULL; ++ } ++ if (len > MAX_PATH) { ++ if (resolved) ++ __set_errno(ENAMETOOLONG); ++ else { ++ rpath = realloc(rpath, len + 2); ++ GetFullPathName(name, len, rpath, &lpFilePart); ++// fprintf(stderr, "rpath: %s\n", rpath); ++ } ++ } ++// if ( ISDIRSEP(name[strlen(name)]) && !ISDIRSEP(rpath[len]) ) { ++// rpath[len] = '\\'; ++// rpath[len + 1] = 0; ++// } ++ old_errno = errno; ++ //if (!access (rpath, D_OK) && !ISDIRSEP(rpath[len - 1]) ){ ++ if (!access (rpath, R_OK) && !ISDIRSEP(rpath[len - 1]) ){ ++ rpath[len] = '\\'; ++ rpath[len + 1] = 0; ++ } ++ errno = old_errno; ++ win2unixpath (rpath); ++// fprintf(stderr, "rpath: %s\n", rpath); ++ return resolved ? strcpy(resolved, rpath) : rpath ; ++ } ++#else /* __WIN32__ */ ++ ++#ifdef PATH_MAX ++ path_max = PATH_MAX; ++#else ++ path_max = pathconf (name, _PC_PATH_MAX); ++ if (path_max <= 0) ++ path_max = 1024; ++#endif ++ ++ rpath = resolved ? __builtin_alloca (path_max) : malloc (path_max); ++ rpath_limit = rpath + path_max; ++ ++ if (name[0] != '/') ++ { ++ if (!__getcwd (rpath, path_max)) ++ { ++ rpath[0] = '\0'; ++ goto error; ++ } ++ dest = strchr (rpath, '\0'); ++ } ++ else ++ { ++ rpath[0] = '/'; ++ dest = rpath + 1; ++ } ++ ++ for (start = end = name; *start; start = end) ++ { ++#ifdef _LIBC ++ struct stat64 st; ++#else ++ struct stat st; ++#endif ++ int n; ++ ++ /* Skip sequence of multiple path-separators. */ ++ while (*start == '/') ++ ++start; ++ ++ /* Find end of path component. */ ++ for (end = start; *end && *end != '/'; ++end) ++ /* Nothing. */; ++ ++ if (end - start == 0) ++ break; ++ else if (end - start == 1 && start[0] == '.') ++ /* nothing */; ++ else if (end - start == 2 && start[0] == '.' && start[1] == '.') ++ { ++ /* Back up to previous component, ignore if at root already. */ ++ if (dest > rpath + 1) ++ while ((--dest)[-1] != '/'); ++ } ++ else ++ { ++ size_t new_size; ++ ++ if (dest[-1] != '/') ++ *dest++ = '/'; ++ ++ if (dest + (end - start) >= rpath_limit) ++ { ++ ptrdiff_t dest_offset = dest - rpath; ++ ++ if (resolved) ++ { ++ __set_errno (ENAMETOOLONG); ++ if (dest > rpath + 1) ++ dest--; ++ *dest = '\0'; ++ goto error; ++ } ++ new_size = rpath_limit - rpath; ++ if (end - start + 1 > path_max) ++ new_size += end - start + 1; ++ else ++ new_size += path_max; ++ rpath = realloc (rpath, new_size); ++ rpath_limit = rpath + new_size; ++ if (rpath == NULL) ++ return NULL; ++ ++ dest = rpath + dest_offset; ++ } ++ ++#ifdef _LIBC ++ dest = __mempcpy (dest, start, end - start); ++#else ++ memcpy (dest, start, end - start); ++ dest += end - start; ++#endif ++ *dest = '\0'; ++ ++#ifdef _LIBC ++ if (__lxstat64 (_STAT_VER, rpath, &st) < 0) ++#else ++ if (lstat (rpath, &st) < 0) ++#endif ++ goto error; ++ ++#if HAVE_READLINK ++ if (S_ISLNK (st.st_mode)) ++ { ++ char *buf = __builtin_alloca (path_max); ++ size_t len; ++ ++ if (++num_links > MAXSYMLINKS) ++ { ++ __set_errno (ELOOP); ++ goto error; ++ } ++ ++ n = __readlink (rpath, buf, path_max); ++ if (n < 0) ++ goto error; ++ buf[n] = '\0'; ++ ++ if (!extra_buf) ++ extra_buf = __builtin_alloca (path_max); ++ ++ len = strlen (end); ++ if ((long int) (n + len) >= path_max) ++ { ++ __set_errno (ENAMETOOLONG); ++ goto error; ++ } ++ ++ /* Careful here, end may be a pointer into extra_buf... */ ++ memmove (&extra_buf[n], end, len + 1); ++ name = end = memcpy (extra_buf, buf, n); ++ ++ if (buf[0] == '/') ++ dest = rpath + 1; /* It's an absolute symlink */ ++ else ++ /* Back up to previous component, ignore if at root already: */ ++ if (dest > rpath + 1) ++ while ((--dest)[-1] != '/'); ++ } ++#endif ++ } ++ } ++ if (dest > rpath + 1 && dest[-1] == '/') ++ --dest; ++ *dest = '\0'; ++ ++ return resolved ? memcpy (resolved, rpath, dest - rpath + 1) : rpath; ++ ++error: ++ if (resolved) ++ strcpy (resolved, rpath); ++ else ++ free (rpath); ++ return NULL; ++ ++#endif /* __WIN32__ */ ++} ++ ++ ++char * ++__realpath (const char *name, char *resolved) ++{ ++ if (resolved == NULL) ++ { ++ __set_errno (EINVAL); ++ return NULL; ++ } ++ ++ return canonicalize (name, resolved); ++} ++weak_alias (__realpath, realpath) ++ ++ ++char * ++__canonicalize_file_name (const char *name) ++{ ++ return canonicalize (name, NULL); ++} ++weak_alias (__canonicalize_file_name, canonicalize_file_name) ++ ++char * ++canonicalize_file_name (const char *name) ++{ ++ return canonicalize (name, NULL); ++} +diff --git a/intl/canonicalize.h b/intl/canonicalize.h +new file mode 100644 +index 0000000..ea707bf +--- /dev/null ++++ b/intl/canonicalize.h +@@ -0,0 +1,18 @@ ++#ifndef __CANONICALIZE_H__ ++#define __CANONICALIZE_H__ 1 ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++char *canonicalize_file_name (const char *name); ++ ++#ifdef __WIN32__ ++char *win2unixpath (char *path); ++#endif ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* __CANONICALIZE_H__ */ +diff --git a/intl/relocatex.c b/intl/relocatex.c +new file mode 100644 +index 0000000..a2b7438 +--- /dev/null ++++ b/intl/relocatex.c +@@ -0,0 +1,284 @@ ++/* Provide relocatable packages. ++ Copyright (C) 2003 Free Software Foundation, Inc. ++ Written by Bruno Haible , 2003. ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU Library General Public License as published ++ by the Free Software Foundation; either version 2, or (at your option) ++ any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Library General Public License for more details. ++ ++ You should have received a copy of the GNU Library General Public ++ License along with this program; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++ USA. */ ++ ++ ++/* Specification. */ ++#include ++#define _GNU_SOURCE ++#include ++#include ++#include ++#include ++/* #include */ ++#include "relocatex.h" ++#include "canonicalize.h" ++/* #include */ ++ ++ ++#if defined _WIN32 || defined __WIN32__ ++# define WIN32_LEAN_AND_MEAN ++# include ++//# define __GW32__ ++//# include ++#endif ++#define set_werrno ++ ++#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__ ++ /* Win32, Cygwin, OS/2, DOS */ ++# define ISDIRSEP(C) ((C) == '/' || (C) == '\\') ++#else ++ /* Unix */ ++# define ISDIRSEP(C) ((C) == '/') ++#endif ++ ++/* Original installation prefix. */ ++static char *orig_prefix = NULL; ++static size_t orig_prefix_len = 0; ++/* Current installation prefix. */ ++static char *curr_prefix = NULL; ++static size_t curr_prefix_len = 0; ++/* These prefixes do not end in a slash. Anything that will be concatenated ++ to them must start with a slash. */ ++ ++ ++int win2posixpath (const char *winpath, char *posixpath) ++{ ++ strcpy (posixpath, winpath); ++ win2unixpath (posixpath); ++ return 0; ++} ++ ++ ++/* Sets the original and the current installation prefix of this module. ++ Relocation simply replaces a pathname starting with the original prefix ++ by the corresponding pathname with the current prefix instead. Both ++ prefixes should be directory names without trailing slash (i.e. use "" ++ instead of "/"). */ ++static char * ++set_orig_prefix (const char *orig_prefix_arg) ++{ ++ char *memory; ++// printf ("orig_prefix_arg: %s\n", orig_prefix_arg); ++ if (!orig_prefix_arg) { ++ orig_prefix = NULL; ++ orig_prefix_len = 0; ++ return NULL; ++ } ++ if (orig_prefix) ++ free (orig_prefix); ++ ++ memory = canonicalize_file_name (orig_prefix_arg); ++// printf ("memory: %s\n", memory); ++// memory = (char *) malloc (orig_prefix_len + 1); ++ if (!memory) { ++ set_werrno; ++ orig_prefix = NULL; ++ orig_prefix_len = 0; ++ return NULL; ++ } ++ win2unixpath (memory); ++// win2posixpath (orig_prefix_arg, memory); ++ orig_prefix = memory; ++ orig_prefix_len = strlen (orig_prefix); ++// printf ("orig_prefix: %s\n", orig_prefix); ++ if (ISDIRSEP (orig_prefix[orig_prefix_len-1])) { ++ orig_prefix[orig_prefix_len-1] = '\0'; ++ orig_prefix_len--; ++ } ++// printf ("orig_prefix: %s\n", orig_prefix); ++// printf ("orig_prefix_len: %d\n", orig_prefix_len); ++ return orig_prefix; ++} ++ ++#if defined __WIN32__ ++static char * ++set_current_prefix (const char *ModuleName) ++{ ++ LPTSTR curr_prefix_arg, q, lpFilePart; ++ DWORD len; ++ int nDIRSEP = 0; ++ ++ if (curr_prefix) ++ free (curr_prefix); ++ curr_prefix_arg = malloc (MAX_PATH * sizeof (TCHAR)); ++ if (!curr_prefix_arg) { ++ set_werrno; ++ curr_prefix = NULL; ++ curr_prefix_len = 0; ++ return NULL; ++ } ++ if (ModuleName) { ++// printf ("ModuleName: %s\n", ModuleName); ++ len = SearchPath (NULL, ModuleName, ".DLL", MAX_PATH, curr_prefix_arg, &lpFilePart); ++ if (len) { ++// printf ("ModulePath: %s\n", curr_prefix_arg); ++// printf ("FilePart: %s\n", lpFilePart); ++ } ++ } ++ if (!ModuleName || !len) { ++ len = GetModuleFileName (NULL, curr_prefix_arg, MAX_PATH); ++ if (!len) { ++ set_werrno; ++ curr_prefix = NULL; ++ curr_prefix_len = 0; ++ return NULL; ++ } ++ } ++// strncpy (curr_prefix_arg, ModuleName, MAX_PATH); ++// printf ("curr_prefix_arg: %s\n", curr_prefix_arg); ++ win2posixpath (curr_prefix_arg, curr_prefix_arg); ++ curr_prefix = curr_prefix_arg; ++ q = curr_prefix_arg + len - 1; ++ /* strip name of executable and its directory */ ++ while (!ISDIRSEP (*q) && (q > curr_prefix_arg) && nDIRSEP < 2) { ++ q--; ++ if (ISDIRSEP (*q)) { ++ *q = '\0'; ++ nDIRSEP++; ++ } ++ } ++ curr_prefix_len = q - curr_prefix_arg; ++// printf ("curr_prefix: %s\n", curr_prefix); ++// printf ("curr_prefix_len: %d\n", curr_prefix_len); ++ return curr_prefix; ++} ++ ++char *getshortpath (const char *longpath) ++{ ++ char *shortpath = NULL; ++ DWORD len, res; ++ ++// printf ("longpath: %s\n", longpath); ++ len = GetShortPathName(longpath, shortpath, 0); ++// printf ("len: %ld\n", len); ++ if (!len) { ++// WinErr ("getshortpath: len = 0"); ++ set_werrno; ++ return (char *) longpath; ++ } ++ shortpath = (char *) malloc (len + 1); ++ if (!shortpath) { ++// WinErr ("getshortpath: malloc"); ++ set_werrno; ++ return (char *) longpath; ++ } ++ res = GetShortPathName(longpath, shortpath, len); ++// printf ("res: %ld\n", res); ++ if (!res) { ++// WinErr ("getshortpath: res = 0"); ++ free (shortpath); ++ set_werrno; ++ return (char *) longpath; ++ } ++// printf ("shortpath: %s\n", shortpath); ++ return shortpath; ++} ++ ++char *relocaten (const char *ModuleName, const char *path) ++{ ++ char *relative_path, *relocated_path, *relocated_short_path; ++ int relative_path_len; ++ ++ if (!curr_prefix) ++ set_current_prefix (ModuleName); ++// printf ("path: %s\n", path); ++// printf ("orig_prefix: %s\n", orig_prefix); ++// printf ("curr_prefix: %s\n", curr_prefix); ++// if (strncmp (orig_prefix, path, orig_prefix_len)) ++// if (strcmp (orig_prefix, path)) ++// return (char *) path; ++ relative_path = (char *) path + orig_prefix_len; ++// printf ("relative_path: %s\n", relative_path); ++ relative_path_len = strlen (relative_path); ++ relocated_path = malloc (curr_prefix_len + relative_path_len + 1); ++ strcpy (relocated_path, curr_prefix); ++ strcat (relocated_path, relative_path); ++// printf ("relocated_path: %s\n", relocated_path); ++ relocated_short_path = getshortpath (relocated_path); ++// printf ("relocated_short_path: %s\n", relocated_short_path); ++ if (relocated_short_path) { ++ if (relocated_short_path != relocated_path) ++ free (relocated_path); ++ return relocated_short_path; ++ } else ++ return relocated_path; ++} ++ ++#else // __WIN32__ ++char *relocaten (const char *ModuleName, const char *path) ++{ ++ // dummy function for Unix/Linux ++ return (char *)path; ++} ++#endif ++ ++char *relocaten2 (const char *ModuleName, const char *installdir, const char *path) ++{ ++ set_orig_prefix (installdir); ++ return relocaten (ModuleName, path); ++} ++ ++char *relocatenx (const char *ModuleName, const char *installdir, const char *path) ++{ ++ char *p; ++ ++ set_orig_prefix (installdir); ++ if (access (path, R_OK)) ++ p = relocaten (ModuleName, path); ++ else ++ p = (char *) path; ++// printf ("relocatenx: %s\n", p); ++ return p; ++} ++ ++char *relocate2 (const char *installdir, const char *path) ++{ ++ return relocaten2 (NULL, installdir, path); ++} ++ ++char *relocatex (const char *installdir, const char *path) ++{ ++ return relocatenx (NULL, installdir, path); ++} ++ ++char *relocatepx (const char *cprefix, const char *installdir, const char *path) ++{ ++ if (curr_prefix) ++ free (curr_prefix); ++ curr_prefix = strdup (cprefix); ++ return relocatex (installdir, path); ++} ++ ++static char *get_orig_prefix (void) ++{ ++ return orig_prefix; ++} ++ ++static char *get_curr_prefix (void) ++{ ++ return curr_prefix; ++} ++ ++static char *set_curr_prefix (const char *ModuleName) ++{ ++ if (curr_prefix) ++ free (curr_prefix); ++ set_current_prefix (ModuleName); ++ return curr_prefix; ++} +diff --git a/intl/relocatex.h b/intl/relocatex.h +new file mode 100644 +index 0000000..5cc7c51 +--- /dev/null ++++ b/intl/relocatex.h +@@ -0,0 +1,41 @@ ++/* ++ Copyright (C) 2006 Free Software Foundation, Inc. ++ This file is part of the GnuWin C Library. ++ ++ The GnuWin C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GnuWin C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GnuWin32 C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#ifndef __RELOCATE_H__ ++#define __RELOCATE_H__ 1 ++ ++/* #include */ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++char *relocaten (const char *ModuleName, const char *path); ++char *relocaten2 (const char *ModuleName, const char *installdir, const char *path); ++char *relocatenx (const char *ModuleName, const char *installdir, const char *path); ++char *relocate2 (const char *installdir, const char *path); ++char *relocatex (const char *installdir, const char *path); ++ ++#ifdef __cplusplus ++} ++#endif ++ ++//#endif /* __GW32__ */ ++ ++#endif /* __RELOCATE_H__ */ +-- +2.8.1 + diff --git a/mingw-w64-gcc-git/0003-Windows-Follow-Posix-dir-exists-semantics-more-close.patch b/mingw-w64-gcc-git/0003-Windows-Follow-Posix-dir-exists-semantics-more-close.patch new file mode 100644 index 0000000000..f4ce3411e1 --- /dev/null +++ b/mingw-w64-gcc-git/0003-Windows-Follow-Posix-dir-exists-semantics-more-close.patch @@ -0,0 +1,130 @@ +From 9f49390e2cd9085ca1cc03906a146861dbe8135f Mon Sep 17 00:00:00 2001 +From: Ray Donnelly +Date: Wed, 5 Aug 2015 23:36:07 +0100 +Subject: [PATCH 03/15] Windows: Follow Posix dir-exists semantics more closely + +Make Windows behave the same as Posix in the consideration +of whether folder "/doesnt-exist/.." is a valid +path. In Posix, it isn't. + +A concrete instance of when this matters is when cross +compiling GNU/Linux glibc on Windows. +--- + libcpp/files.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 87 insertions(+) + +diff --git a/libcpp/files.c b/libcpp/files.c +index ea2cc23..ac17272 100644 +--- a/libcpp/files.c ++++ b/libcpp/files.c +@@ -30,6 +30,13 @@ along with this program; see the file COPYING3. If not see + #include "md5.h" + #include + ++/* Needed for stat_st_mode_symlink below */ ++#if defined(_WIN32) ++# include ++# define S_IFLNK 0xF000 ++# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) ++#endif ++ + /* Variable length record files on VMS will have a stat size that includes + record control characters that won't be included in the read size. */ + #ifdef VMS +@@ -198,6 +205,49 @@ static int pchf_save_compare (const void *e1, const void *e2); + static int pchf_compare (const void *d_p, const void *e_p); + static bool check_file_against_entries (cpp_reader *, _cpp_file *, bool); + ++#if defined(_WIN32) ++ ++static int stat_st_mode_symlink (char const* path, struct stat* buf) ++{ ++ WIN32_FILE_ATTRIBUTE_DATA attr; ++ memset(buf,0,sizeof(*buf)); ++ int err = GetFileAttributesExA (path, GetFileExInfoStandard, &attr) ? 0 : 1; ++ if (!err) ++ { ++ WIN32_FIND_DATAA finddata; ++ HANDLE h = FindFirstFileA (path, &finddata); ++ if (h != INVALID_HANDLE_VALUE) ++ { ++ FindClose (h); ++ if ((finddata.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) && ++ (finddata.dwReserved0 == IO_REPARSE_TAG_SYMLINK)) ++ buf->st_mode = S_IFLNK; ++ else if (finddata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ++ buf->st_mode = S_IFDIR; ++ else if (finddata.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE) ++ buf->st_mode = S_IFDIR; ++ else ++ buf->st_mode = S_IFREG; ++ buf->st_mode |= S_IREAD; ++ if (!(finddata.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) ++ buf->st_mode |= S_IWRITE; ++ } ++ else ++ { ++ buf->st_mode = S_IFDIR; ++ } ++ return 0; ++ } ++ return -1; ++} ++ ++#else ++ ++#define stat_st_mode_symlink (_name, _buf) stat ((_name), (_buf)) ++ ++#endif ++ ++ + /* Given a filename in FILE->PATH, with the empty string interpreted + as , open it. + +@@ -227,6 +277,43 @@ open_file (_cpp_file *file) + } + else + file->fd = open (file->path, O_RDONLY | O_NOCTTY | O_BINARY, 0666); ++#if defined(_WIN32) || defined(__CYGWIN__) ++ /* Windows and Posix differ in the face of paths of the form: ++ nonexistantdir/.. in that Posix will return ENOENT whereas ++ Windows won't care that we stepped into a non-existant dir ++ Only do these slow checks if ".." appears in file->path. ++ Cygwin also suffers from the same problem (but doesn't need ++ a new stat function): ++ http://cygwin.com/ml/cygwin/2013-05/msg00222.html ++ */ ++ if (file->fd > 0) ++ { ++ char filepath[MAX_PATH]; ++ strncpy (filepath, file->path, sizeof(filepath) - 1); ++ char* dirsep = &filepath[0]; ++ while ( (dirsep = strchr (dirsep, '\\')) != NULL) ++ *dirsep = '/'; ++ if (strstr(file->path, "/../")) ++ { ++ dirsep = &filepath[0]; ++ char dirsepc; ++ /* Check each directory in the chain. */ ++ while ( (dirsep = strpbrk (dirsep, "\\/")) != NULL) ++ { ++ dirsepc = *(++dirsep); ++ *dirsep = '\0'; ++ if (stat_st_mode_symlink (filepath, &file->st) == -1) ++ { ++ *dirsep = dirsepc; ++ close (file->fd); ++ file->fd = -1; ++ return false; ++ } ++ *dirsep++ = dirsepc; ++ } ++ } ++ } ++#endif + + if (file->fd != -1) + { +-- +2.8.1 + diff --git a/mingw-w64-gcc-git/0004-Windows-Use-not-in-progpath-and-leave-case-as-is.patch b/mingw-w64-gcc-git/0004-Windows-Use-not-in-progpath-and-leave-case-as-is.patch new file mode 100644 index 0000000000..7b6a6be8d6 --- /dev/null +++ b/mingw-w64-gcc-git/0004-Windows-Use-not-in-progpath-and-leave-case-as-is.patch @@ -0,0 +1,60 @@ +From 233bc23e32c5213255d8391dede53aa0b61ec23f Mon Sep 17 00:00:00 2001 +From: Ray Donnelly +Date: Wed, 5 Aug 2015 23:36:09 +0100 +Subject: [PATCH 04/15] Windows: Use '/' not '\' in progpath and leave case + as-is + +Windows can handle both '/' and '\' dirseps. GCC will +have been built using Cygwin, MSYS* or cross-compiled +from a system where dirsep is '/' so it is cleaner to +force the dirseps to be '/' and keep the case as-is. + +This way, the value will be consistent with the build +system and string operations, be they internal to GCC +or external to it (e.g. processing map files with sed) +have a better chance of working as expected. + +A concrete instance of when this matters is when cross +compiling GNU/Linux glibc on Windows. +--- + libiberty/lrealpath.c | 19 +++++++++++++++---- + 1 file changed, 15 insertions(+), 4 deletions(-) + +diff --git a/libiberty/lrealpath.c b/libiberty/lrealpath.c +index b27c8de..8165984 100644 +--- a/libiberty/lrealpath.c ++++ b/libiberty/lrealpath.c +@@ -138,15 +138,26 @@ lrealpath (const char *filename) + { + char buf[MAX_PATH]; + char* basename; ++ char* slash; + DWORD len = GetFullPathName (filename, MAX_PATH, buf, &basename); + if (len == 0 || len > MAX_PATH - 1) + return strdup (filename); + else + { +- /* The file system is case-preserving but case-insensitive, +- Canonicalize to lowercase, using the codepage associated +- with the process locale. */ +- CharLowerBuff (buf, len); ++ /* Turn all back slashes back into forward slashes ++ and don't make it lowercase. ++ Rationale: ++ Windows is as happy with / as it is with \. This will ++ have been built using Cygwin, MSYS* or cross-compiled ++ from a system where dirsep is / so it is cleaner just ++ to keep the dirseps as / (and the case un-modified). ++ This way, the value will be consistent with the build ++ system and string operations (be they internal to this ++ software or external to it, e.g. processing map files ++ with sed) work as expected. */ ++ slash = buf; ++ while ((slash = strchr(slash,'\\')) != NULL) ++ *slash = '/'; + return strdup (buf); + } + } +-- +2.8.1 + diff --git a/mingw-w64-gcc-git/0005-Windows-Don-t-ignore-native-system-header-dir.patch b/mingw-w64-gcc-git/0005-Windows-Don-t-ignore-native-system-header-dir.patch new file mode 100644 index 0000000000..7d9e9c87f9 --- /dev/null +++ b/mingw-w64-gcc-git/0005-Windows-Don-t-ignore-native-system-header-dir.patch @@ -0,0 +1,28 @@ +From a2bc77d0e198659e72c9addb89a993007de99fe7 Mon Sep 17 00:00:00 2001 +From: Ray Donnelly +Date: Wed, 5 Aug 2015 23:36:11 +0100 +Subject: [PATCH 05/15] Windows: Don't ignore native system header dir + +--- + gcc/config.gcc | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/gcc/config.gcc b/gcc/config.gcc +index c835734..4638567 100644 +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -1699,7 +1699,10 @@ i[34567]86-*-mingw* | x86_64-*-mingw*) + tmake_file="${tmake_file} i386/t-mingw-w32" + ;; + esac +- native_system_header_dir=/mingw/include ++ # Don't ignore values passed in to configure via --native-system-header-dir ++ if test x$native_system_header_dir = x ; then ++ native_system_header_dir=/mingw/include ++ fi + target_gtfiles="\$(srcdir)/config/i386/winnt.c" + extra_options="${extra_options} i386/cygming.opt i386/mingw.opt" + case ${target} in +-- +2.8.1 + diff --git a/mingw-w64-gcc-git/0006-gcc-5-branch-Windows-New-feature-to-allow-overriding.patch b/mingw-w64-gcc-git/0006-gcc-5-branch-Windows-New-feature-to-allow-overriding.patch index 8a9675eed3..c16e0acbec 100644 --- a/mingw-w64-gcc-git/0006-gcc-5-branch-Windows-New-feature-to-allow-overriding.patch +++ b/mingw-w64-gcc-git/0006-gcc-5-branch-Windows-New-feature-to-allow-overriding.patch @@ -1,4 +1,4 @@ -From 73c46f52872c95daed5e8bdca52c4b3e0d633c01 Mon Sep 17 00:00:00 2001 +From 8e527cc0db8f292521bfa91cf2743beac912432a Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Wed, 5 Aug 2015 23:36:13 +0100 Subject: [PATCH 06/15] gcc-5-branch Windows: New feature to allow overriding diff --git a/mingw-w64-gcc-git/0007-Build-EXTRA_GNATTOOLS-for-Ada.patch b/mingw-w64-gcc-git/0007-Build-EXTRA_GNATTOOLS-for-Ada.patch new file mode 100644 index 0000000000..bc3ada1b50 --- /dev/null +++ b/mingw-w64-gcc-git/0007-Build-EXTRA_GNATTOOLS-for-Ada.patch @@ -0,0 +1,43 @@ +From 9a65c5c252faf115bc700b9f737b8505c17df375 Mon Sep 17 00:00:00 2001 +From: Alexey Pavlov +Date: Wed, 5 Aug 2015 23:36:17 +0100 +Subject: [PATCH 07/15] Build EXTRA_GNATTOOLS for Ada + +--- + gnattools/Makefile.in | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/gnattools/Makefile.in b/gnattools/Makefile.in +index 423cc6e..aaee42f 100644 +--- a/gnattools/Makefile.in ++++ b/gnattools/Makefile.in +@@ -193,7 +193,7 @@ gnattools-native: $(GCC_DIR)/stamp-tools $(GCC_DIR)/stamp-gnatlib-rts + ../../gnatmake$(exeext) ../../gnatlink$(exeext) + # gnattools2 + $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ +- $(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools ++ $(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools $(EXTRA_GNATTOOLS) + + # gnatmake/link can be built with recent gnatmake/link if they are available. + # This is especially convenient for building cross tools or for rebuilding +@@ -205,7 +205,7 @@ regnattools: $(GCC_DIR)/stamp-gnatlib-rts + gnatmake-re gnatlink-re + # gnattools2 + $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ +- $(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools ++ $(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools $(EXTRA_GNATTOOLS) + + gnattools-cross: $(GCC_DIR)/stamp-tools + # gnattools1-re +@@ -214,7 +214,7 @@ gnattools-cross: $(GCC_DIR)/stamp-tools + gnatmake-re gnatlink-re + # gnattools2 + $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ +- $(TOOLS_FLAGS_TO_PASS_CROSS) common-tools ++ $(TOOLS_FLAGS_TO_PASS_CROSS) common-tools $(EXTRA_GNATTOOLS) + # Rename cross tools to where the GCC makefile wants them when + # installing. FIXME: installation should be done elsewhere. + if [ -f $(GCC_DIR)/gnatbind$(exeext) ] ; then \ +-- +2.8.1 + diff --git a/mingw-w64-gcc-git/0008-Prettify-linking-no-undefined.patch b/mingw-w64-gcc-git/0008-Prettify-linking-no-undefined.patch new file mode 100644 index 0000000000..a8ed4bdeff --- /dev/null +++ b/mingw-w64-gcc-git/0008-Prettify-linking-no-undefined.patch @@ -0,0 +1,41 @@ +From cfe4caf51c829a6bd746566a0b205354fa042dc3 Mon Sep 17 00:00:00 2001 +From: Alexey Pavlov +Date: Wed, 5 Aug 2015 23:36:19 +0100 +Subject: [PATCH 08/15] Prettify linking -no-undefined + +It might be better to put this change in a +conditional block for Windows only? +--- + libgfortran/Makefile.am | 2 +- + libgfortran/Makefile.in | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libgfortran/Makefile.am b/libgfortran/Makefile.am +index 31eb986..f8ef020 100644 +--- a/libgfortran/Makefile.am ++++ b/libgfortran/Makefile.am +@@ -50,7 +50,7 @@ libgfortranbegin_la_LINK = $(LINK) $(libgfortranbegin_la_LDFLAGS) + cafexeclib_LTLIBRARIES = libcaf_single.la + cafexeclibdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)$(MULTISUBDIR) + libcaf_single_la_SOURCES = caf/single.c +-libcaf_single_la_LDFLAGS = -static ++libcaf_single_la_LDFLAGS = -static -no-undefined + libcaf_single_la_DEPENDENCIES = caf/libcaf.h + libcaf_single_la_LINK = $(LINK) $(libcaf_single_la_LDFLAGS) + +diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in +index 0f60e6e..8473026 100644 +--- a/libgfortran/Makefile.in ++++ b/libgfortran/Makefile.in +@@ -615,7 +615,7 @@ libgfortranbegin_la_LINK = $(LINK) $(libgfortranbegin_la_LDFLAGS) + cafexeclib_LTLIBRARIES = libcaf_single.la + cafexeclibdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)$(MULTISUBDIR) + libcaf_single_la_SOURCES = caf/single.c +-libcaf_single_la_LDFLAGS = -static ++libcaf_single_la_LDFLAGS = -static -no-undefined + libcaf_single_la_DEPENDENCIES = caf/libcaf.h + libcaf_single_la_LINK = $(LINK) $(libcaf_single_la_LDFLAGS) + @IEEE_SUPPORT_TRUE@fincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)$(MULTISUBDIR)/finclude +-- +2.8.1 + diff --git a/mingw-w64-gcc-git/0009-gcc-make-xmmintrin-header-cplusplus-compatible-depre.patch b/mingw-w64-gcc-git/0009-gcc-make-xmmintrin-header-cplusplus-compatible-depre.patch new file mode 100644 index 0000000000..737975dcd2 --- /dev/null +++ b/mingw-w64-gcc-git/0009-gcc-make-xmmintrin-header-cplusplus-compatible-depre.patch @@ -0,0 +1,41 @@ +From 5acba903704742cacea4af9f338230e03f9ac049 Mon Sep 17 00:00:00 2001 +From: Erik van Pienbroek +Date: Wed, 5 Aug 2015 23:36:21 +0100 +Subject: [PATCH 09/15] gcc: make xmmintrin header cplusplus compatible + [deprecated] + +Deprecated as-per: +http://marc.info/?l=fedora-extras-commits&m=138946782004553&w=2 +--- + gcc/config/i386/xmmintrin.h | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/gcc/config/i386/xmmintrin.h b/gcc/config/i386/xmmintrin.h +index 9cd3fa7..9334f27 100644 +--- a/gcc/config/i386/xmmintrin.h ++++ b/gcc/config/i386/xmmintrin.h +@@ -64,6 +64,10 @@ _mm_prefetch (const void *__P, enum _mm_hint __I) + #define __DISABLE_SSE__ + #endif /* __SSE__ */ + ++#ifdef __cplusplus ++extern "C" { ++#endif ++ + /* The Intel API is flexible enough that we must allow aliasing with other + vector types, and their scalar components. */ + typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__)); +@@ -1245,6 +1249,10 @@ do { \ + (row3) = __builtin_ia32_movhlps (__t3, __t2); \ + } while (0) + ++#ifdef __cplusplus ++} ++#endif ++ + /* For backward source compatibility. */ + # include + +-- +2.8.1 + diff --git a/mingw-w64-gcc-git/0010-Fix-using-large-PCH.patch b/mingw-w64-gcc-git/0010-Fix-using-large-PCH.patch new file mode 100644 index 0000000000..af8ebec051 --- /dev/null +++ b/mingw-w64-gcc-git/0010-Fix-using-large-PCH.patch @@ -0,0 +1,154 @@ +From 22a67f6b18d2854bcdf740833cf4e1a0555c7295 Mon Sep 17 00:00:00 2001 +From: Martin Richter +Date: Wed, 5 Aug 2015 23:36:25 +0100 +Subject: [PATCH 10/15] Fix using large PCH + +The following patch fixes segfault when gt_pch_use_address +fails (returns -1). fatal_error now correctly shows an error +message and terminates the program. +I have basicly only reordered reads, and placed them after +the file mapping itself. Global pointers are changed only +after gt_pch_use_address succeeds, so in case of failure +they still contain valid addresses. + +This patch is meant for the master branch. However, it +should not be hard to modify it for others. + +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=14940 +https://sourceforge.net/p/mingw-w64/bugs/382/ +--- + gcc/config/i386/host-mingw32.c | 10 ++------- + gcc/ggc-common.c | 51 +++++++++++++++++++++++++++++++++--------- + 2 files changed, 42 insertions(+), 19 deletions(-) + +diff --git a/gcc/config/i386/host-mingw32.c b/gcc/config/i386/host-mingw32.c +index aa17378..631d9c4 100644 +--- a/gcc/config/i386/host-mingw32.c ++++ b/gcc/config/i386/host-mingw32.c +@@ -42,9 +42,6 @@ static size_t mingw32_gt_pch_alloc_granularity (void); + + static inline void w32_error(const char*, const char*, int, const char*); + +-/* FIXME: Is this big enough? */ +-static const size_t pch_VA_max_size = 128 * 1024 * 1024; +- + /* Granularity for reserving address space. */ + static size_t va_granularity = 0x10000; + +@@ -86,9 +83,6 @@ static void * + mingw32_gt_pch_get_address (size_t size, int) + { + void* res; +- size = (size + va_granularity - 1) & ~(va_granularity - 1); +- if (size > pch_VA_max_size) +- return NULL; + + /* FIXME: We let system determine base by setting first arg to NULL. + Allocating at top of available address space avoids unnecessary +@@ -98,7 +92,7 @@ mingw32_gt_pch_get_address (size_t size, int) + If we allocate at bottom we need to reserve the address as early + as possible and at the same point in each invocation. */ + +- res = VirtualAlloc (NULL, pch_VA_max_size, ++ res = VirtualAlloc (NULL, size, + MEM_RESERVE | MEM_TOP_DOWN, + PAGE_NOACCESS); + if (!res) +@@ -148,7 +142,7 @@ mingw32_gt_pch_use_address (void *addr, size_t size, int fd, + + /* Offset must be also be a multiple of allocation granularity for + this to work. We can't change the offset. */ +- if ((offset & (va_granularity - 1)) != 0 || size > pch_VA_max_size) ++ if ((offset & (va_granularity - 1)) != 0) + return -1; + + +diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c +index 03fbe7d..3a5df8a 100644 +--- a/gcc/ggc-common.c ++++ b/gcc/ggc-common.c +@@ -603,7 +603,9 @@ gt_pch_restore (FILE *f) + size_t i; + struct mmap_info mmi; + int result; +- ++ long pch_tabs_off; ++ long pch_data_off; ++ + /* Delete any deletable objects. This makes ggc_pch_read much + faster, as it can be sure that no GCable objects remain other + than the ones just read in. */ +@@ -611,20 +613,24 @@ gt_pch_restore (FILE *f) + for (rti = *rt; rti->base != NULL; rti++) + memset (rti->base, 0, rti->stride); + +- /* Read in all the scalar variables. */ ++ /* We need to read tables after mapping, or fatal_error will ++ segfault when gt_pch_use_address returns -1. Skip them for now. */ ++ pch_tabs_off = ftell(f); ++ ++ /* Skip all the scalar variables. */ + for (rt = gt_pch_scalar_rtab; *rt; rt++) + for (rti = *rt; rti->base != NULL; rti++) +- if (fread (rti->base, rti->stride, 1, f) != 1) +- fatal_error (input_location, "can%'t read PCH file: %m"); ++ if (fseek (f, rti->stride, SEEK_CUR) != 0) ++ fatal_error (input_location, "can%'t read PCH file: %m"); + +- /* Read in all the global pointers, in 6 easy loops. */ ++ /* Skip all the global pointers. */ + for (rt = gt_ggc_rtab; *rt; rt++) + for (rti = *rt; rti->base != NULL; rti++) + for (i = 0; i < rti->nelt; i++) +- if (fread ((char *)rti->base + rti->stride * i, +- sizeof (void *), 1, f) != 1) +- fatal_error (input_location, "can%'t read PCH file: %m"); +- ++ if (fseek (f, sizeof (void *), SEEK_CUR) != 0) ++ fatal_error (input_location, "can%'t read PCH file: %m"); ++ ++ /* mmi still has to be read now. */ + if (fread (&mmi, sizeof (mmi), 1, f) != 1) + fatal_error (input_location, "can%'t read PCH file: %m"); + +@@ -635,12 +641,35 @@ gt_pch_restore (FILE *f) + if (result == 0) + { + if (fseek (f, mmi.offset, SEEK_SET) != 0 +- || fread (mmi.preferred_base, mmi.size, 1, f) != 1) +- fatal_error (input_location, "can%'t read PCH file: %m"); ++ || fread (mmi.preferred_base, mmi.size, 1, f) != 1) ++ fatal_error (input_location, "can%'t read PCH file: %m"); + } + else if (fseek (f, mmi.offset + mmi.size, SEEK_SET) != 0) + fatal_error (input_location, "can%'t read PCH file: %m"); ++ ++ /* File mapping done, read tables now. */ ++ pch_data_off = ftell(f); ++ ++ if (fseek (f, pch_tabs_off, SEEK_SET) != 0) ++ fatal_error (input_location, "can%'t read PCH file: %m"); + ++ /* Read in all the scalar variables. */ ++ for (rt = gt_pch_scalar_rtab; *rt; rt++) ++ for (rti = *rt; rti->base != NULL; rti++) ++ if (fread (rti->base, rti->stride, 1, f) != 1) ++ fatal_error (input_location, "can%'t read PCH file: %m"); ++ ++ /* Read in all the global pointers, in 6 easy loops. */ ++ for (rt = gt_ggc_rtab; *rt; rt++) ++ for (rti = *rt; rti->base != NULL; rti++) ++ for (i = 0; i < rti->nelt; i++) ++ if (fread ((char *)rti->base + rti->stride * i, ++ sizeof (void *), 1, f) != 1) ++ fatal_error (input_location, "can%'t read PCH file: %m"); ++ ++ if (fseek (f, pch_data_off, SEEK_SET) != 0) ++ fatal_error (input_location, "can%'t read PCH file: %m"); ++ + ggc_pch_read (f, mmi.preferred_base); + + gt_pch_restore_stringpool (); +-- +2.8.1 + diff --git a/mingw-w64-gcc-git/0011-Enable-shared-gnat-implib.patch b/mingw-w64-gcc-git/0011-Enable-shared-gnat-implib.patch new file mode 100644 index 0000000000..35841aef83 --- /dev/null +++ b/mingw-w64-gcc-git/0011-Enable-shared-gnat-implib.patch @@ -0,0 +1,39 @@ +From 8010fde8214f3b83bc7b2e6ff050afbbac081256 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=BCrgen=20Pfeifer?= +Date: Wed, 5 Aug 2015 23:36:27 +0100 +Subject: [PATCH 11/15] Enable shared gnat implib + +Provide GNAT runtime import libraries to +allow to link against shared runtime + +Original commit: +https://github.com/Alexpux/MINGW-packages/commit/51b4eb3b702fdb38df0460180c2f8209a686aaec +--- + gcc/ada/gcc-interface/Makefile.in | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in +index e1ca515..133807e 100644 +--- a/gcc/ada/gcc-interface/Makefile.in ++++ b/gcc/ada/gcc-interface/Makefile.in +@@ -2804,13 +2804,16 @@ gnatlib-shared-win32: + $(PICFLAG_FOR_TARGET) \ + -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \ + $(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \ +- $(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) $(MISCLIB) ++ $(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \ ++ -Wl,-out-implib,libgnat$(hyphen)$(LIBRARY_VERSION).dll.a \ ++ $(MISCLIB) + cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \ + | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared -shared-libgcc \ + $(PICFLAG_FOR_TARGET) \ + -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \ + $(GNATRTL_TASKING_OBJS) \ + $(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \ ++ -Wl,-out-implib,libgnarl$(hyphen)$(LIBRARY_VERSION).dll.a \ + $(THREADSLIB) -Wl,libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) + + gnatlib-shared-darwin: +-- +2.8.1 + diff --git a/mingw-w64-gcc-git/0012-MinGW-w64-Enable-libitm.patch b/mingw-w64-gcc-git/0012-MinGW-w64-Enable-libitm.patch new file mode 100644 index 0000000000..63bd39c962 --- /dev/null +++ b/mingw-w64-gcc-git/0012-MinGW-w64-Enable-libitm.patch @@ -0,0 +1,112 @@ +From 48a7c0479ed88b031d1783e3a24d5bee3e52149e Mon Sep 17 00:00:00 2001 +From: LRN +Date: Wed, 5 Aug 2015 23:36:29 +0100 +Subject: [PATCH 12/15] MinGW-w64: Enable libitm + +--- + libitm/Makefile.am | 2 +- + libitm/Makefile.in | 3 ++- + libitm/configure | 17 +++++++++++++++++ + libitm/configure.ac | 1 + + libitm/configure.tgt | 4 ++++ + 5 files changed, 25 insertions(+), 2 deletions(-) + +diff --git a/libitm/Makefile.am b/libitm/Makefile.am +index 1dce82d..0ea39f2 100644 +--- a/libitm/Makefile.am ++++ b/libitm/Makefile.am +@@ -54,7 +54,7 @@ libitm_version_info = -version-info $(libtool_VERSION) + # want or need libstdc++. + libitm_la_DEPENDENCIES = $(libitm_version_dep) + libitm_la_LINK = $(LINK) $(libitm_la_LDFLAGS) +-libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script) ++libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script) $(lt_host_flags) + + libitm_la_SOURCES = \ + aatree.cc alloc.cc alloc_c.cc alloc_cpp.cc barrier.cc beginend.cc \ +diff --git a/libitm/Makefile.in b/libitm/Makefile.in +index 6c4d253..5898bd8 100644 +--- a/libitm/Makefile.in ++++ b/libitm/Makefile.in +@@ -279,6 +279,7 @@ libtool_VERSION = @libtool_VERSION@ + link_itm = @link_itm@ + localedir = @localedir@ + localstatedir = @localstatedir@ ++lt_host_flags = @lt_host_flags@ + mandir = @mandir@ + mkdir_p = @mkdir_p@ + multi_basedir = @multi_basedir@ +@@ -329,7 +330,7 @@ libitm_version_info = -version-info $(libtool_VERSION) + # want or need libstdc++. + libitm_la_DEPENDENCIES = $(libitm_version_dep) + libitm_la_LINK = $(LINK) $(libitm_la_LDFLAGS) +-libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script) ++libitm_la_LDFLAGS = $(libitm_version_info) $(libitm_version_script) $(lt_host_flags) + libitm_la_SOURCES = aatree.cc alloc.cc alloc_c.cc alloc_cpp.cc \ + barrier.cc beginend.cc clone.cc eh_cpp.cc local.cc query.cc \ + retry.cc rwlock.cc useraction.cc util.cc sjlj.S tls.cc \ +diff --git a/libitm/configure b/libitm/configure +index e924228..a23c011 100644 +--- a/libitm/configure ++++ b/libitm/configure +@@ -630,6 +630,7 @@ MAINTAINER_MODE_FALSE + MAINTAINER_MODE_TRUE + enable_static + enable_shared ++lt_host_flags + CXXCPP + CPP + OTOOL64 +@@ -15144,6 +15145,22 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + # Only expand once: + + ++case $host in ++ *-cygwin* | *-mingw*) ++ # 'host' will be top-level target in the case of a target lib, ++ # we must compare to with_cross_host to decide if this is a native ++ # or cross-compiler and select where to install dlls appropriately. ++ if test -n "$with_cross_host" && ++ test x"$with_cross_host" != x"no"; then ++ lt_host_flags='-no-undefined -bindir "$(toolexeclibdir)"'; ++ else ++ lt_host_flags='-no-undefined -bindir "$(bindir)"'; ++ fi ++ ;; ++ *) ++ lt_host_flags= ++ ;; ++esac + + + +diff --git a/libitm/configure.ac b/libitm/configure.ac +index 2d99b11..6b8ad09 100644 +--- a/libitm/configure.ac ++++ b/libitm/configure.ac +@@ -147,6 +147,7 @@ AM_CONDITIONAL(BUILD_INFO, test $gcc_cv_prog_makeinfo_modern = "yes") + + # Configure libtool + AM_PROG_LIBTOOL ++ACX_LT_HOST_FLAGS + AC_SUBST(enable_shared) + AC_SUBST(enable_static) + +diff --git a/libitm/configure.tgt b/libitm/configure.tgt +index 99da73a..e50b90f 100644 +--- a/libitm/configure.tgt ++++ b/libitm/configure.tgt +@@ -145,6 +145,10 @@ case "${target}" in + # POSIX system. The OS is supported. + ;; + ++ *-*-mingw*) ++ # POSIX system. The OS is supported. ++ ;; ++ + *) # Non-POSIX, or embedded system + UNSUPPORTED=1 + ;; +-- +2.8.1 + diff --git a/mingw-w64-gcc-git/0013-MinGW-w64-Enable-shared-gnat.patch b/mingw-w64-gcc-git/0013-MinGW-w64-Enable-shared-gnat.patch new file mode 100644 index 0000000000..729ba66d9a --- /dev/null +++ b/mingw-w64-gcc-git/0013-MinGW-w64-Enable-shared-gnat.patch @@ -0,0 +1,39 @@ +From 62cb117f54afe79c253e8bf716b56e0adcd81baa Mon Sep 17 00:00:00 2001 +From: LRN +Date: Wed, 5 Aug 2015 23:36:33 +0100 +Subject: [PATCH 13/15] MinGW-w64: Enable shared gnat + +--- + libada/configure | 2 +- + libada/configure.ac | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libada/configure b/libada/configure +index 2296096..ba488e7 100755 +--- a/libada/configure ++++ b/libada/configure +@@ -2956,7 +2956,7 @@ fi + + + # Determine what to build for 'gnatlib' +-if test $build = $target \ ++if test $host = $target \ + && test ${enable_shared} = yes ; then + # Note that build=target is almost certainly the wrong test; FIXME + default_gnatlib_target="gnatlib-shared" +diff --git a/libada/configure.ac b/libada/configure.ac +index d11bfad..d37a771 100644 +--- a/libada/configure.ac ++++ b/libada/configure.ac +@@ -127,7 +127,7 @@ AC_PROG_AWK + AC_PROG_LN_S + + # Determine what to build for 'gnatlib' +-if test $build = $target \ ++if test $host = $target \ + && test ${enable_shared} = yes ; then + # Note that build=target is almost certainly the wrong test; FIXME + default_gnatlib_target="gnatlib-shared" +-- +2.8.1 + diff --git a/mingw-w64-gcc-git/0014-clone_function_name_1-Retain-any-stdcall-suffix.patch b/mingw-w64-gcc-git/0014-clone_function_name_1-Retain-any-stdcall-suffix.patch new file mode 100644 index 0000000000..24f2edbf40 --- /dev/null +++ b/mingw-w64-gcc-git/0014-clone_function_name_1-Retain-any-stdcall-suffix.patch @@ -0,0 +1,112 @@ +From 5b6f6cec837f4c9782bc2f9b6f51c8942ea89585 Mon Sep 17 00:00:00 2001 +From: Ray Donnelly +Date: Mon, 17 Aug 2015 22:57:46 +0100 +Subject: [PATCH 14/15] clone_function_name_1: Retain any stdcall suffix + +Previously, clone_function_name_1 would add a suffix after +any existing stdcall suffix, for example ipa-split.c would +clone test@4 as test@4.part.0. + +Later, i386_pe_strip_name_encoding_full would come along +and strip off everything from the last @ onwards which had +the effect of generating incorrect section names which +would then fall over with errors such as: + +error: void test() causes a section type conflict with \ + void test@4.part.0() + +The following testcase, reduced from Firefox can be used +to reproduce this. + +test.ii: +class ClassA { +public: + virtual int __attribute__((__stdcall__)) Dispatch() = 0; +}; +class ClassB { +public: + ClassA* __attribute__((__stdcall__)) operator->(); +}; +class ClassC : ClassA { + int *some_int_ptr_variable; + int __attribute__((__stdcall__)) Dispatch() { + return some_int_ptr_variable + ? 42 + : m_ClassInstanceB->Dispatch(); + } + ClassB m_ClassInstanceB; +}; +ClassC ClassInstanceC; + +Compile for i686-w64-mingw32 with: +cc1plus -O -fpartial-inlining -fdevirtualize \ + -fdevirtualize-speculatively test.ii + +Outputs: +test.ii: In member function 'virtual int ClassC::Dispatch()': +test.ii:11:36: error: virtual int ClassC::Dispatch() causes \ + a section type conflict with int ClassC::_ZN6ClassC8DispatchEv@4.part.0() + int __attribute__((CALLTYPE)) Dispatch() { + ^ +test.ii:11:36: note: \ + 'int ClassC::_ZN6ClassC8DispatchEv@4.part.0()' was declared here +--- + gcc/cgraphclones.c | 13 ++++++++++++- + gcc/defaults.h | 2 +- + 2 files changed, 13 insertions(+), 2 deletions(-) + +diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c +index 546cac8..2acdd2b 100644 +--- a/gcc/cgraphclones.c ++++ b/gcc/cgraphclones.c +@@ -540,15 +540,24 @@ cgraph_node::create_clone (tree new_decl, gcov_type gcov_count, int freq, + static GTY(()) unsigned int clone_fn_id_num; + + /* Return a new assembler name for a clone with SUFFIX of a decl named +- NAME. */ ++ NAME. Final stdcall @N suffixes are maintained. */ + + tree + clone_function_name_1 (const char *name, const char *suffix) + { + size_t len = strlen (name); + char *tmp_name, *prefix; ++ char *at_suffix = NULL; + + prefix = XALLOCAVEC (char, len + strlen (suffix) + 2); ++ /* name + 1 to skip fastcall which begins with '@' */ ++ at_suffix = strchr (name + 1, '@'); ++ size_t at_suffix_len = 0; ++ if (at_suffix) ++ { ++ at_suffix_len = strlen (at_suffix); ++ len -= at_suffix_len; ++ } + memcpy (prefix, name, len); + strcpy (prefix + len + 1, suffix); + #ifndef NO_DOT_IN_LABEL +@@ -559,6 +568,8 @@ clone_function_name_1 (const char *name, const char *suffix) + prefix[len] = '_'; + #endif + ASM_FORMAT_PRIVATE_NAME (tmp_name, prefix, clone_fn_id_num++); ++ if (at_suffix) ++ strcat (tmp_name, at_suffix); + return get_identifier (tmp_name); + } + +diff --git a/gcc/defaults.h b/gcc/defaults.h +index 1d54798..70e1dfb 100644 +--- a/gcc/defaults.h ++++ b/gcc/defaults.h +@@ -51,7 +51,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + # define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \ + do { const char *const name_ = (NAME); \ + char *const output_ = (OUTPUT) = \ +- (char *) alloca (strlen (name_) + 32); \ ++ (char *) alloca (strlen (name_) + 35); \ + sprintf (output_, ASM_PN_FORMAT, name_, (unsigned long)(LABELNO)); \ + } while (0) + #endif +-- +2.8.1 + diff --git a/mingw-w64-gcc-git/0015-Force-linking-to-libgcc_s_dw2-1.dll-deprecated.patch b/mingw-w64-gcc-git/0015-Force-linking-to-libgcc_s_dw2-1.dll-deprecated.patch new file mode 100644 index 0000000000..d0d5630959 --- /dev/null +++ b/mingw-w64-gcc-git/0015-Force-linking-to-libgcc_s_dw2-1.dll-deprecated.patch @@ -0,0 +1,84 @@ +From f1da5efbf1f96f3648d0e8a7daa79aecf9261e1b Mon Sep 17 00:00:00 2001 +From: Ray Donnelly +Date: Wed, 5 Aug 2015 23:36:39 +0100 +Subject: [PATCH 15/15] Force linking to libgcc_s_dw2-1.dll [deprecated] + +.. by adding to specs: +*libgcc +--undefined=___deregister_frame_info +--undefined=___register_frame_info + +These flags get added twice to the ld command line +because of %G appearing twice in: +*link_gcc_c_sequence +%G %L %G +so this should be tidied up really. + +20150805 update: + +Looking at this again, it seems that the +SHARED_LIBGCC_UNDEFS_SPEC stuff added in commit 7d804f +does the same thing, so my hack may not be needed. It +would appear that for some time, DWARF2_UNWIND_INFO +was not defined, but it's OK now. Latest specs have: +*shared_libgcc_undefs: +%{shared-libgcc: -u ___register_frame_info -u ___deregister_frame_info} +--- + gcc/config/i386/cygwin.h | 6 +++++- + gcc/config/i386/mingw32.h | 8 ++++++-- + 2 files changed, 11 insertions(+), 3 deletions(-) + +diff --git a/gcc/config/i386/cygwin.h b/gcc/config/i386/cygwin.h +index 2186937..7f71ccc 100644 +--- a/gcc/config/i386/cygwin.h ++++ b/gcc/config/i386/cygwin.h +@@ -55,6 +55,10 @@ along with GCC; see the file COPYING3. If not see + fvtable-verify=std:vtv_end.o%s} \ + crtend.o%s" + ++/* There is a bug when building i686 dw-2 exceptions ++ where gcc_s gets stripped which this works around */ ++#define PREVENT_STRIP_REG_FRAME_INFO "--undefined=___deregister_frame_info --undefined=___register_frame_info" ++ + /* Normally, -lgcc is not needed since everything in it is in the DLL, but we + want to allow things to be added to it when installing new versions of + GCC without making a new CYGWIN.DLL, so we leave it. Profiling is handled +@@ -65,7 +69,7 @@ along with GCC; see the file COPYING3. If not see + %{static|static-libgcc:-lgcc -lgcc_eh} \ + %{!static: \ + %{!static-libgcc: \ +- -lgcc_s -lgcc \ ++ -lgcc_s " PREVENT_STRIP_REG_FRAME_INFO " -lgcc \ + } \ + } " + #else +diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h +index 0950304..ca73137 100644 +--- a/gcc/config/i386/mingw32.h ++++ b/gcc/config/i386/mingw32.h +@@ -120,6 +120,10 @@ along with GCC; see the file COPYING3. If not see + %{shared|mdll: " SUB_LINK_ENTRY " --enable-auto-image-base} \ + %(shared_libgcc_undefs)" + ++/* There is a bug when building i686 dw-2 exceptions ++ where gcc_s gets stripped which this works around */ ++#define PREVENT_STRIP_REG_FRAME_INFO "--undefined=___deregister_frame_info --undefined=___register_frame_info" ++ + /* Include in the mingw32 libraries with libgcc */ + #ifdef ENABLE_SHARED_LIBGCC + #define SHARED_LIBGCC_SPEC " \ +@@ -128,9 +132,9 @@ along with GCC; see the file COPYING3. If not see + %{!static-libgcc: \ + %{!shared: \ + %{!shared-libgcc:-lgcc -lgcc_eh} \ +- %{shared-libgcc:-lgcc_s -lgcc} \ ++ %{shared-libgcc:-lgcc_s " PREVENT_STRIP_REG_FRAME_INFO " -lgcc} \ + } \ +- %{shared:-lgcc_s -lgcc} \ ++ %{shared:-lgcc_s " PREVENT_STRIP_REG_FRAME_INFO " -lgcc} \ + } \ + } " + #else +-- +2.8.1 +