From d06d30552c0d66cb2b7d92dca74886ac506e30cf Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Mon, 4 Dec 2017 23:56:27 -0600 Subject: Fix build with GCC 6 --- ...in-only-expose-dev-con-in-out-sole-when-s.patch | 33 ++++++++++ 0002-cygwin-workaround-GCC-6-changes.patch | 70 ++++++++++++++++++++++ cygwin.spec | 9 ++- 3 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 0001-Revert-cygwin-only-expose-dev-con-in-out-sole-when-s.patch create mode 100644 0002-cygwin-workaround-GCC-6-changes.patch diff --git a/0001-Revert-cygwin-only-expose-dev-con-in-out-sole-when-s.patch b/0001-Revert-cygwin-only-expose-dev-con-in-out-sole-when-s.patch new file mode 100644 index 0000000..4d1e639 --- /dev/null +++ b/0001-Revert-cygwin-only-expose-dev-con-in-out-sole-when-s.patch @@ -0,0 +1,33 @@ +From 21a39b20a53d6c26959296765a7006af377ce37b Mon Sep 17 00:00:00 2001 +From: Yaakov Selkowitz +Date: Mon, 11 Sep 2017 13:21:46 -0500 +Subject: [PATCH] Revert "cygwin: only expose /dev/con{in,out,sole} when + started from a Windows console" + +This caused serious regressions when running from a cmd window: + +https://cygwin.com/ml/cygwin/2017-09/msg00114.html + +This reverts commit b706c6b479422d31f0124b92c21b4cb536bbddff. + +Signed-off-by: Yaakov Selkowitz +--- + winsup/cygwin/fhandler.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h +index cd73e6e87..153e3847f 100644 +--- a/winsup/cygwin/fhandler.h ++++ b/winsup/cygwin/fhandler.h +@@ -1439,7 +1439,7 @@ private: + ssize_t __stdcall write (const void *ptr, size_t len); + void doecho (const void *str, DWORD len) { (void) write (str, len); } + int close (); +- static bool exists () {return shared_console_info && !!GetConsoleCP ();} ++ static bool exists () {return !!GetConsoleCP ();} + + int tcflush (int); + int tcsetattr (int a, const struct termios *t); +-- +2.14.1 + diff --git a/0002-cygwin-workaround-GCC-6-changes.patch b/0002-cygwin-workaround-GCC-6-changes.patch new file mode 100644 index 0000000..f078e4e --- /dev/null +++ b/0002-cygwin-workaround-GCC-6-changes.patch @@ -0,0 +1,70 @@ +From 05cfd1aed8b262e82f62acc2de2858d2d2b6679c Mon Sep 17 00:00:00 2001 +From: Yaakov Selkowitz +Date: Tue, 12 Sep 2017 14:30:34 -0500 +Subject: [PATCH] cygwin: workaround GCC 6 changes + +GCC 6 includes a number of new warnings which cause Cygwin to either not +compile, or not work properly even if said warnings are ignored: + +https://cygwin.com/ml/cygwin-developers/2017-09/msg00000.html +https://gcc.gnu.org/gcc-6/porting_to.html + +For now, we use the flags necessary to revert to GCC 5 behaviour until we +can fix the code properly. + +Signed-off-by: Yaakov Selkowitz +--- + winsup/cygwin/Makefile.in | 4 ++-- + winsup/cygwin/crt0.c | 2 ++ + winsup/cygwin/init.cc | 2 ++ + 3 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in +index 10e6b1f81..98727c019 100644 +--- a/winsup/cygwin/Makefile.in ++++ b/winsup/cygwin/Makefile.in +@@ -73,11 +73,11 @@ CRT0:=$(cygwin_build)/crt0.o + # + MT_SAFE:=@MT_SAFE@ + CCEXTRA= +-COMMON_CFLAGS=-MMD ${$(*F)_CFLAGS} -Werror -fmerge-constants -ftracer $(CCEXTRA) ++COMMON_CFLAGS=-MMD ${$(*F)_CFLAGS} -Werror -fno-delete-null-pointer-checks -fmerge-constants -ftracer $(CCEXTRA) + ifeq ($(target_cpu),x86_64) + COMMON_CFLAGS+=-mcmodel=small + endif +-COMPILE.cc+=${COMMON_CFLAGS} ++COMPILE.cc+=${COMMON_CFLAGS} -std=gnu++98 + COMPILE.c+=${COMMON_CFLAGS} + + AR:=@AR@ +diff --git a/winsup/cygwin/crt0.c b/winsup/cygwin/crt0.c +index f0103b4ca..271f5b911 100644 +--- a/winsup/cygwin/crt0.c ++++ b/winsup/cygwin/crt0.c +@@ -20,7 +20,9 @@ void + mainCRTStartup () + { + #ifdef __i386__ ++#pragma GCC diagnostic ignored "-Wframe-address" + (void)__builtin_return_address(1); ++#pragma GCC diagnostic pop + asm volatile ("andl $-16,%%esp" ::: "%esp"); + #endif + +diff --git a/winsup/cygwin/init.cc b/winsup/cygwin/init.cc +index 5b84b1cc0..2d4299e5b 100644 +--- a/winsup/cygwin/init.cc ++++ b/winsup/cygwin/init.cc +@@ -23,7 +23,9 @@ static void WINAPI + threadfunc_fe (VOID *arg) + { + #ifndef __x86_64__ ++#pragma GCC diagnostic ignored "-Wframe-address" + (void)__builtin_return_address(1); ++#pragma GCC diagnostic pop + asm volatile ("andl $-16,%%esp" ::: "%esp"); + #endif + _cygtls::call ((DWORD (*) (void *, void *)) TlsGetValue (_my_oldfunc), arg); +-- +2.14.1 + diff --git a/cygwin.spec b/cygwin.spec index 3f06561..0b0fa60 100644 --- a/cygwin.spec +++ b/cygwin.spec @@ -2,7 +2,7 @@ Name: cygwin Version: 2.9.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Cygwin cross-compiler runtime License: LGPLv3+ and GPLv3+ @@ -12,6 +12,8 @@ BuildArch: noarch # downloaded and extracted by get-sources.sh Source0: newlib-cygwin-%{version}.tar.bz2 +Patch1: 0001-Revert-cygwin-only-expose-dev-con-in-out-sole-when-s.patch +Patch2: 0002-cygwin-workaround-GCC-6-changes.patch BuildRequires: cygwin32-filesystem >= 7 BuildRequires: cygwin32-binutils @@ -64,6 +66,8 @@ Cygwin 64-bit cross-compiler runtime, base libraries. %prep %setup -q -n newlib-cygwin +%patch1 -p1 +%patch2 -p1 touch winsup/cygwin/tlsoffsets*.h touch winsup/cygwin/devices.cc @@ -132,6 +136,9 @@ rm -fr $RPM_BUILD_ROOT%{cygwin64_includedir}/rpc/ %changelog +* Tue Dec 05 2017 Yaakov Selkowitz - 2.9.0-2 +- Fix build with GCC 6 + * Sun Dec 03 2017 Yaakov Selkowitz - 2.9.0-1 - new version -- cgit