darwin clang linkage fix

Jack Howarth howarth at bromo.med.uc.edu
Wed Apr 6 00:53:41 CEST 2011


   The change...

--- acinclude.m4.orig	2011-04-05 18:29:17.000000000 -0400
+++ acinclude.m4	2011-04-05 18:30:04.000000000 -0400
@@ -1941,7 +1941,7 @@
 esac
 
 cat >conftest.c <<EOF
-const int foo = 123;
+const int foo[] = { 1,2,3 };
 EOF
 echo "Test program:" >&AC_FD_CC
 cat conftest.c >&AC_FD_CC

,with regeneration of configure to utilitze it, is sufficient to solve the linkage
problems with clang from Xcode 4.0.1 under darwin10. This causes config.m4 in the 
build directory to contain...

define(<RODATA>, <      .section        __TEXT,__const>)

instead of the offending...

define(<RODATA>, <      .section        __TEXT,__literal4,4byte_literals>)

The resulting build fails the make check as...

libtool: link: clang -O2 -pedantic -m64 -mtune=core2 -march=core2 -o .libs/t-sub t-sub.o  ./.libs/libtests.a /sw/src/gmp-5.0.1/build/.libs/libgmp.dylib ../.libs/libgmp.dylib
make  check-TESTS
PASS: t-bswap
PP_INVERTED == 21cfe6cfc938b36b, but pp_inverted_calc == 2255c453a87eca4f

After gmp.h,
  ULONG_MAX  not defined
  LONG_MAX   not defined
  UINT_MAX   not defined
  INT_MAX    not defined
  USHRT_MAX  not defined
  SHRT_MAX   not defined

ULONG_MAX      FFFFFFFFFFFFFFFF
ULONG_HIGHBIT  8000000000000000
LONG_MAX       7FFFFFFFFFFFFFFF
LONG_MIN       8000000000000000
UINT_MAX       FFFFFFFF
UINT_HIGHBIT   80000000
INT_MAX        7FFFFFFF
INT_MIN        80000000
USHRT_MAX      FFFF
USHRT_HIGHBIT  8000
SHRT_MAX       7FFF
SHRT_MIN       8000

Bits
  long           64
  int            32
  short          16
  unsigned long  64
  unsigned int   32
  unsigned short 16
  mp_size_t      64
/bin/sh: line 1: 28615 Abort trap              ${dir}$tst
FAIL: t-constants
PASS: t-count_zeros
PASS: t-gmpmax
PASS: t-hightomask
PASS: t-modlinv
PASS: t-popc
PASS: t-parity
PASS: t-sub
====================================
1 of 9 tests failed
Please report to gmp-bugs at gmplib.org
====================================
make[4]: *** [check-TESTS] Error 1
make[3]: *** [check-am] Error 2
make[2]: *** [check-recursive] Error 1
make[1]: *** [check-recursive] Error 1

but I believe this may be due to the remaining warnings...

/bin/sh ../libtool --mode=compile --tag=CC ../../mpn/m4-ccas --m4="m4" clang -c -DHAVE_CONFIG_H -I. -I../../mpn -I.. -D__GMP_WITHIN_GMP -I../.. -DOPERATION_`echo com | sed 's/_$//'`    -O2 -pedantic -m64 -mtune=core2 -march=core2  `test -f 'com.asm' || echo '../../mpn/'`com.asm
/tmp/cc-611GcV.s:10:2: warning: ignoring directive for now
 .type ___gmpn_add_nc, at function
 ^
/tmp/cc-611GcV.s:14:2: warning: ignoring directive for now
 .size ___gmpn_add_nc,.-___gmpn_add_nc
 ^
/tmp/cc-611GcV.s:17:2: warning: ignoring directive for now
 .type ___gmpn_add_n, at function
 ^
/tmp/cc-i1zwl9.s:10:2: warning: ignoring directive for now
 .type ___gmpn_sub_nc, at function
 ^
/tmp/cc-611GcV.s:86:2: warning: ignoring directive for now
 .size ___gmpn_add_n,.-___gmpn_add_n
 ^
/tmp/cc-i1zwl9.s:14:2: warning: ignoring directive for now
 .size ___gmpn_sub_nc,.-___gmpn_sub_nc
 ^
/tmp/cc-i1zwl9.s:17:2: warning: ignoring directive for now
 .type ___gmpn_sub_n, at function
 ^
/tmp/cc-i1zwl9.s:86:2: warning: ignoring directive for now
 .size ___gmpn_sub_n,.-___gmpn_sub_n
 ^

throughout the build. I suspect this is a known issue with darwin clang
but will check upstream.
         Jack


More information about the gmp-bugs mailing list