diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2016-12-16 23:21:09 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2016-12-16 23:21:09 +0000 |
commit | 39eefd9f1f439063c8b479b4da7980304f4f918e (patch) | |
tree | 3216cb9750eb4f738f8623e06840d9d2bd960ac4 /Build | |
parent | d8061343f9866479227d717567c4b90bccd63b1f (diff) |
gmp 6.1.2
git-svn-id: svn://tug.org/texlive/trunk@42728 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
23 files changed, 544 insertions, 280 deletions
diff --git a/Build/source/libs/gmp/ChangeLog b/Build/source/libs/gmp/ChangeLog index 99969c99fb4..1b1d3dbb30f 100644 --- a/Build/source/libs/gmp/ChangeLog +++ b/Build/source/libs/gmp/ChangeLog @@ -1,3 +1,7 @@ +2016-12-16 Akira Kakuto <kakuto@fuk.kindai.ac.jp> + + Import gmp-6.1.2. + 2016-06-19 Akira Kakuto <kakuto@fuk.kindai.ac.jp> Import gmp-6.1.1. diff --git a/Build/source/libs/gmp/configure b/Build/source/libs/gmp/configure index d174848b641..2323f4f2cef 100755 --- a/Build/source/libs/gmp/configure +++ b/Build/source/libs/gmp/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for gmp (TeX Live) 6.1.1. +# Generated by GNU Autoconf 2.69 for gmp (TeX Live) 6.1.2. # # Report bugs to <tex-k@tug.org>. # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='gmp (TeX Live)' PACKAGE_TARNAME='gmp--tex-live-' -PACKAGE_VERSION='6.1.1' -PACKAGE_STRING='gmp (TeX Live) 6.1.1' +PACKAGE_VERSION='6.1.2' +PACKAGE_STRING='gmp (TeX Live) 6.1.2' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' @@ -1294,7 +1294,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures gmp (TeX Live) 6.1.1 to adapt to many kinds of systems. +\`configure' configures gmp (TeX Live) 6.1.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1364,7 +1364,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of gmp (TeX Live) 6.1.1:";; + short | recursive ) echo "Configuration of gmp (TeX Live) 6.1.2:";; esac cat <<\_ACEOF @@ -1461,7 +1461,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -gmp (TeX Live) configure 6.1.1 +gmp (TeX Live) configure 6.1.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1976,7 +1976,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by gmp (TeX Live) $as_me 6.1.1, which was +It was created by gmp (TeX Live) $as_me 6.1.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3899,7 +3899,7 @@ fi # Define the identity of the package. PACKAGE='gmp--tex-live-' - VERSION='6.1.1' + VERSION='6.1.2' cat >>confdefs.h <<_ACEOF @@ -6148,7 +6148,7 @@ else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include "gmp-tmp.h" -#include "$srcdir/gmp-6.1.1/gmp-impl.h" +#include "$srcdir/gmp-src/gmp-impl.h" int main () { @@ -7002,7 +7002,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by gmp (TeX Live) $as_me 6.1.1, which was +This file was extended by gmp (TeX Live) $as_me 6.1.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -7068,7 +7068,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -gmp (TeX Live) config.status 6.1.1 +gmp (TeX Live) config.status 6.1.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/Build/source/libs/gmp/gmp-PATCHES/ChangeLog b/Build/source/libs/gmp/gmp-PATCHES/ChangeLog index cc5c4ac277f..e1f2fae0d7d 100644 --- a/Build/source/libs/gmp/gmp-PATCHES/ChangeLog +++ b/Build/source/libs/gmp/gmp-PATCHES/ChangeLog @@ -1,3 +1,7 @@ +2016-12-16 Akira Kakuto <kakuto@fuk.kindai.ac.jp> + + * Import 6.1.2. + 2016-06-19 Akira Kakuto <kakuto@fuk.kindai.ac.jp> * Import 6.1.1. diff --git a/Build/source/libs/gmp/gmp-PATCHES/TL-Changes b/Build/source/libs/gmp/gmp-PATCHES/TL-Changes index 63b34ce4871..94a5f87ca3d 100644 --- a/Build/source/libs/gmp/gmp-PATCHES/TL-Changes +++ b/Build/source/libs/gmp/gmp-PATCHES/TL-Changes @@ -1,4 +1,4 @@ -Changes applied to the gmp-6.1.1/ tree as obtained from: +Changes applied to the gmp-6.1.2/ tree as obtained from: http://ftp.gnu.org/gnu/gmp/ Removed: diff --git a/Build/source/libs/gmp/gmp-src/ChangeLog b/Build/source/libs/gmp/gmp-src/ChangeLog index 3ffe795396a..7956d943c47 100644 --- a/Build/source/libs/gmp/gmp-src/ChangeLog +++ b/Build/source/libs/gmp/gmp-src/ChangeLog @@ -1,3 +1,114 @@ +2016-12-16 Torbjörn Granlund <tg@gmplib.org> + + * Version 6.1.2 released. + +2016-12-13 Torbjörn Granlund <tg@gmplib.org> + + * longlong.h: Test LONGLONG_STANDALONE in two more places. + +2016-12-07 Torbjörn Granlund <tg@gmplib.org> + + * gmp-h.in: Check yet another symbol for FILE. + +2016-12-02 Torbjörn Granlund <tg@gmplib.org> + + Merge configure changes from before 6.1.1: + + 2016-03-25 Torbjörn Granlund <torbjorng@google.com> + + * config.guess: Prefix all arm CPUs with "arm" to accommodate our + matchers. + * configure.ac (arm): Match arm CPUs consistently. + + 2016-03-21 Torbjörn Granlund <torbjorng@google.com> + + * configure.ac: Support many arm64 processors. + + 2016-03-20 Torbjörn Granlund <torbjorng@google.com> + + * config.guess (arm*): Handle big.LITTLE CPUs by extracting the + lexically largest id. + * config.guess (arm*): Add many aarch64 CPUs. + * config.guess (main): Corresponding changes. + + * configure.ac (arm*): Support cortex-a5 better. + + 2016-01-15 Torbjörn Granlund <torbjorng@google.com> + + * config.guess (s390): Don't assume /proc/cpuinfo exists. + + 2016-01-13 Torbjörn Granlund <torbjorng@google.com> + + * config.guess: Reorder and generalise ppc code. + +2016-12-01 Torbjörn Granlund <tg@gmplib.org> + + * tests/misc.c (tests_rand_start): Make shift well-defined. + + * Makefile.am (LIBGMP_LT_*, LIBGMPXX_LT_*): Bump version info. + * gmp-h.in: Bump version. + +2016-11-29 Torbjörn Granlund <tg@gmplib.org> + + * gmp-h.in (__GNU_MP__): Bump. + + * mpz/inp_raw.c: Rewrite size computation to avoid overflow. + + * mpz/kronsz.c: Use ABS_CAST to avoid undefined code. + +2016-11-27 Torbjörn Granlund <tg@gmplib.org> + + * tune/time.c (cgt_works_p): Add a missing verbosity check. + + * configure.ac: Make udiv_w_sdiv use conditional on enable_assembly. + +2016-11-25 Marc Glisse <marc.glisse@inria.fr> + + * tests/cxx/t-ops2.cc (checkz): Avoid left shift of negative number. + +2016-11-22 Torbjörn Granlund <tg@gmplib.org> + + * configure.ac (x86): Define LINUX for GNU/Linux systems. + * mpn/x86_64/fat/fat_entry.asm: Set PRETEND_PIC for GNU/Linux. + +2016-11-21 Torbjörn Granlund <tg@gmplib.org> + + * acinclude.m4 (mpn_lshift_com optimization 2): Make it well-defined + also for 32-bit systems. + (mpn_lshift_com optimization 2): Free allocated memory. + +2016-11-01 Torbjörn Granlund <tg@gmplib.org> + + * mpn/generic/dive_1.c: Remove a forgotten dummy while-loop. (Spotted + by Peter Barfuss.) + +2016-10-31 Oleg Oshmyan <chortos@inbox.lv> + + * gmp-impl.h (x86_64 MPN_IORD_U): Use proper asm constraint. + +2016-10-24 Torbjörn Granlund <tg@gmplib.org> + + * config.guess: Recognise Itanium Poulson. + +2016-10-15 Torbjörn Granlund <tg@gmplib.org> + + * configure.ac (arm*-*-*): Amend last change. + +2016-10-14 Torbjörn Granlund <tg@gmplib.org> + + * configure.ac + (arm*-*-*): Rewrite arm support to handle armv8 CPUs in 32-bit mode. + +2016-08-24 Vlad Zakharov <vzakhar@synopsys.com> + + * longlong.h (arc add_ssaaaa, sub_ddmmss): Replace obsolete 'J' + constraint with 'Cal'. + +2016-08-22 Marc Glisse <marc.glisse@inria.fr> + + * longlong.h (umul_ppmm from __umulsidi3): Protect with do ... + while (0). + 2016-06-18 Torbjörn Granlund <tg@gmplib.org> * Version 6.1.1 released. @@ -39,7 +150,7 @@ 2015-12-13 Marco Bodrato <bodrato@mail.dm.unipi.it> - * tests/arm32call.asm: bx->ret to support thumb-less chips + * tests/arm32call.asm: bx->ret to support thumb-less chips (thanks Martin Husemann). 2015-12-13 Torbjörn Granlund <torbjorng@google.com> diff --git a/Build/source/libs/gmp/gmp-src/Makefile.am b/Build/source/libs/gmp/gmp-src/Makefile.am index 4d26b8b573b..0569c688c00 100644 --- a/Build/source/libs/gmp/gmp-src/Makefile.am +++ b/Build/source/libs/gmp/gmp-src/Makefile.am @@ -88,6 +88,7 @@ # 6.0.0 12:0:2 8:0:4 - # 6.1.0 13:0:3 9:0:5 - # 6.1.1 13:1:3 9:1:5 - +# 6.1.2 13:2:3 9:2:5 - # # Starting at 3:0:0 is a slight abuse of the versioning system, but it # ensures we're past soname libgmp.so.2, which was used on Debian GNU/Linux @@ -101,11 +102,11 @@ # libgmpxx.so.3.0.4) incrementing, to make it clear which GMP it's from. LIBGMP_LT_CURRENT = 13 -LIBGMP_LT_REVISION = 1 +LIBGMP_LT_REVISION = 2 LIBGMP_LT_AGE = 3 LIBGMPXX_LT_CURRENT = 9 -LIBGMPXX_LT_REVISION = 1 +LIBGMPXX_LT_REVISION = 2 LIBGMPXX_LT_AGE = 5 @@ -426,15 +427,14 @@ check-mini-gmp: abs_srcdir="`cd $(srcdir) && pwd`" ; \ $(MKDIR_P) mini-gmp/tests \ && cd mini-gmp/tests \ - && LD_LIBRARY_PATH="../../.libs:$$LD_LIBRARY_PATH" \ - DYLD_LIBRARY_PATH="../../.libs:$$DYLD_LIBRARY_PATH" \ + && TEST_LIBRARY_PATH="../../.libs" \ $(MAKE) -f "$$abs_srcdir/mini-gmp/tests/Makefile" \ VPATH="$$abs_srcdir/mini-gmp/tests" \ srcdir="$$abs_srcdir/mini-gmp/tests" \ MINI_GMP_DIR="$$abs_srcdir/mini-gmp" \ LDFLAGS="-L../../.libs" \ LIBS="-lgmp -lm" \ - CC="$(CC_FOR_BUILD)" EXTRA_CFLAGS="-g -I../.." check + CC="$(CC)" CFLAGS="$(CFLAGS)" CPPFLAGS="-I../.." check clean-mini-gmp: if [ -d mini-gmp/tests ] ; then \ diff --git a/Build/source/libs/gmp/gmp-src/NEWS b/Build/source/libs/gmp/gmp-src/NEWS index ffa7083260f..4999dc14f48 100644 --- a/Build/source/libs/gmp/gmp-src/NEWS +++ b/Build/source/libs/gmp/gmp-src/NEWS @@ -4,6 +4,32 @@ Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. +Changes between GMP version 6.1.1 and 6.1.2 + + BUGS FIXED + * Mini-GMP: Fixed a division bug, which on a machine with 64-bit + unsigned long affects approximately 1 out of 2^32 divisors. + + * Mini-GMP: Fix mpz_set_str crash on inputs with a large number of + leading zeros. Also stricter input validation, rejecting inputs + with no digits. + + FEATURES + * Handle more systems which require PIC code in static libraries (e.g., + "hardened" Gentoo and Debian 9). + + * Configuration for arm (-32 and -64) has been rewritten, fixing poor + code selection for many CPUs. + + * Mini-GMP: Updated to the latest development version, including + new functions mpn_com and mpn_neg. + + SPEEDUPS + * None, except for arm CPUs affected by the configuration rewrite. + + MISC + - + Changes between GMP version 6.1.0 and 6.1.1 BUGS FIXED @@ -35,7 +61,7 @@ Changes between GMP version 6.0.* and 6.1.0 * Fixed PIC bug in popcount affecting Intel processors using the 32-bit ABI. SPEEDUPS - * Speedup for Intel Broadwell and Skylake though assembly code making use of + * Speedup for Intel Broadwell and Skylake through assembly code making use of new ADX instructions. * Square root is now faster when the remainder is not needed. Also the speed diff --git a/Build/source/libs/gmp/gmp-src/acinclude.m4 b/Build/source/libs/gmp/gmp-src/acinclude.m4 index bcc6f524cd8..3c3ecf52890 100644 --- a/Build/source/libs/gmp/gmp-src/acinclude.m4 +++ b/Build/source/libs/gmp/gmp-src/acinclude.m4 @@ -743,7 +743,7 @@ main () a[i] = ~0L; r = malloc (10000 * sizeof (unsigned long)); r2 = r; - for (i = 0; i < 528; i += 22) + for (i = 0; i < 528; i += 23) { lshift_com (r2, a, i / (8 * sizeof (unsigned long)) + 1, @@ -753,6 +753,7 @@ main () if (r[2048] != 0 || r[2049] != 0 || r[2050] != 0 || r[2051] != 0 || r[2052] != 0 || r[2053] != 0 || r[2054] != 0) abort (); + free (r); return 0; } #else diff --git a/Build/source/libs/gmp/gmp-src/config.in b/Build/source/libs/gmp/gmp-src/config.in index 448bc6fa1b9..ec16504b90c 100644 --- a/Build/source/libs/gmp/gmp-src/config.in +++ b/Build/source/libs/gmp/gmp-src/config.in @@ -2,7 +2,7 @@ /* -Copyright 1996-2015 Free Software Foundation, Inc. +Copyright 1996-2016 Free Software Foundation, Inc. This file is part of the GNU MP Library. diff --git a/Build/source/libs/gmp/gmp-src/configgmp.guess b/Build/source/libs/gmp/gmp-src/configgmp.guess index 744e11e4947..49ecca08d7c 100755 --- a/Build/source/libs/gmp/gmp-src/configgmp.guess +++ b/Build/source/libs/gmp/gmp-src/configgmp.guess @@ -3,7 +3,7 @@ # GMP config.guess wrapper. -# Copyright 2000-2006, 2008, 2011-2015 Free Software Foundation, Inc. +# Copyright 2000-2006, 2008, 2011-2016 Free Software Foundation, Inc. # # This file is part of the GNU MP Library. # @@ -172,35 +172,49 @@ EOF fi ;; -arm*-*-*) - cpu_code=`sed -n 's/^CPU part.*\(0x.*\)$/\1/p' /proc/cpuinfo 2>/dev/null | head -n 1 2>/dev/null` - case "$cpu_code" in - 0xa10 | 0xa11 | 0xb11) # v4 strongarm/sa1100 +arm*-*-* | aarch64-*-*) + cpu_code=`sed -n 's/^CPU part.*\(0x.*\)$/\1/p' /proc/cpuinfo 2>/dev/null | sort -r | head -n 1 2>/dev/null` + cpu_implementer=`sed -n 's/^CPU implementer.*\(0x.*\)$/\1/p' /proc/cpuinfo 2>/dev/null | head -n 1 2>/dev/null` + case "${cpu_implementer}_${cpu_code}" in + 0x53_0x001) exact_cpu=armexynosm1 ;; + 0x51_0x800) exact_cpu=armcortexa57 ;; + 0x43_0x0a1) exact_cpu=armthunderx ;; + 0x50_0x000) exact_cpu=armxgene1 ;; + esac + if test -z "$exact_cpu"; then + case "$cpu_code" in + 0xa10 | 0xa11 | 0xb11) # v4 strongarm/sa1100 exact_cpu="armsa1";; - 0x915 | 0x925 | \ - 0x920 | 0x922 | 0x940) # v4 + 0x915 | 0x925 | \ + 0x920 | 0x922 | 0x940) # v4 exact_cpu="arm9tdmi";; - 0x210 | 0x290 | 0x2d0 | \ - 0x212 | 0x292 | 0x2d2 | \ - 0x411) exact_cpu="armxscale";; # v5 pxa2xx - 0x926 | 0x946 | 0x966 | 0x968) # v5te/v5tej + 0x210 | 0x290 | 0x2d0 | \ + 0x212 | 0x292 | 0x2d2 | \ + 0x411) exact_cpu="armxscale";; # v5 pxa2xx + 0x926 | 0x946 | 0x966 | 0x968) # v5te/v5tej exact_cpu="arm9te";; - 0xa20 | 0xa22 | 0xa26) # v5te + 0xa20 | 0xa22 | 0xa26) # v5te exact_cpu="arm10";; - 0xb02) exact_cpu="arm11mpcore";; # v6 - 0xb36) exact_cpu="arm1136";; # v6 - 0xb56) exact_cpu="arm1156";; # v6t2 - 0xb76) exact_cpu="arm1176";; # v6 - 0xc05) exact_cpu="armcortexa5";; # v7a - 0xc07) exact_cpu="armcortexa7";; # v7a - 0xc08) exact_cpu="armcortexa8";; # v7a - 0xc09) exact_cpu="armcortexa9";; # v7a - 0xc0f) exact_cpu="armcortexa15";; # v7a - 0xc14) exact_cpu="armcortexr4";; # v7r - 0xc15) exact_cpu="armcortexr5";; # v7r - 0xc23) exact_cpu="armcortexm3";; # v7m - *) exact_cpu=$guess_cpu;; - esac + 0xb02) exact_cpu="arm11mpcore";; # v6 + 0xb36) exact_cpu="arm1136";; # v6 + 0xb56) exact_cpu="arm1156";; # v6t2 + 0xb76) exact_cpu="arm1176";; # v6 + 0xc05) exact_cpu="armcortexa5";; # v7a + 0xc07) exact_cpu="armcortexa7";; # v7a + 0xc08) exact_cpu="armcortexa8";; # v7a + 0xc09) exact_cpu="armcortexa9";; # v7a + 0xc0f) exact_cpu="armcortexa15";; # v7a + 0xc14) exact_cpu="armcortexr4";; # v7r + 0xc15) exact_cpu="armcortexr5";; # v7r + 0xc23) exact_cpu="armcortexm3";; # v7m + + 0xd04) exact_cpu="armcortexa35";; # v8-32 + 0xd03) exact_cpu="armcortexa53";; # v8 + 0xd07) exact_cpu="armcortexa57";; # v8 + 0xd08) exact_cpu="armcortexa72";; # v8 + *) exact_cpu=$guess_cpu;; + esac + fi exact_cpu="${exact_cpu}`sed -n 's;^Features.*\(neon\).*;\1;p' /proc/cpuinfo 2>/dev/null | head -n 1 2>/dev/null`" ;; @@ -243,7 +257,8 @@ main () switch ((getcpuid(3LL) >> 24) & 0xFF) { case 0x07: puts ("itanium"); break; case 0x1F: puts ("itanium2"); break; /* McKinley, Madison */ - case 0x20: puts ("itanium2"); break; /* Montecito */ + case 0x20: puts ("itanium2"); break; /* Montecito, Montvale, Tukwila */ + case 0x21: puts ("itanium2"); break; /* Poulson */ } } return 0; @@ -377,41 +392,43 @@ rs6000-*-* | powerpc*-*-*) # (as noted below). But the man page says the command is still "under # development", so it doesn't seem wise to use it just yet, not while # there's an alternative. - # + + # Grep the /proc/cpuinfo pseudo-file. + # Anything unrecognised is ignored, since of course we mustn't spit out + # a cpu type config.sub doesn't know. + if test -z "$exact_cpu" && test -f /proc/cpuinfo; then + x=`grep "^cpu[ ]" /proc/cpuinfo | head -n 1` + x=`echo $x | sed -n 's/^cpu[ ]*:[ ]*\([A-Za-z0-9]*\).*/\1/p'` + x=`echo $x | sed 's/PPC//'` + case $x in + 601) exact_cpu="power" ;; + 603ev) exact_cpu="powerpc603e" ;; + 604ev5) exact_cpu="powerpc604e" ;; + 970??) exact_cpu="powerpc970" ;; + 603 | 603e | 604 | 604e | 750 | 821 | 860) + exact_cpu="powerpc$x" ;; + POWER[4-9]*) + exact_cpu=`echo $x | sed -e "s;POWER;power;" -e "s;[a-zA-Z]*$;;"` ;; + esac + fi + # Try to read the PVR. mfpvr is a protected instruction, NetBSD, MacOS # and AIX don't allow it in user mode, but the Linux kernel does. # - # Using explicit bytes for mfpvr avoids worrying about assembler syntax - # and underscores. "char"s are used instead of "int"s to avoid worrying - # whether sizeof(int)==4 or if it's the right endianness. - # # Note this is no good on AIX, since a C function there is the address of # a function descriptor, not actual code. But this doesn't matter since # AIX doesn't allow mfpvr anyway. # - eval $set_cc_for_build - cat >$dummy.c <<\EOF + if test -z "$exact_cpu"; then + eval $set_cc_for_build + cat >$dummy.c <<\EOF #include <stdio.h> -struct { - int n; /* force 4-byte alignment */ - char a[8]; -} getpvr = { - 0, - { - 0x7c, 0x7f, 0x42, 0xa6, /* mfpvr r3 */ - 0x4e, 0x80, 0x00, 0x20, /* blr */ - } -}; int main () { - unsigned (*fun)(); unsigned pvr; - /* a separate "fun" variable is necessary for gcc 2.95.2 on MacOS, - it gets a compiler error on a combined cast and call */ - fun = (unsigned (*)()) getpvr.a; - pvr = (*fun) (); + asm ("mfpvr %0" : "=r" (pvr)); switch (pvr >> 16) { case 0x0001: puts ("powerpc601"); break; @@ -424,6 +441,8 @@ main () case 0x000a: puts ("powerpc604e"); break; /* 604ev5 */ case 0x000c: puts ("powerpc7400"); break; case 0x0041: puts ("powerpc630"); break; + case 0x003f: puts ("power7"); break; + case 0x004b: puts ("power8"); break; case 0x0050: puts ("powerpc860"); break; case 0x8000: puts ("powerpc7450"); break; case 0x8001: puts ("powerpc7455"); break; @@ -434,34 +453,16 @@ main () return 0; } EOF - if ($CC_FOR_BUILD $dummy.c -o $dummy) >/dev/null 2>&1; then - # This style construct is needed on AIX 4.3 to suppress the SIGILL error - # from (*fun)(). Using $SHELL -c $dummy 2>/dev/null doesn't work. - { x=`$dummy`; } 2>/dev/null - if test -n "$x"; then - exact_cpu=$x + if ($CC_FOR_BUILD $dummy.c -o $dummy) >/dev/null 2>&1; then + # This style construct is needed on AIX 4.3 to suppress the SIGILL error + # from (*fun)(). Using $SHELL -c $dummy 2>/dev/null doesn't work. + { x=`$dummy`; } 2>/dev/null + if test -n "$x"; then + exact_cpu=$x + fi fi fi - # Grep the linux kernel /proc/cpuinfo pseudo-file. - # Anything unrecognised is ignored, since of course we mustn't spit out - # a cpu type config.sub doesn't know. - if test -z "$exact_cpu" && test -f /proc/cpuinfo; then - x=`grep "^cpu[ ]" /proc/cpuinfo | head -n 1` - x=`echo $x | sed -n 's/^cpu[ ]*:[ ]*\([A-Za-z0-9]*\).*/\1/p'` - x=`echo $x | sed 's/PPC//'` - case $x in - 601) exact_cpu="power" ;; - 603ev) exact_cpu="powerpc603e" ;; - 604ev5) exact_cpu="powerpc604e" ;; - 970??) exact_cpu="powerpc970" ;; - 603 | 603e | 604 | 604e | 750 | 821 | 860) - exact_cpu="powerpc$x" ;; - POWER[4-9]*) - exact_cpu=`echo $x | sed -e "s;POWER;power;" -e "s;[a-zA-Z]*$;;"` ;; - esac - fi - if test -z "$exact_cpu"; then # On AIX, try looking at _system_configuration. This is present in # version 4 at least. @@ -1067,18 +1068,20 @@ EOF ;; s390*-*-*) - model=`grep "^processor 0: version =" /proc/cpuinfo | sed -e 's/.*machine = //'` - case $model in - 2064 | 2066) zcpu="z900" ;; - 2084 | 2086) zcpu="z990" ;; - 2094 | 2096) zcpu="z9" ;; - 2097 | 2098) zcpu="z10" ;; - 2817 | 2818 | *) zcpu="z196" ;; - esac - case "$guess_full" in - s390x-*-*) exact_cpu=${zcpu} ;; - s390-*-*) exact_cpu=${zcpu}esa ;; - esac + if test -f /proc/cpuinfo; then + model=`grep "^processor 0: version =" /proc/cpuinfo | sed -e 's/.*machine = //'` + case $model in + 2064 | 2066) zcpu="z900" ;; + 2084 | 2086) zcpu="z990" ;; + 2094 | 2096) zcpu="z9" ;; + 2097 | 2098) zcpu="z10" ;; + 2817 | 2818 | *) zcpu="z196" ;; + esac + case "$guess_full" in + s390x-*-*) exact_cpu=${zcpu} ;; + s390-*-*) exact_cpu=${zcpu}esa ;; + esac + fi ;; esac diff --git a/Build/source/libs/gmp/gmp-src/configgmp.sub b/Build/source/libs/gmp/gmp-src/configgmp.sub index 6b7d04b9bb2..4618cf079bd 100755 --- a/Build/source/libs/gmp/gmp-src/configgmp.sub +++ b/Build/source/libs/gmp/gmp-src/configgmp.sub @@ -3,7 +3,7 @@ # GMP config.sub wrapper. -# Copyright 2000-2003, 2006, 2009-2015 Free Software Foundation, Inc. +# Copyright 2000-2003, 2006, 2009-2016 Free Software Foundation, Inc. # # This file is part of the GNU MP Library. # @@ -130,7 +130,7 @@ z900esa | z990esa | z9esa | z10esa | z196esa) armsa1 | armxscale | arm9tdmi | arm9te | \ arm10* | arm11mpcore | armsa1 | arm1136 | arm1156 | arm1176 | \ armcortexa5 | armcortexa7 | armcortexa8 | armcortexa9 | armcortexa15 | \ -armcortexr4 | armcortexr5 | armcortexm3 | arm*neon) +armcortexr4 | armcortexr5 | armcortexm3 | arm*neon | xgene1 | exynosm1 | thunderx) test_cpu="arm";; *) diff --git a/Build/source/libs/gmp/gmp-src/configure.ac b/Build/source/libs/gmp/gmp-src/configure.ac index 92b29fe2d55..9641c041fd1 100644 --- a/Build/source/libs/gmp/gmp-src/configure.ac +++ b/Build/source/libs/gmp/gmp-src/configure.ac @@ -3,7 +3,7 @@ dnl Process this file with autoconf to produce a configure script. define(GMP_COPYRIGHT,[[ -Copyright 1996-2015 Free Software Foundation, Inc. +Copyright 1996-2016 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -591,21 +591,18 @@ case $host in ;; - arm64*-*-* | aarch64*-*-*) - # The compiler clang version 3.4 or earlier requires an explicit -mfpu=neon - # for out assembly code. Since this compiler cloaks as gcc, we have to - # fake too. - gcc_cflags_maybe="-mfpu=neon" - path="arm64" - ;; - - - arm*-*-*) + arm*-*-* | aarch64*-*-*) + abilist="32" gcc_cflags="$gcc_cflags $fomit_frame_pointer" gcc_cflags_optlist="arch fpmode neon tune" + gcc_64_cflags_optlist="arch tune" gcc_testlist="gcc-arm-umodsi" - GMP_INCLUDE_MPN(arm/arm-defs.m4) + gcc_64_testlist="" CALLING_CONVENTIONS_OBJS='arm32call.lo arm32check.lo' + CALLING_CONVENTIONS_OBJS_64="" + cclist_64="gcc cc" + any_32_testlist="sizeof-long-4" + any_64_testlist="sizeof-long-8" # This is needed for clang, which is not content with flags like -mfpu=neon # alone. @@ -620,14 +617,14 @@ case $host in # either enforce them, or organise to strip paths as the corresponding # options fail. case $host_cpu in - armsa1 | arm7t* | arm9t* | armv4t*) - path="arm" - gcc_cflags_arch="-march=armv4" - ;; armxscale | arm7ej | arm9te | arm9e* | arm10* | armv5*) path="arm/v5 arm" gcc_cflags_arch="-march=armv5" ;; + armsa1 | arm7t* | arm9t* | armv4t*) + path="arm" + gcc_cflags_arch="-march=armv4" + ;; arm1156 | armv6t2*) path="arm/v6t2 arm/v6 arm/v5 arm" gcc_cflags_arch="-march=armv6t2" @@ -639,6 +636,13 @@ case $host in armcortexa5 | armv7*) path="arm/v6t2 arm/v6 arm/v5 arm" gcc_cflags_arch="-march=armv7-a" + gcc_cflags_tune="-mtune=cortex-a5" + ;; + armcortexa5neon) + path="arm/neon arm/v6t2 arm/v6 arm/v5 arm" + gcc_cflags_neon="-mfpu=neon" + gcc_cflags_arch="-march=armv7-a" + gcc_cflags_tune="-mtune=cortex-a5" ;; armcortexa7) path="arm/v7a/cora7 arm/v6t2 arm/v6 arm/v5 arm" @@ -684,6 +688,62 @@ case $host in gcc_cflags_neon="-mfpu=neon" gcc_cflags_tune="-mtune=cortex-a15 -mtune=cortex-a9" ;; + armcortexa53 | armcortexa53neon) + abilist="64 32" + path="arm/neon arm/v7a/cora9 arm/v6t2 arm/v6 arm/v5 arm" + path_64="arm64/cora53 arm64" + gcc_cflags_arch="-march=armv8-a" + gcc_cflags_neon="-mfpu=neon" + gcc_cflags_tune="-mtune=cortex-a53" + ;; + armcortexa57 | armcortexa57neon) + abilist="64 32" + path="arm/v7a/cora15/neon arm/neon arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm" + path_64="arm64/cora57 arm64" + gcc_cflags_arch="-march=armv8-a" + gcc_cflags_neon="-mfpu=neon" + gcc_cflags_tune="-mtune=cortex-a57" + ;; + armcortexa72 | armcortexa72neon) + abilist="64 32" + path="arm/v7a/cora15/neon arm/neon arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm" + path_64="arm64/cora72 arm64" + gcc_cflags_arch="-march=armv8-a" + gcc_cflags_neon="-mfpu=neon" + gcc_cflags_tune="-mtune=cortex-a72" + ;; + armexynosm1) + abilist="64 32" + path="arm/v7a/cora15/neon arm/neon arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm" + path_64="arm64" + gcc_cflags_arch="-march=armv8-a" + gcc_cflags_neon="-mfpu=neon" + gcc_cflags_tune="-mtune=exynosm1" + ;; + armthunderx) + abilist="64 32" + path="arm/v7a/cora15/neon arm/neon arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm" + path_64="arm64" + gcc_cflags_arch="-march=armv8-a" + gcc_cflags_neon="-mfpu=neon" + gcc_cflags_tune="-mtune=thunderx" + ;; + armxgene1) + abilist="64 32" + path="arm/v7a/cora15/neon arm/neon arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm" + path_64="arm64/xgene1 arm64" + gcc_cflags_arch="-march=armv8-a" + gcc_cflags_neon="-mfpu=neon" + gcc_cflags_tune="-mtune=xgene1" + ;; + aarch64*) + abilist="64 32" + path="arm/v7a/cora15/neon arm/neon arm/v7a/cora15 arm/v6t2 arm/v6 arm/v5 arm" + path_64="arm64" + gcc_cflags_arch="-march=armv8-a" + gcc_cflags_neon="-mfpu=neon" + gcc_cflags_tune="" + ;; *) path="arm" gcc_cflags_arch="-march=armv4" @@ -1209,7 +1269,9 @@ case $host in AC_DEFINE(HAVE_HOST_CPU_FAMILY_power) HAVE_HOST_CPU_FAMILY_power=1 cclist="gcc" - extra_functions="udiv_w_sdiv" + if test "$enable_assembly" = "yes" ; then + extra_functions="udiv_w_sdiv" + fi path="power" # gcc 2.7.2 knows rios1, rios2, rsc @@ -1239,7 +1301,9 @@ case $host in gcc_cflags="$gcc_cflags $fomit_frame_pointer" gcc_cflags_optlist="arch" path="s390_32" - extra_functions="udiv_w_sdiv" + if test "$enable_assembly" = "yes" ; then + extra_functions="udiv_w_sdiv" + fi gcc_32_cflags_maybe="-m31" case $host_cpu in @@ -1536,14 +1600,18 @@ case $host in GMP_INCLUDE_MPN(vax/elf.m4) gcc_cflags="$gcc_cflags $fomit_frame_pointer" path="vax" - extra_functions="udiv_w_sdiv" + if test "$enable_assembly" = "yes" ; then + extra_functions="udiv_w_sdiv" + fi ;; vax*-*-*) # Default to aout conventions (i.e., no register prefix, '_' global prefix) # gcc_cflags="$gcc_cflags $fomit_frame_pointer" path="vax" - extra_functions="udiv_w_sdiv" + if test "$enable_assembly" = "yes" ; then + extra_functions="udiv_w_sdiv" + fi ;; @@ -3541,6 +3609,12 @@ if test "$gmp_asm_syntax_testing" != no; then GMP_ASM_ALIGN_LOG case $host in + arm*-*-* | aarch64*-*-*) + case $ABI in + 32) + GMP_INCLUDE_MPN(arm/arm-defs.m4) ;; + esac + ;; hppa*-*-*) # for both pa32 and pa64 GMP_INCLUDE_MPN(pa32/pa-defs.m4) @@ -3629,6 +3703,8 @@ yes GMP_INCLUDE_MPN(x86_64/dos64.m4) ;; *-openbsd*) GMP_DEFINE_RAW(["define(<OPENBSD>,1)"]) ;; + *-linux*) + GMP_DEFINE_RAW(["define(<LINUX>,1)"]) ;; esac ;; esac diff --git a/Build/source/libs/gmp/gmp-src/gmp-h.in b/Build/source/libs/gmp/gmp-src/gmp-h.in index 1c836e9d500..fea20958a0a 100644 --- a/Build/source/libs/gmp/gmp-src/gmp-h.in +++ b/Build/source/libs/gmp/gmp-src/gmp-h.in @@ -49,11 +49,8 @@ see https://www.gnu.org/licenses/. */ #define GMP_NAIL_MASK (~ GMP_NUMB_MASK) -/* The following (everything under ifndef __GNU_MP__) must be identical in - gmp.h and mp.h to allow both to be included in an application or during - the library build. */ #ifndef __GNU_MP__ -#define __GNU_MP__ 5 +#define __GNU_MP__ 6 #include <stddef.h> /* for size_t */ #include <limits.h> @@ -232,8 +229,6 @@ typedef const __mpq_struct *mpq_srcptr; typedef __mpq_struct *mpq_ptr; -/* This is not wanted in mp.h, so put it outside the __GNU_MP__ common - section. */ #if __GMP_LIBGMP_DLL #ifdef __GMP_WITHIN_GMPXX /* compiling to go into a DLL libgmpxx */ @@ -268,7 +263,8 @@ typedef __mpq_struct *mpq_ptr; || defined (_MSL_STDIO_H) /* Metrowerks */ \ || defined (_STDIO_H_INCLUDED) /* QNX4 */ \ || defined (_ISO_STDIO_ISO_H) /* Sun C++ */ \ - || defined (__STDIO_LOADED) /* VMS */ + || defined (__STDIO_LOADED) /* VMS */ \ + || defined (__DEFINED_FILE) /* musl */ #define _GMP_H_HAVE_FILE 1 #endif @@ -2323,10 +2319,10 @@ enum #define __GMP_CC "@CC@" #define __GMP_CFLAGS "@CFLAGS@" -/* Major version number is the value of __GNU_MP__ too, above and in mp.h. */ +/* Major version number is the value of __GNU_MP__ too, above. */ #define __GNU_MP_VERSION 6 #define __GNU_MP_VERSION_MINOR 1 -#define __GNU_MP_VERSION_PATCHLEVEL 1 +#define __GNU_MP_VERSION_PATCHLEVEL 2 #define __GNU_MP_RELEASE (__GNU_MP_VERSION * 10000 + __GNU_MP_VERSION_MINOR * 100 + __GNU_MP_VERSION_PATCHLEVEL) #define __GMP_H__ diff --git a/Build/source/libs/gmp/gmp-src/gmp-impl.h b/Build/source/libs/gmp/gmp-src/gmp-impl.h index 6987581049c..dcc233bb443 100644 --- a/Build/source/libs/gmp/gmp-src/gmp-impl.h +++ b/Build/source/libs/gmp/gmp-src/gmp-impl.h @@ -2687,7 +2687,7 @@ __GMP_DECLSPEC mp_bitcnt_t mpn_remove (mp_ptr, mp_size_t *, mp_srcptr, mp_size_t ASM_L(done) ":\n" \ : "=r" (__ptr_dummy) \ : "0" (ptr), \ - "ri" ((mp_limb_t) (incr)), "n" (sizeof(mp_limb_t)) \ + "re" ((mp_limb_t) (incr)), "n" (sizeof(mp_limb_t)) \ : "memory"); \ } \ } while (0) diff --git a/Build/source/libs/gmp/gmp-src/longlong.h b/Build/source/libs/gmp/gmp-src/longlong.h index fde5277032c..96de9404210 100644 --- a/Build/source/libs/gmp/gmp-src/longlong.h +++ b/Build/source/libs/gmp/gmp-src/longlong.h @@ -1,6 +1,6 @@ /* longlong.h -- definitions for mixed size 32/64 bit arithmetic. -Copyright 1991-1994, 1996, 1997, 1999-2005, 2007-2009, 2011-2015 Free Software +Copyright 1991-1994, 1996, 1997, 1999-2005, 2007-2009, 2011-2016 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -424,17 +424,17 @@ long __MPN(count_leading_zeros) (UDItype); : "=r" (sh), \ "=&r" (sl) \ : "r" ((USItype) (ah)), \ - "rIJ" ((USItype) (bh)), \ + "rICal" ((USItype) (bh)), \ "%r" ((USItype) (al)), \ - "rIJ" ((USItype) (bl))) + "rICal" ((USItype) (bl))) #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ __asm__ ("sub.f\t%1, %4, %5\n\tsbc\t%0, %2, %3" \ : "=r" (sh), \ "=&r" (sl) \ : "r" ((USItype) (ah)), \ - "rIJ" ((USItype) (bh)), \ + "rICal" ((USItype) (bh)), \ "r" ((USItype) (al)), \ - "rIJ" ((USItype) (bl))) + "rICal" ((USItype) (bl))) #endif #if defined (__arm__) && (defined (__thumb2__) || !defined (__thumb__)) \ @@ -506,6 +506,7 @@ long __MPN(count_leading_zeros) (UDItype); : "r" ((USItype) (a)), "r" ((USItype) (b)) __CLOBBER_CC); \ } while (0) #define UMUL_TIME 20 +#ifndef LONGLONG_STANDALONE #define udiv_qrnnd(q, r, n1, n0, d) \ do { UWtype __r; \ (q) = __MPN(udiv_qrnnd) (&__r, (n1), (n0), (d)); \ @@ -513,6 +514,7 @@ long __MPN(count_leading_zeros) (UDItype); } while (0) extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype); #define UDIV_TIME 200 +#endif /* LONGLONG_STANDALONE */ #else /* ARMv4 or newer */ #define umul_ppmm(xh, xl, a, b) \ __asm__ ("umull %0,%1,%2,%3" : "=&r" (xl), "=&r" (xh) : "r" (a), "r" (b)) @@ -1895,11 +1897,11 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype); /* FIXME: "sidi" here is highly doubtful, should sometimes be "diti". */ #if !defined (umul_ppmm) && defined (__umulsidi3) #define umul_ppmm(ph, pl, m0, m1) \ - { \ + do { \ UDWtype __ll = __umulsidi3 (m0, m1); \ ph = (UWtype) (__ll >> W_TYPE_SIZE); \ pl = (UWtype) __ll; \ - } + } while (0) #endif #if !defined (__umulsidi3) @@ -2104,7 +2106,8 @@ extern __longlong_h_C UWtype mpn_udiv_qrnnd_r (UWtype, UWtype, UWtype, UWtype *) /* If the processor has no udiv_qrnnd but sdiv_qrnnd, go through __udiv_w_sdiv (defined in libgcc or elsewhere). */ -#if !defined (udiv_qrnnd) && defined (sdiv_qrnnd) +#if !defined (udiv_qrnnd) && defined (sdiv_qrnnd) \ + && ! defined (LONGLONG_STANDALONE) #define udiv_qrnnd(q, r, nh, nl, d) \ do { \ UWtype __r; \ diff --git a/Build/source/libs/gmp/gmp-src/mini-gmp/mini-gmp.c b/Build/source/libs/gmp/gmp-src/mini-gmp/mini-gmp.c index 7300614dd17..04bed3f51dd 100644 --- a/Build/source/libs/gmp/gmp-src/mini-gmp/mini-gmp.c +++ b/Build/source/libs/gmp/gmp-src/mini-gmp/mini-gmp.c @@ -2,7 +2,7 @@ Contributed to the GNU project by Niels Möller -Copyright 1991-1997, 1999-2015 Free Software Foundation, Inc. +Copyright 1991-1997, 1999-2016 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -69,8 +69,10 @@ see https://www.gnu.org/licenses/. */ #define GMP_MIN(a, b) ((a) < (b) ? (a) : (b)) #define GMP_MAX(a, b) ((a) > (b) ? (a) : (b)) +#define GMP_CMP(a,b) (((a) > (b)) - ((a) < (b))) + #define gmp_assert_nocarry(x) do { \ - mp_limb_t __cy = x; \ + mp_limb_t __cy = (x); \ assert (__cy == 0); \ } while (0) @@ -454,7 +456,7 @@ mpn_sub_1 (mp_ptr rp, mp_srcptr ap, mp_size_t n, mp_limb_t b) { mp_limb_t a = ap[i]; /* Carry out */ - mp_limb_t cy = a < b;; + mp_limb_t cy = a < b; rp[i] = a - b; b = cy; } @@ -701,24 +703,68 @@ mpn_scan0 (mp_srcptr ptr, mp_bitcnt_t bit) i, ptr, i, GMP_LIMB_MAX); } +void +mpn_com (mp_ptr rp, mp_srcptr up, mp_size_t n) +{ + while (--n >= 0) + *rp++ = ~ *up++; +} + +mp_limb_t +mpn_neg (mp_ptr rp, mp_srcptr up, mp_size_t n) +{ + while (*up == 0) + { + *rp = 0; + if (!--n) + return 0; + ++up; ++rp; + } + *rp = - *up; + mpn_com (++rp, ++up, --n); + return 1; +} + /* MPN division interface. */ + +/* The 3/2 inverse is defined as + + m = floor( (B^3-1) / (B u1 + u0)) - B +*/ mp_limb_t mpn_invert_3by2 (mp_limb_t u1, mp_limb_t u0) { - mp_limb_t r, p, m; - unsigned ul, uh; - unsigned ql, qh; + mp_limb_t r, p, m, ql; + unsigned ul, uh, qh; - /* First, do a 2/1 inverse. */ - /* The inverse m is defined as floor( (B^2 - 1 - u1)/u1 ), so that 0 < - * B^2 - (B + m) u1 <= u1 */ assert (u1 >= GMP_LIMB_HIGHBIT); + /* For notation, let b denote the half-limb base, so that B = b^2. + Split u1 = b uh + ul. */ ul = u1 & GMP_LLIMB_MASK; uh = u1 >> (GMP_LIMB_BITS / 2); + /* Approximation of the high half of quotient. Differs from the 2/1 + inverse of the half limb uh, since we have already subtracted + u0. */ qh = ~u1 / uh; + + /* Adjust to get a half-limb 3/2 inverse, i.e., we want + + qh' = floor( (b^3 - 1) / u) - b = floor ((b^3 - b u - 1) / u + = floor( (b (~u) + b-1) / u), + + and the remainder + + r = b (~u) + b-1 - qh (b uh + ul) + = b (~u - qh uh) + b-1 - qh ul + + Subtraction of qh ul may underflow, which implies adjustments. + But by normalization, 2 u >= B > qh ul, so we need to adjust by + at most 2. + */ + r = ((~u1 - (mp_limb_t) qh * uh) << (GMP_LIMB_BITS / 2)) | GMP_LLIMB_MASK; p = (mp_limb_t) qh * ul; @@ -736,11 +782,19 @@ mpn_invert_3by2 (mp_limb_t u1, mp_limb_t u0) } r -= p; - /* Do a 3/2 division (with half limb size) */ + /* Low half of the quotient is + + ql = floor ( (b r + b-1) / u1). + + This is a 3/2 division (on half-limbs), for which qh is a + suitable inverse. */ + p = (r >> (GMP_LIMB_BITS / 2)) * qh + r; + /* Unlike full-limb 3/2, we can add 1 without overflow. For this to + work, it is essential that ql is a full mp_limb_t. */ ql = (p >> (GMP_LIMB_BITS / 2)) + 1; - /* By the 3/2 method, we don't need the high half limb. */ + /* By the 3/2 trick, we don't need the high half limb. */ r = (r << (GMP_LIMB_BITS / 2)) + GMP_LLIMB_MASK - ql * u1; if (r >= (p << (GMP_LIMB_BITS / 2))) @@ -755,6 +809,8 @@ mpn_invert_3by2 (mp_limb_t u1, mp_limb_t u0) r -= u1; } + /* Now m is the 2/1 invers of u1. If u0 > 0, adjust it to become a + 3/2 inverse. */ if (u0 > 0) { mp_limb_t th, tl; @@ -1159,7 +1215,7 @@ mpn_get_str_bits (unsigned char *sp, unsigned bits, mp_srcptr up, mp_size_t un) unsigned char mask; size_t sn, j; mp_size_t i; - int shift; + unsigned shift; sn = ((un - 1) * GMP_LIMB_BITS + mpn_limb_size_in_base_2 (up[un-1]) + bits - 1) / bits; @@ -1300,6 +1356,8 @@ mpn_set_str_bits (mp_ptr rp, const unsigned char *sp, size_t sn, return rn; } +/* Result is usually normalized, except for all-zero input, in which + case a single zero limb is written at *RP, and 1 is returned. */ static mp_size_t mpn_set_str_other (mp_ptr rp, const unsigned char *sp, size_t sn, mp_limb_t b, const struct mpn_base_info *info) @@ -1309,6 +1367,8 @@ mpn_set_str_other (mp_ptr rp, const unsigned char *sp, size_t sn, unsigned k; size_t j; + assert (sn > 0); + k = 1 + (sn - 1) % info->exp; j = 0; @@ -1318,7 +1378,7 @@ mpn_set_str_other (mp_ptr rp, const unsigned char *sp, size_t sn, rp[0] = w; - for (rn = (w > 0); j < sn;) + for (rn = 1; j < sn;) { mp_limb_t cy; @@ -1361,9 +1421,11 @@ mpn_set_str (mp_ptr rp, const unsigned char *sp, size_t sn, int base) void mpz_init (mpz_t r) { - r->_mp_alloc = 1; + static const mp_limb_t dummy_limb = 0xc1a0; + + r->_mp_alloc = 0; r->_mp_size = 0; - r->_mp_d = gmp_xalloc_limbs (1); + r->_mp_d = (mp_ptr) &dummy_limb; } /* The utility of this function is a bit limited, since many functions @@ -1384,7 +1446,8 @@ mpz_init2 (mpz_t r, mp_bitcnt_t bits) void mpz_clear (mpz_t r) { - gmp_free (r->_mp_d); + if (r->_mp_alloc) + gmp_free (r->_mp_d); } static mp_ptr @@ -1392,7 +1455,10 @@ mpz_realloc (mpz_t r, mp_size_t size) { size = GMP_MAX (size, 1); - r->_mp_d = gmp_xrealloc_limbs (r->_mp_d, size); + if (r->_mp_alloc) + r->_mp_d = gmp_xrealloc_limbs (r->_mp_d, size); + else + r->_mp_d = gmp_xalloc_limbs (size); r->_mp_alloc = size; if (GMP_ABS (r->_mp_size) > size) @@ -1415,7 +1481,7 @@ mpz_set_si (mpz_t r, signed long int x) else /* (x < 0) */ { r->_mp_size = -1; - r->_mp_d[0] = GMP_NEG_CAST (unsigned long int, x); + MPZ_REALLOC (r, 1)[0] = GMP_NEG_CAST (unsigned long int, x); } } @@ -1425,7 +1491,7 @@ mpz_set_ui (mpz_t r, unsigned long int x) if (x > 0) { r->_mp_size = 1; - r->_mp_d[0] = x; + MPZ_REALLOC (r, 1)[0] = x; } else r->_mp_size = 0; @@ -1493,14 +1559,11 @@ mpz_fits_ulong_p (const mpz_t u) long int mpz_get_si (const mpz_t u) { - mp_size_t us = u->_mp_size; - - if (us > 0) - return (long) (u->_mp_d[0] & ~GMP_LIMB_HIGHBIT); - else if (us < 0) - return (long) (- u->_mp_d[0] | GMP_LIMB_HIGHBIT); + if (u->_mp_size < 0) + /* This expression is necessary to properly handle 0x80000000 */ + return -1 - (long) ((u->_mp_d[0] - 1) & ~GMP_LIMB_HIGHBIT); else - return 0; + return (long) (mpz_get_ui (u) & ~GMP_LIMB_HIGHBIT); } unsigned long int @@ -1533,7 +1596,7 @@ mpz_realloc2 (mpz_t x, mp_bitcnt_t n) mp_srcptr mpz_limbs_read (mpz_srcptr x) { - return x->_mp_d;; + return x->_mp_d; } mp_ptr @@ -1713,9 +1776,7 @@ mpz_cmp_d (const mpz_t x, double d) int mpz_sgn (const mpz_t u) { - mp_size_t usize = u->_mp_size; - - return (usize > 0) - (usize < 0); + return GMP_CMP (u->_mp_size, 0); } int @@ -1730,13 +1791,7 @@ mpz_cmp_si (const mpz_t u, long v) else if (usize >= 0) return 1; else /* usize == -1 */ - { - mp_limb_t ul = u->_mp_d[0]; - if ((mp_limb_t)GMP_NEG_CAST (unsigned long int, v) < ul) - return -1; - else - return (mp_limb_t)GMP_NEG_CAST (unsigned long int, v) > ul; - } + return GMP_CMP (GMP_NEG_CAST (mp_limb_t, v), u->_mp_d[0]); } int @@ -1749,10 +1804,7 @@ mpz_cmp_ui (const mpz_t u, unsigned long v) else if (usize < 0) return -1; else - { - mp_limb_t ul = (usize > 0) ? u->_mp_d[0] : 0; - return (ul > v) - (ul < v); - } + return GMP_CMP (mpz_get_ui (u), v); } int @@ -1772,15 +1824,10 @@ mpz_cmp (const mpz_t a, const mpz_t b) int mpz_cmpabs_ui (const mpz_t u, unsigned long v) { - mp_size_t un = GMP_ABS (u->_mp_size); - mp_limb_t ul; - - if (un > 1) + if (GMP_ABS (u->_mp_size) > 1) return 1; - - ul = (un == 1) ? u->_mp_d[0] : 0; - - return (ul > v) - (ul < v); + else + return GMP_CMP (mpz_get_ui (u), v); } int @@ -1826,7 +1873,7 @@ mpz_abs_add_ui (mpz_t r, const mpz_t a, unsigned long b) an = GMP_ABS (a->_mp_size); if (an == 0) { - r->_mp_d[0] = b; + MPZ_REALLOC (r, 1)[0] = b; return b > 0; } @@ -1845,14 +1892,15 @@ static mp_size_t mpz_abs_sub_ui (mpz_t r, const mpz_t a, unsigned long b) { mp_size_t an = GMP_ABS (a->_mp_size); - mp_ptr rp = MPZ_REALLOC (r, an); + mp_ptr rp; if (an == 0) { - rp[0] = b; + MPZ_REALLOC (r, 1)[0] = b; return -(b > 0); } - else if (an == 1 && a->_mp_d[0] < b) + rp = MPZ_REALLOC (r, an); + if (an == 1 && a->_mp_d[0] < b) { rp[0] = b - a->_mp_d[0]; return -1; @@ -2323,7 +2371,6 @@ mpz_div_q_2exp (mpz_t q, const mpz_t u, mp_bitcnt_t bit_index, if (qn <= 0) qn = 0; - else { qp = MPZ_REALLOC (q, qn); @@ -2377,16 +2424,9 @@ mpz_div_r_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t bit_index, { /* Have to negate and sign extend. */ mp_size_t i; - mp_limb_t cy; - for (cy = 1, i = 0; i < un; i++) - { - mp_limb_t s = ~u->_mp_d[i] + cy; - cy = s < cy; - rp[i] = s; - } - assert (cy == 0); - for (; i < rn - 1; i++) + gmp_assert_nocarry (! mpn_neg (rp, u->_mp_d, un)); + for (i = un; i < rn - 1; i++) rp[i] = GMP_LIMB_MAX; rp[rn-1] = mask; @@ -2411,23 +2451,13 @@ mpz_div_r_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t bit_index, if (mode == ((us > 0) ? GMP_DIV_CEIL : GMP_DIV_FLOOR)) /* us != 0 here. */ { /* If r != 0, compute 2^{bit_count} - r. */ - mp_size_t i; - - for (i = 0; i < rn && rp[i] == 0; i++) - ; - if (i < rn) - { - /* r > 0, need to flip sign. */ - rp[i] = ~rp[i] + 1; - while (++i < rn) - rp[i] = ~rp[i]; + mpn_neg (rp, rp, rn); - rp[rn-1] &= mask; + rp[rn-1] &= mask; - /* us is not used for anything else, so we can modify it - here to indicate flipped sign. */ - us = -us; - } + /* us is not used for anything else, so we can modify it + here to indicate flipped sign. */ + us = -us; } } rn = mpn_normalized_size (rp, rn); @@ -2542,7 +2572,7 @@ mpz_div_qr_ui (mpz_t q, mpz_t r, if (r) { - r->_mp_d[0] = rl; + MPZ_REALLOC (r, 1)[0] = rl; r->_mp_size = rs; } if (q) @@ -3203,12 +3233,8 @@ mpz_rootrem (mpz_t x, mpz_t r, const mpz_t y, unsigned long z) } mpz_init (u); - { - mp_bitcnt_t tb; - tb = mpz_sizeinbase (y, 2) / z + 1; - mpz_init2 (t, tb + 1); - mpz_setbit (t, tb); - } + mpz_init (t); + mpz_setbit (t, mpz_sizeinbase (y, 2) / z + 1); if (z == 2) /* simplify sqrt loop: z-1 == 1 */ do { @@ -3635,7 +3661,7 @@ mpz_and (mpz_t r, const mpz_t u, const mpz_t v) /* If the smaller input is positive, higher limbs don't matter. */ rn = vx ? un : vn; - rp = MPZ_REALLOC (r, rn + rc); + rp = MPZ_REALLOC (r, rn + (mp_size_t) rc); up = u->_mp_d; vp = v->_mp_d; @@ -3708,7 +3734,7 @@ mpz_ior (mpz_t r, const mpz_t u, const mpz_t v) don't matter. */ rn = vx ? vn : un; - rp = MPZ_REALLOC (r, rn + rc); + rp = MPZ_REALLOC (r, rn + (mp_size_t) rc); up = u->_mp_d; vp = v->_mp_d; @@ -3777,7 +3803,7 @@ mpz_xor (mpz_t r, const mpz_t u, const mpz_t v) vx = -vc; rx = -rc; - rp = MPZ_REALLOC (r, un + rc); + rp = MPZ_REALLOC (r, un + (mp_size_t) rc); up = u->_mp_d; vp = v->_mp_d; @@ -4100,7 +4126,7 @@ mpz_set_str (mpz_t r, const char *sp, int base) unsigned bits; mp_size_t rn, alloc; mp_ptr rp; - size_t sn; + size_t dn; int sign; unsigned char *dp; @@ -4114,18 +4140,17 @@ mpz_set_str (mpz_t r, const char *sp, int base) if (base == 0) { - if (*sp == '0') + if (sp[0] == '0') { - sp++; - if (*sp == 'x' || *sp == 'X') + if (sp[1] == 'x' || sp[1] == 'X') { base = 16; - sp++; + sp += 2; } - else if (*sp == 'b' || *sp == 'B') + else if (sp[1] == 'b' || sp[1] == 'B') { base = 2; - sp++; + sp += 2; } else base = 8; @@ -4134,16 +4159,20 @@ mpz_set_str (mpz_t r, const char *sp, int base) base = 10; } - sn = strlen (sp); - dp = (unsigned char *) gmp_xalloc (sn + (sn == 0)); + if (!*sp) + { + r->_mp_size = 0; + return -1; + } + dp = (unsigned char *) gmp_xalloc (strlen (sp)); - for (sn = 0; *sp; sp++) + for (dn = 0; *sp; sp++) { unsigned digit; if (isspace ((unsigned char) *sp)) continue; - if (*sp >= '0' && *sp <= '9') + else if (*sp >= '0' && *sp <= '9') digit = *sp - '0'; else if (*sp >= 'a' && *sp <= 'z') digit = *sp - 'a' + 10; @@ -4152,31 +4181,40 @@ mpz_set_str (mpz_t r, const char *sp, int base) else digit = base; /* fail */ - if (digit >= base) + if (digit >= (unsigned) base) { gmp_free (dp); r->_mp_size = 0; return -1; } - dp[sn++] = digit; + dp[dn++] = digit; } + if (!dn) + { + gmp_free (dp); + r->_mp_size = 0; + return -1; + } bits = mpn_base_power_of_two_p (base); if (bits > 0) { - alloc = (sn * bits + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS; + alloc = (dn * bits + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS; rp = MPZ_REALLOC (r, alloc); - rn = mpn_set_str_bits (rp, dp, sn, bits); + rn = mpn_set_str_bits (rp, dp, dn, bits); } else { struct mpn_base_info info; mpn_get_base_info (&info, base); - alloc = (sn + info.exp - 1) / info.exp; + alloc = (dn + info.exp - 1) / info.exp; rp = MPZ_REALLOC (r, alloc); - rn = mpn_set_str_other (rp, dp, sn, base, &info); + rn = mpn_set_str_other (rp, dp, dn, base, &info); + /* Normalization, needed for all-zero input. */ + assert (rn > 0); + rn -= rp[rn-1] == 0; } assert (rn <= alloc); gmp_free (dp); diff --git a/Build/source/libs/gmp/gmp-src/mini-gmp/mini-gmp.h b/Build/source/libs/gmp/gmp-src/mini-gmp/mini-gmp.h index 450c3e561b0..bb5c6371d93 100644 --- a/Build/source/libs/gmp/gmp-src/mini-gmp/mini-gmp.h +++ b/Build/source/libs/gmp/gmp-src/mini-gmp/mini-gmp.h @@ -108,6 +108,9 @@ mp_limb_t mpn_rshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int); mp_bitcnt_t mpn_scan0 (mp_srcptr, mp_bitcnt_t); mp_bitcnt_t mpn_scan1 (mp_srcptr, mp_bitcnt_t); +void mpn_com (mp_ptr, mp_srcptr, mp_size_t); +mp_limb_t mpn_neg (mp_ptr, mp_srcptr, mp_size_t); + mp_bitcnt_t mpn_popcount (mp_srcptr, mp_size_t); mp_limb_t mpn_invert_3by2 (mp_limb_t, mp_limb_t); diff --git a/Build/source/libs/gmp/gmp-src/mpn/generic/dive_1.c b/Build/source/libs/gmp/gmp-src/mpn/generic/dive_1.c index 1c0a4e894db..2eaaf694e33 100644 --- a/Build/source/libs/gmp/gmp-src/mpn/generic/dive_1.c +++ b/Build/source/libs/gmp/gmp-src/mpn/generic/dive_1.c @@ -118,7 +118,6 @@ mpn_divexact_1 (mp_ptr dst, mp_srcptr src, mp_size_t size, mp_limb_t divisor) umul_ppmm (h, dummy, l, divisor); c += h; } - while (i < size); ls = s >> shift; l = ls - c; diff --git a/Build/source/libs/gmp/gmp-src/mpn/x86_64/fat/fat_entry.asm b/Build/source/libs/gmp/gmp-src/mpn/x86_64/fat/fat_entry.asm index 764e3d82f2b..8f7599dd587 100644 --- a/Build/source/libs/gmp/gmp-src/mpn/x86_64/fat/fat_entry.asm +++ b/Build/source/libs/gmp/gmp-src/mpn/x86_64/fat/fat_entry.asm @@ -3,7 +3,7 @@ dnl x86 fat binary entrypoints. dnl Contributed to the GNU project by Kevin Ryde (original x86_32 code) and dnl Torbjorn Granlund (port to x86_64) -dnl Copyright 2003, 2009, 2011-2014 Free Software Foundation, Inc. +dnl Copyright 2003, 2009, 2011-2014, 2016 Free Software Foundation, Inc. dnl This file is part of the GNU MP Library. dnl @@ -45,13 +45,16 @@ define(`WANT_PROFILING',no) dnl We define PRETEND_PIC as a helper symbol, the use it for suppressing -dnl normal, fast call code, since that triggers problems on Darwin and -dnl OpenBSD. +dnl normal, fast call code, since that triggers problems on Darwin, OpenBSD +dnl and some versions of GNU/Linux. This will go away when symbol hiding is +dnl finished. ifdef(`DARWIN', `define(`PRETEND_PIC')') ifdef(`OPENBSD', `define(`PRETEND_PIC')') +ifdef(`LINUX', +`define(`PRETEND_PIC')') ifdef(`PIC', `define(`PRETEND_PIC')') diff --git a/Build/source/libs/gmp/gmp-src/mpz/inp_raw.c b/Build/source/libs/gmp/gmp-src/mpz/inp_raw.c index d95c19ede72..b7994a3604b 100644 --- a/Build/source/libs/gmp/gmp-src/mpz/inp_raw.c +++ b/Build/source/libs/gmp/gmp-src/mpz/inp_raw.c @@ -1,6 +1,6 @@ /* mpz_inp_raw -- read an mpz_t in raw format. -Copyright 2001, 2002, 2005, 2012 Free Software Foundation, Inc. +Copyright 2001, 2002, 2005, 2012, 2016 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -66,6 +66,7 @@ mpz_inp_raw (mpz_ptr x, FILE *fp) { unsigned char csize_bytes[4]; mp_size_t csize, abs_xsize, i; + size_t size; size_t abs_csize; char *cp; mp_ptr xp, sp, ep; @@ -78,17 +79,13 @@ mpz_inp_raw (mpz_ptr x, FILE *fp) if (fread (csize_bytes, sizeof (csize_bytes), 1, fp) != 1) return 0; - csize = - ( (mp_size_t) csize_bytes[0] << 24) - + ((mp_size_t) csize_bytes[1] << 16) - + ((mp_size_t) csize_bytes[2] << 8) - + ((mp_size_t) csize_bytes[3]); - - /* Sign extend if necessary. - Could write "csize -= ((csize & 0x80000000L) << 1)", but that tickles a - bug in gcc 3.0 for powerpc64 on AIX. */ - if (sizeof (csize) > 4 && csize & 0x80000000L) - csize -= 0x80000000L << 1; + size = (((size_t) csize_bytes[0] << 24) + ((size_t) csize_bytes[1] << 16) + + ((size_t) csize_bytes[2] << 8) + ((size_t) csize_bytes[3])); + + if (size < 0x80000000u) + csize = size; + else + csize = size - 0x80000000u - 0x80000000u; abs_csize = ABS (csize); diff --git a/Build/source/libs/gmp/gmp-src/mpz/kronsz.c b/Build/source/libs/gmp/gmp-src/mpz/kronsz.c index 12c8fbd0aa1..1fb6e075b63 100644 --- a/Build/source/libs/gmp/gmp-src/mpz/kronsz.c +++ b/Build/source/libs/gmp/gmp-src/mpz/kronsz.c @@ -72,7 +72,7 @@ mpz_si_kronecker (long a, mpz_srcptr b) /* b odd */ result_bit1 ^= JACOBI_ASGN_SU_BIT1 (a, b_low); - a_limb = (unsigned long) ABS(a); + a_limb = ABS_CAST(mp_limb_t, a); if ((a_limb & 1) == 0) { diff --git a/Build/source/libs/gmp/native/configure b/Build/source/libs/gmp/native/configure index a73b3119efe..5daf7b59984 100755 --- a/Build/source/libs/gmp/native/configure +++ b/Build/source/libs/gmp/native/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for gmp native 6.1.1. +# Generated by GNU Autoconf 2.69 for gmp native 6.1.2. # # Report bugs to <tex-k@tug.org>. # @@ -579,8 +579,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='gmp native' PACKAGE_TARNAME='gmp-native' -PACKAGE_VERSION='6.1.1' -PACKAGE_STRING='gmp native 6.1.1' +PACKAGE_VERSION='6.1.2' +PACKAGE_STRING='gmp native 6.1.2' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' @@ -1234,7 +1234,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures gmp native 6.1.1 to adapt to many kinds of systems. +\`configure' configures gmp native 6.1.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1300,7 +1300,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of gmp native 6.1.1:";; + short | recursive ) echo "Configuration of gmp native 6.1.2:";; esac cat <<\_ACEOF @@ -1396,7 +1396,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -gmp native configure 6.1.1 +gmp native configure 6.1.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1497,7 +1497,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by gmp native $as_me 6.1.1, which was +It was created by gmp native $as_me 6.1.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3420,7 +3420,7 @@ fi # Define the identity of the package. PACKAGE='gmp-native' - VERSION='6.1.1' + VERSION='6.1.2' cat >>confdefs.h <<_ACEOF @@ -4974,7 +4974,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by gmp native $as_me 6.1.1, which was +This file was extended by gmp native $as_me 6.1.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -5040,7 +5040,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -gmp native config.status 6.1.1 +gmp native config.status 6.1.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/Build/source/libs/gmp/version.ac b/Build/source/libs/gmp/version.ac index 792ff0fa667..7a1c20f9da0 100644 --- a/Build/source/libs/gmp/version.ac +++ b/Build/source/libs/gmp/version.ac @@ -8,4 +8,4 @@ dnl dnl -------------------------------------------------------- dnl dnl m4-include this file to define the current gmp version -m4_define([gmp_version], [6.1.1]) +m4_define([gmp_version], [6.1.2]) |