diff options
Diffstat (limited to 'lib/libcompiler_rt/clzdi2.c')
-rw-r--r-- | lib/libcompiler_rt/clzdi2.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/libcompiler_rt/clzdi2.c b/lib/libcompiler_rt/clzdi2.c index b9e64da492b..b56d98f5c01 100644 --- a/lib/libcompiler_rt/clzdi2.c +++ b/lib/libcompiler_rt/clzdi2.c @@ -16,6 +16,12 @@ /* Returns: the number of leading 0-bits */ +#if !defined(__clang__) && (defined(__sparc64__) || defined(__mips64) || defined(__riscv__)) +/* gcc resolves __builtin_clz -> __clzdi2 leading to infinite recursion */ +#define __builtin_clz(a) __clzsi2(a) +extern si_int __clzsi2(si_int); +#endif + /* Precondition: a != 0 */ COMPILER_RT_ABI si_int |