diff options
| author | Yaakov Selkowitz <yselkowi@redhat.com> | 2020-04-01 17:30:17 -0400 |
|---|---|---|
| committer | Yaakov Selkowitz <yselkowi@redhat.com> | 2020-04-01 17:30:17 -0400 |
| commit | 44b406bb3e37f4e9138e65032c2e00a16bec57ca (patch) | |
| tree | 85f379af841863f52242c04cd1c5e63da820eb80 | |
| parent | 2880e0e6dbd4740d07257e3c17421c7807c24ad3 (diff) | |
| download | cygwin-44b406bb3e37f4e9138e65032c2e00a16bec57ca.tar.gz cygwin-44b406bb3e37f4e9138e65032c2e00a16bec57ca.tar.xz cygwin-44b406bb3e37f4e9138e65032c2e00a16bec57ca.zip | |
Cherry-pick GCC 9 fixes
6 files changed, 294 insertions, 1 deletions
diff --git a/0001-Cygwin-posix-timers-fix-uninitialized-variable.patch b/0001-Cygwin-posix-timers-fix-uninitialized-variable.patch new file mode 100644 index 0000000..c282d0d --- /dev/null +++ b/0001-Cygwin-posix-timers-fix-uninitialized-variable.patch @@ -0,0 +1,36 @@ +From 0220f0dd9439a96da1fdd82a03c6a3041f9d31ad Mon Sep 17 00:00:00 2001 +From: Corinna Vinschen <corinna@vinschen.de> +Date: Wed, 26 Feb 2020 16:50:34 +0100 +Subject: [PATCH 1/4] Cygwin: posix timers: fix uninitialized variable + +The variable returning the overrun count from the tracker object after +disarming the overrun counter was not correctly initialized. For some +reason this has only been noticed by gcc-9.2.0, not by the formerly used +gcc-7.4.0. + +This problem should not have had any runtime impact. The method +timer_tracker::disarm_overrun_event is supposed to be called in +lock-step with timer_tracker::arm_overrun_event, which in turn +results in the variable getting a valid value. + +Signed-off-by: Corinna Vinschen <corinna@vinschen.de> +--- + winsup/cygwin/posix_timer.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/winsup/cygwin/posix_timer.cc b/winsup/cygwin/posix_timer.cc +index c0d548fe9..75cd4fa60 100644 +--- a/winsup/cygwin/posix_timer.cc ++++ b/winsup/cygwin/posix_timer.cc +@@ -81,7 +81,7 @@ timer_tracker::arm_overrun_event (LONG64 exp_cnt) + LONG + timer_tracker::disarm_overrun_event () + { +- LONG ret; ++ LONG ret = 0; + + AcquireSRWLockExclusive (&srwlock); + if (overrun_count != OVR_DISARMED) +-- +2.25.1 + diff --git a/0002-Cygwin-Makefile.in-add-fno-builtin-execve-CFLAG-when.patch b/0002-Cygwin-Makefile.in-add-fno-builtin-execve-CFLAG-when.patch new file mode 100644 index 0000000..31a11f4 --- /dev/null +++ b/0002-Cygwin-Makefile.in-add-fno-builtin-execve-CFLAG-when.patch @@ -0,0 +1,39 @@ +From 2a218e4fe58f01ad7bfd112b4ddc050c67f1cc82 Mon Sep 17 00:00:00 2001 +From: Corinna Vinschen <corinna@vinschen.de> +Date: Wed, 26 Feb 2020 17:02:01 +0100 +Subject: [PATCH 2/4] Cygwin: Makefile.in: add -fno-builtin-execve CFLAG when + building exec.o + +gcc-9.2.0 has an execve builtin which uses the nothrow attribute. +This results in an error when aliasing execve to _execve for newlib: + +exec.cc:88:23: error: 'int _execve(const char*, char* const*, char* +const*)' specifies less restrictive attribute than its target +'int execve(const char*, char* const*, char* const*)': 'nothrow' +[-Werror=missing-attributes] + 88 | EXPORT_ALIAS (execve, _execve) /* For newlib */ + +Add the -fno-builtin-execve CFLAGS when building exec.o to override +the gcc builtin. + +Signed-off-by: Corinna Vinschen <corinna@vinschen.de> +--- + winsup/cygwin/Makefile.in | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in +index ca0633eb8..f273ba793 100644 +--- a/winsup/cygwin/Makefile.in ++++ b/winsup/cygwin/Makefile.in +@@ -567,6 +567,8 @@ ifeq ($(target_cpu),i686) + exceptions_CFLAGS:=-fno-omit-frame-pointer + endif + endif ++# required since gcc 9.x ++exec_CFLAGS:=-fno-builtin-execve + + fhandler_proc_CFLAGS+=-DUSERNAME="\"$(USER)\"" -DHOSTNAME="\"$(HOSTNAME)\"" + fhandler_proc_CFLAGS+=-DGCC_VERSION="\"`$(CC) -v 2>&1 | tail -n 1`\"" +-- +2.25.1 + diff --git a/0003-Cygwin-cygserver-drop-useless-packed-attribute.patch b/0003-Cygwin-cygserver-drop-useless-packed-attribute.patch new file mode 100644 index 0000000..cf6e2cb --- /dev/null +++ b/0003-Cygwin-cygserver-drop-useless-packed-attribute.patch @@ -0,0 +1,66 @@ +From 8e4919d4b289e73af1a69f5a3bee01a59aa6c3af Mon Sep 17 00:00:00 2001 +From: Corinna Vinschen <corinna@vinschen.de> +Date: Wed, 26 Feb 2020 20:52:55 +0100 +Subject: [PATCH 3/4] Cygwin: cygserver: drop useless packed attribute + +...from structs used for data exchange between clients and cygserver. +All of the structs have the same size and member offsets, packed or +unpacked. Keeping the packed attribute results in ominous warnings +from gcc-9.2.0: + + cygserver.cc:259:10: warning: taking address of packed member of + 'client_request_attach_tty::request_attach_tty' may result in an + unaligned pointer value [-Waddress-of-packed-member] + +Signed-off-by: Corinna Vinschen <corinna@vinschen.de> +--- + winsup/cygwin/cygserver.h | 12 +++--------- + 1 file changed, 3 insertions(+), 9 deletions(-) + +diff --git a/winsup/cygwin/cygserver.h b/winsup/cygwin/cygserver.h +index 9de8c4470..2788fa377 100644 +--- a/winsup/cygwin/cygserver.h ++++ b/winsup/cygwin/cygserver.h +@@ -11,12 +11,6 @@ details. */ + #ifndef _CYGSERVER_H_ + #define _CYGSERVER_H_ + +-#ifdef __GNUC__ +-#define CYGSERVER_PACKED __attribute__ ((packed)) +-#else +-#define CYGSERVER_PACKED +-#endif +- + #define CYGWIN_SERVER_VERSION_MAJOR 1 + #define CYGWIN_SERVER_VERSION_API 4 + #define CYGWIN_SERVER_VERSION_MINOR 0 +@@ -65,7 +59,7 @@ protected: + + header_t () {}; + header_t (request_code_t, size_t); +- } CYGSERVER_PACKED; ++ }; + + public: + #ifndef __INSIDE_CYGWIN__ +@@ -111,7 +105,7 @@ private: + struct request_get_version + { + DWORD major, api, minor, patch; +- } CYGSERVER_PACKED; ++ }; + + public: + client_request_get_version (); +@@ -156,7 +150,7 @@ private: + { + DWORD pid, master_pid; + HANDLE from_master, to_master; +- } CYGSERVER_PACKED; ++ }; + + public: + #ifdef __INSIDE_CYGWIN__ +-- +2.25.1 + diff --git a/0004-Cygwin-32-bit-remove-old-code-to-16-bit-align-stack.patch b/0004-Cygwin-32-bit-remove-old-code-to-16-bit-align-stack.patch new file mode 100644 index 0000000..f9426d9 --- /dev/null +++ b/0004-Cygwin-32-bit-remove-old-code-to-16-bit-align-stack.patch @@ -0,0 +1,82 @@ +From f553a65d0c330530b45bcebc9b8f0c6fa5c182dc Mon Sep 17 00:00:00 2001 +From: Corinna Vinschen <corinna@vinschen.de> +Date: Fri, 28 Feb 2020 14:31:56 +0100 +Subject: [PATCH 4/4] Cygwin: 32 bit: remove old code to 16 bit align stack + +Aligning the stack pointer using an asm statement isn't any longer +supported. gcc-9.2.0 generates the following warning: + + init.cc:33:46: error: listing the stack pointer register '%esp' + in a clobber list is deprecated [-Werror=deprecated] + [...] + init.cc:33:46: note: the value of the stack pointer after an + 'asm' statement must be the same as it was before the statement + +Replace the asm expression with the gcc function attribute +`force_align_arg_pointer'. This aligns the stack exactly as +required. + +Signed-off-by: Corinna Vinschen <corinna@vinschen.de> +--- + winsup/cygwin/crt0.c | 14 +++----------- + winsup/cygwin/init.cc | 13 +++---------- + 2 files changed, 6 insertions(+), 21 deletions(-) + +diff --git a/winsup/cygwin/crt0.c b/winsup/cygwin/crt0.c +index fee4b2e24..ec7959a0f 100644 +--- a/winsup/cygwin/crt0.c ++++ b/winsup/cygwin/crt0.c +@@ -16,20 +16,12 @@ extern int main (int argc, char **argv); + + void cygwin_crt0 (int (*main) (int, char **)); + ++#ifdef __i386__ ++__attribute__ ((force_align_arg_pointer)) ++#endif + void + mainCRTStartup () + { +-#ifdef __i386__ +-#if __GNUC_PREREQ(6,0) +-#pragma GCC diagnostic ignored "-Wframe-address" +-#endif +- (void)__builtin_return_address(1); +-#if __GNUC_PREREQ(6,0) +-#pragma GCC diagnostic pop +-#endif +- asm volatile ("andl $-16,%%esp" ::: "%esp"); +-#endif +- + cygwin_crt0 (main); + + /* These are never actually called. They are just here to force the inclusion +diff --git a/winsup/cygwin/init.cc b/winsup/cygwin/init.cc +index 851a7ffed..7787b164c 100644 +--- a/winsup/cygwin/init.cc ++++ b/winsup/cygwin/init.cc +@@ -19,19 +19,12 @@ unsigned threadfunc_ix[8]; + static bool dll_finished_loading; + #define OLDFUNC_OFFSET -1 + ++#ifdef __i386__ ++__attribute__ ((force_align_arg_pointer)) ++#endif + static void WINAPI + threadfunc_fe (VOID *arg) + { +-#ifdef __i386__ +-#if __GNUC_PREREQ(6,0) +-#pragma GCC diagnostic ignored "-Wframe-address" +-#endif +- (void)__builtin_return_address(1); +-#if __GNUC_PREREQ(6,0) +-#pragma GCC diagnostic pop +-#endif +- asm volatile ("andl $-16,%%esp" ::: "%esp"); +-#endif + _cygtls::call ((DWORD (*) (void *, void *)) TlsGetValue (_my_oldfunc), arg); + } + +-- +2.25.1 + diff --git a/0005-winsup-cygwin-remove-defines-added-in-mingw-w64-v7.0.patch b/0005-winsup-cygwin-remove-defines-added-in-mingw-w64-v7.0.patch new file mode 100644 index 0000000..686108f --- /dev/null +++ b/0005-winsup-cygwin-remove-defines-added-in-mingw-w64-v7.0.patch @@ -0,0 +1,63 @@ +From 6b9c6e1f245cac219ee3604d1e2cd673e380a1b9 Mon Sep 17 00:00:00 2001 +From: Biswapriyo Nath <nathbappai@gmail.com> +Date: Wed, 1 Apr 2020 11:20:00 +0530 +Subject: [PATCH 5/5] winsup/cygwin: remove defines added in mingw-w64 v7.0.0 + +Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com> +--- + winsup/cygwin/mmap.cc | 3 --- + winsup/cygwin/uinfo.cc | 3 --- + winsup/cygwin/winlean.h | 11 ----------- + 3 files changed, 17 deletions(-) + +diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc +index d8ef037f0..662489c8c 100644 +--- a/winsup/cygwin/mmap.cc ++++ b/winsup/cygwin/mmap.cc +@@ -1466,9 +1466,6 @@ munlock (const void *addr, size_t len) + return ret; + } + +-/* This is required until Mingw-w64 catches up with newer functions. */ +-extern "C" WINAPI DWORD DiscardVirtualMemory (PVOID, SIZE_T); +- + extern "C" int + posix_madvise (void *addr, size_t len, int advice) + { +diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc +index bfcce00da..2d5de359b 100644 +--- a/winsup/cygwin/uinfo.cc ++++ b/winsup/cygwin/uinfo.cc +@@ -1912,9 +1912,6 @@ pwdgrp::construct_sid_from_name (cygsid &sid, wchar_t *name, wchar_t *sep) + return false; + } + +-/* CV 2018-08-28: SidTypeLogonSession is not yet defined in Mingw64. */ +-#define SidTypeLogonSession 11 +- + char * + pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, cyg_ldap *pldap) + { +diff --git a/winsup/cygwin/winlean.h b/winsup/cygwin/winlean.h +index 3d79a92e4..a8c961770 100644 +--- a/winsup/cygwin/winlean.h ++++ b/winsup/cygwin/winlean.h +@@ -94,15 +94,4 @@ details. */ + #define GetWindowsDirectoryW dont_use_GetWindowsDirectory + #define GetWindowsDirectoryA dont_use_GetWindowsDirectory + +-/* For console with xterm compatible mode */ +-/* Not yet defined in Mingw-w64 */ +-#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING +-#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004 +-#endif /* ENABLE_VIRTUAL_TERMINAL_PROCESSING */ +-#ifndef ENABLE_VIRTUAL_TERMINAL_INPUT +-#define ENABLE_VIRTUAL_TERMINAL_INPUT 0x0200 +-#endif /* ENABLE_VIRTUAL_TERMINAL_INPUT */ +-#ifndef DISABLE_NEWLINE_AUTO_RETURN +-#define DISABLE_NEWLINE_AUTO_RETURN 0x0008 +-#endif /* DISABLE_NEWLINE_AUTO_RETURN */ + #endif /*_WINLEAN_H*/ +-- +2.25.1 + diff --git a/cygwin.spec b/cygwin.spec index 81470d6..dbaaccc 100644 --- a/cygwin.spec +++ b/cygwin.spec @@ -12,6 +12,13 @@ BuildArch: noarch # downloaded and extracted by get-sources.sh Source0: newlib-cygwin-%{version}.tar.bz2 +# GCC 9 fixes +Patch1: 0001-Cygwin-posix-timers-fix-uninitialized-variable.patch +Patch2: 0002-Cygwin-Makefile.in-add-fno-builtin-execve-CFLAG-when.patch +Patch3: 0003-Cygwin-cygserver-drop-useless-packed-attribute.patch +Patch4: 0004-Cygwin-32-bit-remove-old-code-to-16-bit-align-stack.patch +# MinGW-w64 7.0 fixes +Patch5: 0005-winsup-cygwin-remove-defines-added-in-mingw-w64-v7.0.patch BuildRequires: cygwin32-filesystem >= 7 BuildRequires: cygwin32-binutils @@ -52,7 +59,7 @@ Cygwin 64-bit cross-compiler runtime, base libraries. %prep -%setup -q -n newlib-cygwin +%autosetup -n newlib-cygwin -p1 touch winsup/cygwin/tlsoffsets*.h touch winsup/cygwin/devices.cc |
