GMP 6.1.0 without assembly lacks ‘__gmpn_invert_lib’ on ARM

Ludovic Courtès ludo at gnu.org
Wed Dec 16 22:39:28 UTC 2015


tg at gmplib.org (Torbjörn Granlund) skribis:

> ludo at gnu.org (Ludovic Courtès) writes:
>
>   When GMP 6.1.0 is built with --host=none-unknown-linux-gnueabihf on
>   ARMv7 (the way GCC configures its in-tree GMP, as of GCC 4.9.3),
>   ‘__gmpn_invert_lib’ is missing from the resulting libgmp.a.

[...]

>   This seems to be expected, but then it looks as though <gmp-impl.h> was
>   erroneously referring to it, leading to undefined references, as
>   reported at <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67728>.
>   
> I've tried to reproduce this on two different ARM systems, and failed.
>
> I cannot reproduce any link errors, nor can I find the reference or
> definitions of the symbol __gmpn_invert_limb.

The undefined references come up when linking for instance GCC against
GMP:

--8<---------------cut here---------------start------------->8---
/tmp/nix-build-gcc-cross-boot0-4.9.3.drv-0/build/./gmp/.libs/libgmp.a(powm_ui.o): In function `__gmpz_powm_ui':
/tmp/nix-build-gcc-cross-boot0-4.9.3.drv-0/build/gmp/mpz/../../../gcc-4.9.3/gmp/mpz/powm_ui.c:162: undefined reference to `__gmpn_invert_limb'
/tmp/nix-build-gcc-cross-boot0-4.9.3.drv-0/build/./gmp/.libs/libgmp.a(divrem_1.o): In function `__gmpn_divrem_1':
/tmp/nix-build-gcc-cross-boot0-4.9.3.drv-0/build/gmp/mpn/divrem_1.c:149: undefined reference to `__gmpn_invert_limb'
/tmp/nix-build-gcc-cross-boot0-4.9.3.drv-0/build/gmp/mpn/divrem_1.c:228: undefined reference to `__gmpn_invert_limb'
/tmp/nix-build-gcc-cross-boot0-4.9.3.drv-0/build/./gmp/.libs/libgmp.a(divrem_2.o): In function `__gmpn_divrem_2':
/tmp/nix-build-gcc-cross-boot0-4.9.3.drv-0/build/gmp/mpn/divrem_2.c:91: undefined reference to `__gmpn_invert_limb'
/tmp/nix-build-gcc-cross-boot0-4.9.3.drv-0/build/./gmp/.libs/libgmp.a(lt86-sqrtrem.o): In function `mpn_divappr_q':
/tmp/nix-build-gcc-cross-boot0-4.9.3.drv-0/build/gmp/mpn/sqrtrem.c:280: undefined reference to `__gmpn_invert_limb'
/tmp/nix-build-gcc-cross-boot0-4.9.3.drv-0/build/./gmp/.libs/libgmp.a(div_q.o):/tmp/nix-build-gcc-cross-boot0-4.9.3.drv-0/build/gmp/mpn/div_q.c:251: more undefined references to `__gmpn_invert_limb' follow
collect2: error: ld returned 1 exit status
--8<---------------cut here---------------end--------------->8---

See <http://hydra.gnu.org/build/865660/nixlog/1/raw> for a complete log.

> It also puzzles me that you would get link errors given that
> __gmpn_invert_limb is defined in your libgmp.a.

Sorry, I pasted the “wrong” one.  Here’s what I have for a no-asm build:

--8<---------------cut here---------------start------------->8---
$ nm /gnu/store/924bg8ws2fkk4z0bifzkqg5d57pgc4w1-gmp-6.1.0/lib/libgmp.a|grep invert_limb
00000000 R __gmp_binvert_limb_table
         U __gmp_binvert_limb_table
         U __gmp_binvert_limb_table
         U __gmp_binvert_limb_table
         U __gmp_binvert_limb_table
         U __gmp_binvert_limb_table
         U __gmp_binvert_limb_table
         U __gmp_binvert_limb_table
         U __gmp_binvert_limb_table
         U __gmp_binvert_limb_table
         U __gmp_binvert_limb_table
         U __gmp_binvert_limb_table
         U __gmp_binvert_limb_table
         U __gmp_binvert_limb_table
nm: repl-vsnprintf.o: no symbols
--8<---------------cut here---------------end--------------->8---

> Note also that using "none" as CPU is deprecated and outputs a warning.

I know, but this is what GCC uses (which makes sense, because it
also supports older versions of GMP.)

I hope this clarifies things.

Thanks,
Ludo’.


More information about the gmp-bugs mailing list