]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Add a workaround to prevent endless recursion in compiler-rt.
authorEd Schouten <ed@FreeBSD.org>
Thu, 12 Jan 2012 16:51:56 +0000 (16:51 +0000)
committerEd Schouten <ed@FreeBSD.org>
Thu, 12 Jan 2012 16:51:56 +0000 (16:51 +0000)
commita8c104fbb0feae30333ba287f5a98b6b5a8e813e
tree8cbb11907e7e05bd2635155b5bd20296bd807099
parent72c131535d1f861b235f2dba4099a91eb21a3663
Add a workaround to prevent endless recursion in compiler-rt.

SPARC and MIPS CPUs don't have special instructions to count
leading/trailing zeroes. The compiler-rt library provides fallback
rountines for these. The 64-bit routines, __clzdi2 and __ctzdi2, are
implemented as simple wrappers around the compiler built-in
__builtin_clz(), assuming these will expand to either 32-bit
CPU instructions or calls to __clzsi2 and __ctzsi2.

Unfortunately, our GCC 4.2 probably thinks that because the operand is
stored in a 64-bit register, it might just be a better idea to invoke
its 64-bit equivalent, simply resulting into endless recursion. Fix this
by defining __builtin_clz and __builtin_ctz to __clzsi2 and __ctzsi2
explicitly.
contrib/compiler-rt/lib/int_lib.h