summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYaakov Selkowitz <yselkowi@redhat.com>2016-03-30 17:10:57 -0500
committerYaakov Selkowitz <yselkowi@redhat.com>2016-03-30 17:10:57 -0500
commit94469c1b9b5939888478f49b3c3dfc2f66014fe2 (patch)
tree0f48e754a6864eec723d2f7e64e9967f6f1c0a86
parent6f8787a3f9deab06ee876881911a167d11f13ffb (diff)
downloadcygwin-94469c1b9b5939888478f49b3c3dfc2f66014fe2.tar.gz
cygwin-94469c1b9b5939888478f49b3c3dfc2f66014fe2.tar.xz
cygwin-94469c1b9b5939888478f49b3c3dfc2f66014fe2.zip
Fix build with GCC 5
-rw-r--r--0001-Fix-compile-with-GCC-5-Werror.patch73
-rw-r--r--0002-Remove-broken-ieeefp.h-macros.patch54
-rw-r--r--0003-cygwin-fix-errors-with-GCC-5.patch83
-rw-r--r--0004-cygwin-work-around-GCC-5-preprocessor-changes.patch32
-rw-r--r--cygwin.spec14
5 files changed, 255 insertions, 1 deletions
diff --git a/0001-Fix-compile-with-GCC-5-Werror.patch b/0001-Fix-compile-with-GCC-5-Werror.patch
new file mode 100644
index 0000000..c1975e1
--- /dev/null
+++ b/0001-Fix-compile-with-GCC-5-Werror.patch
@@ -0,0 +1,73 @@
+From 8b8952064cfacf91b18aed37fbd44f621edb6941 Mon Sep 17 00:00:00 2001
+From: Yaakov Selkowitz <yselkowi@redhat.com>
+Date: Thu, 11 Feb 2016 20:16:06 -0600
+Subject: [PATCH 1/4] Fix compile with GCC 5 -Werror
+
+ newlib/libc/
+ * stdio64/freopen64.c: Include <string.h> for memset().
+ * stdlib/quick_exit.c: Include <unistd.h> for _exit().
+ * string/gnu_basename.c (__gnu_basename): Fix discarded const
+ qualifier warning.
+ * stdlib/strtold.c: Include "mprec.h" for _strtorx_r().
+
+Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
+---
+ newlib/libc/stdio64/freopen64.c | 1 +
+ newlib/libc/stdlib/quick_exit.c | 1 +
+ newlib/libc/stdlib/strtold.c | 2 ++
+ newlib/libc/string/gnu_basename.c | 2 +-
+ 4 files changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/newlib/libc/stdio64/freopen64.c b/newlib/libc/stdio64/freopen64.c
+index 8a069d5..f7df354 100644
+--- a/newlib/libc/stdio64/freopen64.c
++++ b/newlib/libc/stdio64/freopen64.c
+@@ -74,6 +74,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
+
+ #include <time.h>
+ #include <stdio.h>
++#include <string.h>
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <stdlib.h>
+diff --git a/newlib/libc/stdlib/quick_exit.c b/newlib/libc/stdlib/quick_exit.c
+index fc43571..1d6fb23 100644
+--- a/newlib/libc/stdlib/quick_exit.c
++++ b/newlib/libc/stdlib/quick_exit.c
+@@ -28,6 +28,7 @@
+ */
+
+ #include <stdlib.h>
++#include <unistd.h>
+ #include <sys/lock.h>
+
+ /**
+diff --git a/newlib/libc/stdlib/strtold.c b/newlib/libc/stdlib/strtold.c
+index 96254eb..a6d415d 100644
+--- a/newlib/libc/stdlib/strtold.c
++++ b/newlib/libc/stdlib/strtold.c
+@@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
+
+ #include <stdlib.h>
+ #include "local.h"
++#include "mprec.h"
++#undef FLT_ROUNDS
+
+ #ifdef _HAVE_LONG_DOUBLE
+
+diff --git a/newlib/libc/string/gnu_basename.c b/newlib/libc/string/gnu_basename.c
+index 46b92d0..90e22cc 100644
+--- a/newlib/libc/string/gnu_basename.c
++++ b/newlib/libc/string/gnu_basename.c
+@@ -20,7 +20,7 @@ _DEFUN (__gnu_basename, (path),
+ char *p;
+ if ((p = strrchr (path, '/')))
+ return p + 1;
+- return path;
++ return (char *) path;
+ }
+
+ #endif /* !_NO_BASENAME */
+--
+2.7.4
+
diff --git a/0002-Remove-broken-ieeefp.h-macros.patch b/0002-Remove-broken-ieeefp.h-macros.patch
new file mode 100644
index 0000000..c1c5f8f
--- /dev/null
+++ b/0002-Remove-broken-ieeefp.h-macros.patch
@@ -0,0 +1,54 @@
+From ac2f9e23ecd197758e7cc2ca1b8717add3d8762b Mon Sep 17 00:00:00 2001
+From: Yaakov Selkowitz <yselkowi@redhat.com>
+Date: Thu, 11 Feb 2016 20:23:10 -0600
+Subject: [PATCH 2/4] Remove broken ieeefp.h macros
+
+Any attempt to use isnanf, isinff, or finitef from <ieeefp.h> with
+GCC 5 on platforms other than SPU result in a "lvalue required as
+unary '&' operand" error.
+
+ newlib/libc/
+ * include/ieeefp.h (__ieeefp_isnanf): Remove broken macro.
+ (__ieeefp_isinff, __ieeefp_finitef): Ditto.
+
+Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
+---
+ newlib/libc/include/ieeefp.h | 17 ++++++-----------
+ 1 file changed, 6 insertions(+), 11 deletions(-)
+
+diff --git a/newlib/libc/include/ieeefp.h b/newlib/libc/include/ieeefp.h
+index 9eb274d..2ffa456 100644
+--- a/newlib/libc/include/ieeefp.h
++++ b/newlib/libc/include/ieeefp.h
+@@ -270,22 +270,17 @@ int _EXFUN(finitef, (float));
+ #define __IEEE_DBL_NAN_EXP 0x7ff
+ #define __IEEE_FLT_NAN_EXP 0xff
+
+-#ifndef __ieeefp_isnanf
+-#define __ieeefp_isnanf(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \
+- ((*(long *)&(x) & 0x007fffffL)!=0000000000L))
+-#endif
++#ifdef __ieeefp_isnanf
+ #define isnanf(x) __ieeefp_isnanf(x)
+-
+-#ifndef __ieeefp_isinff
+-#define __ieeefp_isinff(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \
+- ((*(long *)&(x) & 0x007fffffL)==0000000000L))
+ #endif
+-#define isinff(x) __ieeefp_isinff(x)
+
+-#ifndef __ieeefp_finitef
+-#define __ieeefp_finitef(x) (((*(long *)&(x) & 0x7f800000L)!=0x7f800000L))
++#ifdef __ieeefp_isinff
++#define isinff(x) __ieeefp_isinff(x)
+ #endif
++
++#ifdef __ieeefp_finitef
+ #define finitef(x) __ieeefp_finitef(x)
++#endif
+
+ #ifdef _DOUBLE_IS_32BITS
+ #undef __IEEE_DBL_EXPBIAS
+--
+2.7.4
+
diff --git a/0003-cygwin-fix-errors-with-GCC-5.patch b/0003-cygwin-fix-errors-with-GCC-5.patch
new file mode 100644
index 0000000..36b0311
--- /dev/null
+++ b/0003-cygwin-fix-errors-with-GCC-5.patch
@@ -0,0 +1,83 @@
+From c5f03820fc4f8c9910f52ab2ef951a6e32ed3ff1 Mon Sep 17 00:00:00 2001
+From: Yaakov Selkowitz <yselkowi@redhat.com>
+Date: Fri, 12 Feb 2016 11:17:35 -0600
+Subject: [PATCH 3/4] cygwin: fix errors with GCC 5
+
+GCC 5 switched from C89 to C11 by default. This implies a change from
+GNU to C99 inline by default, which have very different meanings of
+extern inline vs. static inline:
+
+https://gcc.gnu.org/onlinedocs/gcc/Inline.html
+
+Marking these as gnu_inline retains the previous behaviour.
+
+ winsup/cygwin/
+ * exceptions.cc (exception::handle): Change debugging to int to fix
+ an always-true boolean comparison warning.
+ * include/cygwin/config.h (__getreent): Mark gnu_inline.
+ * winbase.h (ilockcmpexch, ilockcmpexch64): Ditto.
+
+Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
+---
+ winsup/cygwin/exceptions.cc | 4 ++--
+ winsup/cygwin/include/cygwin/config.h | 1 +
+ winsup/cygwin/winbase.h | 2 ++
+ 3 files changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
+index c3a45d2..1627d43 100644
+--- a/winsup/cygwin/exceptions.cc
++++ b/winsup/cygwin/exceptions.cc
+@@ -637,7 +637,7 @@ EXCEPTION_DISPOSITION
+ exception::handle (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in,
+ PDISPATCHER_CONTEXT dispatch)
+ {
+- static bool NO_COPY debugging;
++ static int NO_COPY debugging = 0;
+ _cygtls& me = _my_tls;
+
+ #ifndef __x86_64__
+@@ -808,7 +808,7 @@ exception::handle (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in,
+ rtl_unwind (frame, e);
+ else
+ {
+- debugging = true;
++ debugging = 1;
+ return ExceptionContinueExecution;
+ }
+
+diff --git a/winsup/cygwin/include/cygwin/config.h b/winsup/cygwin/include/cygwin/config.h
+index 58cff05..204826d 100644
+--- a/winsup/cygwin/include/cygwin/config.h
++++ b/winsup/cygwin/include/cygwin/config.h
+@@ -43,6 +43,7 @@ extern "C" {
+ #else
+ #include "../tlsoffsets.h"
+ #endif
++__attribute__((gnu_inline))
+ extern inline struct _reent *__getreent (void)
+ {
+ register char *ret;
+diff --git a/winsup/cygwin/winbase.h b/winsup/cygwin/winbase.h
+index 666f74a..1e825e4 100644
+--- a/winsup/cygwin/winbase.h
++++ b/winsup/cygwin/winbase.h
+@@ -11,6 +11,7 @@ details. */
+ #ifndef _WINBASE2_H
+ #define _WINBASE2_H
+
++__attribute__((gnu_inline))
+ extern __inline__ LONG
+ ilockcmpexch (volatile LONG *t, LONG v, LONG c)
+ {
+@@ -30,6 +31,7 @@ ilockcmpexch (volatile LONG *t, LONG v, LONG c)
+ #undef InterlockedCompareExchangePointer
+
+ #ifdef __x86_64__
++__attribute__((gnu_inline))
+ extern __inline__ LONGLONG
+ ilockcmpexch64 (volatile LONGLONG *t, LONGLONG v, LONGLONG c)
+ {
+--
+2.7.4
+
diff --git a/0004-cygwin-work-around-GCC-5-preprocessor-changes.patch b/0004-cygwin-work-around-GCC-5-preprocessor-changes.patch
new file mode 100644
index 0000000..691d997
--- /dev/null
+++ b/0004-cygwin-work-around-GCC-5-preprocessor-changes.patch
@@ -0,0 +1,32 @@
+From ef64aa4940e1d9120875a74f37b8419680f535e3 Mon Sep 17 00:00:00 2001
+From: Yaakov Selkowitz <yselkowi@redhat.com>
+Date: Fri, 12 Feb 2016 16:02:13 -0600
+Subject: [PATCH 4/4] cygwin: work around GCC 5 preprocessor changes
+
+GCC 5 adds #line directives (and hence extra newlines) for macros
+expansions, which confuses cygmagic. Using the -P flag avoids
+them entirely.
+
+https://cygwin.com/ml/cygwin-patches/2016-q1/msg00016.html
+
+Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
+---
+ winsup/cygwin/cygmagic | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/winsup/cygwin/cygmagic b/winsup/cygwin/cygmagic
+index b945291..036c79c 100755
+--- a/winsup/cygwin/cygmagic
++++ b/winsup/cygwin/cygmagic
+@@ -24,7 +24,7 @@ sumit() {
+ while [ -n "$1" ]; do
+ define=$1; shift
+ struct=$1; shift
+- sum=`$gcc -D__CYGMAGIC__ -E $file | sed -n "/^$struct/,/^};/p" | sed -e 's/[ ]//g' -e '/^$/d' | sumit | awk '{printf "0x%xU", $1}'`
++ sum=`$gcc -D__CYGMAGIC__ -E -P $file | sed -n "/^$struct/,/^};/p" | sed -e 's/[ ]//g' -e '/^$/d' | sumit | awk '{printf "0x%xU", $1}'`
+ echo "#define $define $sum"
+ curr=`sed -n "s/^#[ ]*define CURR_$define[ ][ ]*\([^ ][^ ]*\)/\1/p" $file`
+ [ "$curr" != "$sum" ] && echo "*** WARNING WARNING WARNING WARNING WARNING ***
+--
+2.7.4
+
diff --git a/cygwin.spec b/cygwin.spec
index 31e8229..8efb79b 100644
--- a/cygwin.spec
+++ b/cygwin.spec
@@ -2,7 +2,7 @@
Name: cygwin
Version: 2.4.1
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Cygwin cross-compiler runtime
License: GPLv2 with exceptions
@@ -12,6 +12,11 @@ BuildArch: noarch
# downloaded and extracted by get-sources.sh
Source0: newlib-cygwin-%{version}.tar.bz2
+# GCC 5 patches
+Patch1: 0001-Fix-compile-with-GCC-5-Werror.patch
+Patch2: 0002-Remove-broken-ieeefp.h-macros.patch
+Patch3: 0003-cygwin-fix-errors-with-GCC-5.patch
+Patch4: 0004-cygwin-work-around-GCC-5-preprocessor-changes.patch
BuildRequires: cygwin32-filesystem >= 7
BuildRequires: cygwin32-binutils
@@ -65,6 +70,10 @@ Cygwin 64-bit cross-compiler runtime, base libraries.
%prep
%setup -q -n newlib-cygwin
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
touch winsup/cygwin/tlsoffsets*.h
touch winsup/cygwin/devices.cc
@@ -141,6 +150,9 @@ rm -fr $RPM_BUILD_ROOT%{cygwin64_includedir}/rpc/
%changelog
+* Wed Mar 30 2016 Yaakov Selkowitz <yselkowi@redhat.com> - 2.4.1-2
+- Fix build with GCC 5
+
* Sun Feb 21 2016 Yaakov Selkowitz <yselkowi@redhat.com> - 2.4.1-1
- new version