Static library checking fails on mac OSX 10.9 and clang

Denis RAUX denis.raux at
Fri Nov 25 13:31:11 UTC 2016

I managed to build a static version of libgmp.a but unfortunately the check  failed with the error : 
libtool: link: gcc -std=gnu99 -ggdb -o t-bswap t-bswap.o  -L/Users/denis/DEV/SDKsrc/../SDKg/lib ./.libs/libtests.a /Users/denis/DEV/SDKsrc/gmp-6.0.0/.libs/libgmp.a ../.libs/libgmp.a
ld: pointer in read-only segment not allowed in slidable image, used in ___gmpn_divexact_1 from /Users/denis/DEV/SDKsrc/gmp-6.0.0/.libs/libgmp.a(dive_1.o)
collect2: ld returned 1 exit status
make[4]: *** [t-bswap] Error 1
make[3]: *** [check-am] Error 2
make[2]: *** [check-recursive] Error 1
make[1]: *** [check-recursive] Error 1
make: *** [check] Error 2

The dive_1.asm referes to only one external symbols :

bash-3.2$ nm -g mpn/dive_1.o
                 U ___gmp_binvert_limb_table
0000000000000000 T ___gmpn_divexact_1

This symbol is non located in a read only segment :

bash-3.2$ nm -go .libs/libgmp.a |grep mp_binvert_limb_table
nm: no name list
.libs/libgmp.a:mp_minv_tab.o: 0000000000000180 S ___gmp_binvert_limb_table
.libs/libgmp.a:bin_uiui.o:                  U ___gmp_binvert_limb_table
.libs/libgmp.a:dive_1.o:                  U ___gmp_binvert_limb_table
.libs/libgmp.a:lt79-divis.o:                  U ___gmp_binvert_limb_table
.libs/libgmp.a:mode1o.o:                  U ___gmp_binvert_limb_table
nm: no name list
nm: no name list
nm: no name list
.libs/libgmp.a:lt96-perfpow.o:                  U ___gmp_binvert_limb_table
nm: no name list
.libs/libgmp.a:binvert.o:                  U ___gmp_binvert_limb_table
.libs/libgmp.a:bdiv_q_1.o:                  U ___gmp_binvert_limb_table
.libs/libgmp.a:bdiv_q.o:                  U ___gmp_binvert_limb_table
.libs/libgmp.a:bdiv_qr.o:                  U ___gmp_binvert_limb_table
.libs/libgmp.a:broot.o:                  U ___gmp_binvert_limb_table
.libs/libgmp.a:brootinv.o:                  U ___gmp_binvert_limb_table
.libs/libgmp.a:lt104-powm.o:                  U ___gmp_binvert_limb_table
.libs/libgmp.a:sec_powm.o:                  U ___gmp_binvert_limb_table

Here are some pieces of  information about the host :
bash-3.2$ uname -a
Darwin TexMac.local 13.4.0 Darwin Kernel Version 13.4.0: Mon Jan 11 18:17:34 PST 2016; root:xnu-2422.115.15~1/RELEASE_X86_64 x86_64

bash-3.2$ gcc --version
i686-apple-darwin10-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.6)

bash-3.2$ ./config.guess
bash-3.2$ ./configfsf.guess

I attached the config.log and dive_1.asm.

I would add that the build with the —-disable-assembly option passed the check. ,This appears also with the version 5.
The shared version passes also with any problem

Best Regards,
Denis Raux
denis.raux at

More information about the gmp-bugs mailing list