diff options
author | nros <nros@pkgsrc.org> | 2019-09-16 17:01:46 +0000 |
---|---|---|
committer | nros <nros@pkgsrc.org> | 2019-09-16 17:01:46 +0000 |
commit | addef60f45389600f2f613a11a63a310788374dd (patch) | |
tree | cb7502e4a1ef4d551e35f539a749190dfd60b406 /security | |
parent | 8f4121e1a37d6bba7709299d2a4f69044229ebff (diff) | |
download | pkgsrc-addef60f45389600f2f613a11a63a310788374dd.tar.gz |
Fix compilation of gnutls with compilers missing __get_cpuid_count
Fix compilation of gnutls with compilers missing __get_cpuid_count.
Taken from upstream and fixed in version 3.6.10 .
Fixes compilation on NetBSD 8 without setting GCC_REQD.
Diffstat (limited to 'security')
-rw-r--r-- | security/gnutls/distinfo | 6 | ||||
-rw-r--r-- | security/gnutls/patches/patch-config.h.in | 15 | ||||
-rw-r--r-- | security/gnutls/patches/patch-configure | 95 | ||||
-rw-r--r-- | security/gnutls/patches/patch-lib_accelerated_x86_x86-common.c | 50 |
4 files changed, 161 insertions, 5 deletions
diff --git a/security/gnutls/distinfo b/security/gnutls/distinfo index 54e996994c8..acb9f8ea687 100644 --- a/security/gnutls/distinfo +++ b/security/gnutls/distinfo @@ -1,11 +1,13 @@ -$NetBSD: distinfo,v 1.137 2019/09/16 00:28:48 nia Exp $ +$NetBSD: distinfo,v 1.138 2019/09/16 17:01:46 nros Exp $ SHA1 (gnutls-3.6.9.tar.xz) = 4a12757b129562ae92a01ca890ed282050595296 RMD160 (gnutls-3.6.9.tar.xz) = 2771adabb5342b24fbebcb69b324924ee2b56513 SHA512 (gnutls-3.6.9.tar.xz) = a9fd0f4edae4c081d5c539ba2e5574a4d7294bc00c5c73ea25ce26cb7fd126299c2842a282d45ef5cf0544108f27066e587df28776bc7915143d190d7d5b9d07 Size (gnutls-3.6.9.tar.xz) = 5773928 bytes +SHA1 (patch-config.h.in) = 9f403bd91ddb90d970ba56f91a56e0339848c026 +SHA1 (patch-configure) = 0fcfa9255f15a43aced7262bc2c5084945910aec SHA1 (patch-lib_Makefile.in) = c9a6bbe6238ccd9de41c708012e36b202d2a86e7 -SHA1 (patch-lib_accelerated_x86_x86-common.c) = eaf3c473b1ca83c5b15be26f8c06a82d7961420c +SHA1 (patch-lib_accelerated_x86_x86-common.c) = ccbf4e01f5bcb01b998e80294ecae2f0413680b8 SHA1 (patch-lib_system_certs.c) = fba74b2834a36d66bddcd7d3405d0c91c1b14efc SHA1 (patch-src_libopts_autoopts_options.h) = 9202c55314fe8764ac82c95bbfabfa1b031e9ba4 SHA1 (patch-src_libopts_compat_compat.h) = 240fbfc0ba20af35e0634ba873fe9e34bfbcc921 diff --git a/security/gnutls/patches/patch-config.h.in b/security/gnutls/patches/patch-config.h.in new file mode 100644 index 00000000000..18636b3a1c8 --- /dev/null +++ b/security/gnutls/patches/patch-config.h.in @@ -0,0 +1,15 @@ +$NetBSD: patch-config.h.in,v 1.1 2019/09/16 17:01:46 nros Exp $ +Fix compilation on gcc and clang versions missing __get_cpuid_count +taken from upstream: +https://gitlab.com/gnutls/gnutls/commit/ef80617d1e17e0878a909baad62a75ba265c0e00 +This is fixed in 3.6.10 so remove this if updating to 3.6.10 or above +--- config.h.in.orig 2019-07-25 18:39:21.000000000 +0000 ++++ config.h.in +@@ -1,5 +1,7 @@ + /* config.h.in. Generated from configure.ac by autoheader. */ + ++#undef HAVE_GET_CPUID_COUNT ++ + /* Define if building universal (internal helper macro) */ + #undef AC_APPLE_UNIVERSAL_BUILD + diff --git a/security/gnutls/patches/patch-configure b/security/gnutls/patches/patch-configure new file mode 100644 index 00000000000..537d9741c97 --- /dev/null +++ b/security/gnutls/patches/patch-configure @@ -0,0 +1,95 @@ +$NetBSD: patch-configure,v 1.3 2019/09/16 17:01:46 nros Exp $ +Fix compilation on gcc and clang versions missing __get_cpuid_count +taken from upstream: +https://gitlab.com/gnutls/gnutls/commit/ef80617d1e17e0878a909baad62a75ba265c0e00 +This is fixed in 3.6.10 so remove this if updating to 3.6.10 or above +--- configure.orig 2019-09-16 16:20:13.879358983 +0000 ++++ configure +@@ -2036,7 +2036,6 @@ infodir + docdir + oldincludedir + includedir +-runstatedir + localstatedir + sharedstatedir + sysconfdir +@@ -2226,7 +2225,6 @@ datadir='${datarootdir}' + sysconfdir='${prefix}/etc' + sharedstatedir='${prefix}/com' + localstatedir='${prefix}/var' +-runstatedir='${localstatedir}/run' + includedir='${prefix}/include' + oldincludedir='/usr/include' + docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +@@ -2479,15 +2477,6 @@ do + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + +- -runstatedir | --runstatedir | --runstatedi | --runstated \ +- | --runstate | --runstat | --runsta | --runst | --runs \ +- | --run | --ru | --r) +- ac_prev=runstatedir ;; +- -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ +- | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ +- | --run=* | --ru=* | --r=*) +- runstatedir=$ac_optarg ;; +- + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ +@@ -2625,7 +2614,7 @@ fi + for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ +- libdir localedir mandir runstatedir ++ libdir localedir mandir + do + eval ac_val=\$$ac_var + # Remove trailing slashes. +@@ -2778,7 +2767,6 @@ Fine tuning of the installation director + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] +- --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] +@@ -9782,6 +9770,29 @@ done + ;; + esac + ++# check for gcc's __get_cpuid_count functionality ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __get_cpuid_count" >&5 ++$as_echo_n "checking for __get_cpuid_count... " >&6; } ++cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++ #include <cpuid.h> ++ int main(void) { unsigned t1; return __get_cpuid_count(7, 0, &t1, &t1, &t1,&t1); } ++ ++_ACEOF ++if ac_fn_c_try_link "$LINENO"; then : ++ ++$as_echo "#define HAVE_GET_CPUID_COUNT 1" >>confdefs.h ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ ++fi ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext ++ + fi + + # Check whether --enable-tls13-interop was given. +@@ -18074,6 +18085,8 @@ else + # ifdef _MSC_VER + # include <malloc.h> + # define alloca _alloca ++# elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) ++# include <stdlib.h> + # else + # ifdef HAVE_ALLOCA_H + # include <alloca.h> diff --git a/security/gnutls/patches/patch-lib_accelerated_x86_x86-common.c b/security/gnutls/patches/patch-lib_accelerated_x86_x86-common.c index fe9af862c10..dba9f58c20f 100644 --- a/security/gnutls/patches/patch-lib_accelerated_x86_x86-common.c +++ b/security/gnutls/patches/patch-lib_accelerated_x86_x86-common.c @@ -1,10 +1,54 @@ -$NetBSD: patch-lib_accelerated_x86_x86-common.c,v 1.2 2018/07/06 16:15:28 prlw1 Exp $ +$NetBSD: patch-lib_accelerated_x86_x86-common.c,v 1.3 2019/09/16 17:01:46 nros Exp $ + +Fix compilation on gcc and clang versions missing __get_cpuid_count. +taken from upstream: +https://gitlab.com/gnutls/gnutls/commit/ef80617d1e17e0878a909baad62a75ba265c0e00 +This is fixed in 3.6.10 so remove the things related to cpuid +when updating to 3.6.10 or above. Avoid unsupported xgetbv instruction on older Darwin assemblers. ---- lib/accelerated/x86/x86-common.c.orig 2018-02-12 07:06:04.000000000 +0000 +--- lib/accelerated/x86/x86-common.c.orig 2019-06-28 19:06:07.000000000 +0000 +++ lib/accelerated/x86/x86-common.c -@@ -101,6 +101,8 @@ static unsigned check_4th_gen_intel_feat +@@ -106,17 +106,33 @@ unsigned int _gnutls_x86_cpuid_s[4]; + #define VIA_PADLOCK_PHE (1<<21) + #define VIA_PADLOCK_PHE_SHA512 (1<<22) + ++#ifndef HAVE_GET_CPUID_COUNT ++static inline void ++get_cpuid_level7(unsigned int *eax, unsigned int *ebx, ++ unsigned int *ecx, unsigned int *edx) ++{ ++ /* we avoid using __get_cpuid_count, because it is not available with gcc 4.8 */ ++ if (__get_cpuid_max(7, 0) < 7) ++ return; ++ ++ __cpuid_count(7, 0, *eax, *ebx, *ecx, *edx); ++ return; ++} ++#else ++# define get_cpuid_level7(a,b,c,d) __get_cpuid_count(7, 0, a, b, c, d) ++#endif ++ + static unsigned read_cpuid_vals(unsigned int vals[4]) + { + unsigned t1, t2, t3; +- if (!__get_cpuid(1, &t1, &vals[0], +- &vals[1], &t2)) ++ vals[0] = vals[1] = vals[2] = vals[3] = 0; ++ ++ if (!__get_cpuid(1, &t1, &vals[0], &vals[1], &t2)) + return 0; + /* suppress AVX512; it works conditionally on certain CPUs on the original code */ + vals[1] &= 0xfffff7ff; + +- if (!__get_cpuid_count(7, 0, &t1, &vals[2], &t2, &t3)) +- return 0; ++ get_cpuid_level7(&t1, &vals[2], &t2, &t3); + + return 1; + } +@@ -134,6 +150,8 @@ static unsigned check_4th_gen_intel_feat #if defined(_MSC_VER) && !defined(__clang__) xcr0 = _xgetbv(0); |