darwin clang linkage fix
Jack Howarth
howarth at bromo.med.uc.edu
Wed Apr 6 01:21:53 CEST 2011
On Tue, Apr 05, 2011 at 06:53:41PM -0400, Jack Howarth wrote:
> 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
> ^
>
Comparing the config.m4 files for an Apple gcc-4.2 and clang build
shows...
--- build/config.m4 2011-04-05 19:02:31.000000000 -0400
+++ build.clang/config.m4 2011-04-05 18:36:44.000000000 -0400
@@ -11,9 +11,9 @@
define(<GLOBL>, <.globl>)
define(<GLOBL_ATTR>, <>)
define(<GSYM_PREFIX>, <_>)
-define(<RODATA>, <.text>)
-define(<TYPE>, <>)
-define(<SIZE>, <>)
+define(<RODATA>, < .section __TEXT,__const>)
+define(<TYPE>, <.type $1,@$2>)
+define(<SIZE>, <.size $1,$2>)
define(<LSYM_PREFIX>, <L>)
define(<W32>, <.long>)
define(<ALIGN_LOGARITHMIC>,<yes>)
It appears that the current acinclude.m4 confuses the warning...
configure:26474: checking for assembler .type directive
configure:26485: clang -c -O2 -pedantic -m64 -mtune=core2 -march=core2 conftest.s >conftest.out 2>&1
configure:26488: $? = 0
/tmp/cc-68DYYR.s:5:2: warning: ignoring directive for now
.type sym, at function
^
configure:26508: result: .type $1,@$2
configure:26512: checking for assembler .size directive
configure:26522: clang -c -O2 -pedantic -m64 -mtune=core2 -march=core2 conftest.s >conftest.out 2>&1
configure:26525: $? = 0
/tmp/cc-naVqNU.s:5:2: warning: ignoring directive for now
.size sym,1
^
configure:26542: result: .size $1,$2
in config.log as actual support for these features. Hopefully if we fix this issue,
the make check results may improve.
Jack
> throughout the build. I suspect this is a known issue with darwin clang
> but will check upstream.
> Jack
> _______________________________________________
> gmp-bugs mailing list
> gmp-bugs at gmplib.org
> https://gmplib.org/mailman/listinfo/gmp-bugs
More information about the gmp-bugs
mailing list