bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: __builtin_add_overflow on clang


From: Paul Eggert
Subject: Re: __builtin_add_overflow on clang
Date: Tue, 27 Aug 2019 04:27:01 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

Mattias EngdegÄrd wrote:
__builtin_mul_overflow(long long) does expand to a call to __mulodi4 when 
building for 32-bit x86 even with current Clang; either this function is absent 
from libgcc and these platforms do not link to compiler-rt, or their 
compiler-rt is somehow built without it. The former seems more likely.
Did the bug report include any Clang/LLVM version information?

No, he built with lots of clangs on lots of platforms, many with clang locally installed instead of being packaged by the vendor, and he typically didn't give version numbers.

He did mention that openSUSE 13 had the relevant library here:

/usr/local/ashare/llvm/llvm-20140716/lib/clang/3.5.0/lib/linux/libclang_rt.builtins-x86_64.a

but it wasn't clear whether this library was from an optional package as opposed to the barebones Clang package. He also said that this particular library "is absent from some later clang releases" - not sure whether that means absent from that package in openSUSE, or something else.

In many of the builds he could get clang to work by configuring with CC=clang LDFLAGS=--rtlib=compiler-rt. However, this wasn't always enough. Eventually he gave up on using clang to compile GNU sed because of the __builtin_mul_overflow hassle.

We can safely assume that macOS will use compiler-rt by default rather than 
libgcc

In that case I installed the attached, which uses __builtin_mul_overflow with Clang on macOS.

Attachment: 0001-Speed-up-INT_MULTIPLY_WRAPV-on-macOS.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]