From d20cc408d6b6b93cc0f8556d4f7f499c87f62821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= Date: Mon, 21 Jan 2019 17:05:48 +0100 Subject: [PATCH] Add two upstream patches to fix build with GCC 9 --- ...lare_strong_alias_explicitly___THROW.patch | 48 +++++++++++++++++++ ....4.2-gcc9_fix_Werror_format-overflow.patch | 32 +++++++++++++ libxcrypt.spec | 7 ++- 3 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 libxcrypt-4.4.2-gcc9_declare_strong_alias_explicitly___THROW.patch create mode 100644 libxcrypt-4.4.2-gcc9_fix_Werror_format-overflow.patch diff --git a/libxcrypt-4.4.2-gcc9_declare_strong_alias_explicitly___THROW.patch b/libxcrypt-4.4.2-gcc9_declare_strong_alias_explicitly___THROW.patch new file mode 100644 index 0000000..fcd1c61 --- /dev/null +++ b/libxcrypt-4.4.2-gcc9_declare_strong_alias_explicitly___THROW.patch @@ -0,0 +1,48 @@ +From 6ab065482c8fa2893dcf6cdef2be0d87bdf3f224 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= +Date: Mon, 21 Jan 2019 16:07:37 +0100 +Subject: [PATCH] crypt-port: Declare strong_alias explicitly __THROW. + +Closes: #76. +--- + crypt-port.h | 26 +++++++++++++++++++------- + 1 file changed, 19 insertions(+), 7 deletions(-) + +diff --git a/crypt-port.h b/crypt-port.h +index 2beb558..379a76b 100644 +--- a/crypt-port.h ++++ b/crypt-port.h +@@ -165,14 +165,26 @@ _crypt_strcpy_or_abort (void *, const size_t, const void *); + #define strong_alias(name, aliasname) _strong_alias(name, aliasname) + + /* Darwin doesn't support alias attributes. */ +-#ifndef __APPLE__ +-# define _strong_alias(name, aliasname) \ +- extern __typeof (name) aliasname __attribute__ ((alias (#name))) ++#ifdef __cplusplus ++# ifndef __APPLE__ ++# define _strong_alias(name, aliasname) \ ++ extern __typeof (name) aliasname __THROW __attribute__ ((alias (#name))) ++# else ++# define _strong_alias(name, aliasname) \ ++ __THROW __asm__(".globl _" #aliasname); \ ++ __THROW __asm__(".set _" #aliasname ", _" #name); \ ++ extern __typeof(name) aliasname __THROW ++# endif + #else +-# define _strong_alias(name, aliasname) \ +- __asm__(".globl _" #aliasname); \ +- __asm__(".set _" #aliasname ", _" #name); \ +- extern __typeof(name) aliasname ++# ifndef __APPLE__ ++# define _strong_alias(name, aliasname) \ ++ extern __typeof (name) aliasname __attribute__ ((alias (#name))) __THROW ++# else ++# define _strong_alias(name, aliasname) \ ++ __asm__(".globl _" #aliasname) __THROW; \ ++ __asm__(".set _" #aliasname ", _" #name) __THROW; \ ++ extern __typeof(name) aliasname __THROW ++# endif + #endif + + /* Set the symbol version for EXTNAME, which uses INTNAME as its diff --git a/libxcrypt-4.4.2-gcc9_fix_Werror_format-overflow.patch b/libxcrypt-4.4.2-gcc9_fix_Werror_format-overflow.patch new file mode 100644 index 0000000..eecd869 --- /dev/null +++ b/libxcrypt-4.4.2-gcc9_fix_Werror_format-overflow.patch @@ -0,0 +1,32 @@ +From ec2078568431d65aec3b878cc871e10ad11a9d50 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= +Date: Mon, 21 Jan 2019 16:15:42 +0100 +Subject: [PATCH] test-crypt-bcrypt: Fix -Werror=format-overflow. + +--- + test-crypt-bcrypt.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/test-crypt-bcrypt.c b/test-crypt-bcrypt.c +index 947639f..249b1af 100644 +--- a/test-crypt-bcrypt.c ++++ b/test-crypt-bcrypt.c +@@ -189,6 +189,7 @@ main (void) + int ok = !setting || hash[0] != '*'; + char s_buf[30]; + char o_buf[sizeof (struct crypt_data)]; ++ const struct crypt_data *o_buf_ptr = (void *) o_buf; + int errnm, match; + + if (!setting) +@@ -243,8 +244,8 @@ main (void) + { + printf ("FAIL: %d/crypt_rn: key=%s setting=%s: " + "xhash=%s xmagic=%s xerr=%d, p=%s obuf=%s err=%s\n", +- i, key, setting, hash, x, !ok, p, o_buf, +- strerror (errnm)); ++ i, key, setting, hash, x, !ok, p, ++ o_buf_ptr->output, strerror (errnm)); + status = 1; + continue; + } diff --git a/libxcrypt.spec b/libxcrypt.spec index 917f464..547f798 100644 --- a/libxcrypt.spec +++ b/libxcrypt.spec @@ -110,7 +110,7 @@ fi \ Name: libxcrypt Version: 4.4.2 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Extended crypt library for descrypt, md5crypt, bcrypt, and others # For explicit license breakdown, see the @@ -121,6 +121,8 @@ Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz # Patch 0000 - 2999: Backported patches from upstream. Patch0000: %{url}/commit/a32ce8344554128320ba3a7757260c8632db8b3e.patch#/%{name}-4.4.2-cxx_guard_in_xcrypt_h.patch +Patch0001: %{url}/commit/6ab065482c8fa2893dcf6cdef2be0d87bdf3f224.patch#/%{name}-4.4.2-gcc9_declare_strong_alias_explicitly___THROW.patch +Patch0002: %{url}/commit/ec2078568431d65aec3b878cc871e10ad11a9d50.patch#/%{name}-4.4.2-gcc9_fix_Werror_format-overflow.patch # Patch 3000 - 5999: Backported patches from pull requests. @@ -376,6 +378,9 @@ done %changelog +* Mon Jan 21 2019 Björn Esser - 4.4.2-7 +- Add two upstream patches to fix build with GCC 9 + * Mon Jan 21 2019 Björn Esser - 4.4.2-6 - Add upstream patch to add proper C++-guards in