[cfe-dev] How to disable built-in?

Francois Pichet pichet2000 at gmail.com
Thu May 30 13:40:02 PDT 2013

On Tue, Apr 24, 2012 at 5:21 AM, Dmitri Shubin <sbn at tbricks.com> wrote:

> Hello!
> When building Berkeley DB (checked 4.8.30 and 5.1.25) with clang (trunk)
> I got the following error:
> In file included from
> /export/home/sbn/thd/25/src/thirdparty/BerkeleyDB/5.1.25/src/src/mutex/mut_pthread.c:11:
> In file included from ./db_int.h:999:
> In file included from
> /export/home/sbn/thd/25/src/thirdparty/BerkeleyDB/5.1.25/src/src/dbinc/mutex.h:15:
> In file included from
> /export/home/sbn/thd/25/src/thirdparty/BerkeleyDB/5.1.25/src/src/dbinc/mutex_int.h:12:
> /export/home/sbn/thd/25/src/thirdparty/BerkeleyDB/5.1.25/src/src/dbinc/atomic.h:179:19:
> error: definition of builtin function '__atomic_compare_exchange'
> static inline int __atomic_compare_exchange(
>                    ^
> 1 error generated.
> AFAIU this built-in was added rather recently since I was able to build
> it with clang a month or so ago.
> Is there any way to disable this built-in?
> '-fno-builtin' doesn't help.
> (Yes, I know that it's bad idea to start identifiers with underscores)

So what is the solution to this?
I have out of tree backend with:
  setOperationAction(ISD::ATOMIC_LOAD_SUB,  MVT::i32, Expand);

Now i am trying to compile the actual implementation with clang :

int32_t __sync_fetch_and_sub_4 (volatile int32_t *ptr, int32_t value, ...)

I get:
    definition of builtin function '__sync_fetch_and_sub_4'

'-fno-builtin' doesn't help..

How is it possible to compile the builtins implementation with clang?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130530/a33fc6ca/attachment.html>

More information about the cfe-dev mailing list