<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 24, 2012 at 5:21 AM, Dmitri Shubin <span dir="ltr"><<a href="mailto:sbn@tbricks.com" target="_blank">sbn@tbricks.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hello!<br>
<br>
When building Berkeley DB (checked 4.8.30 and 5.1.25) with clang (trunk)<br>
I got the following error:<br>
<br>
In file included from<br>
/export/home/sbn/thd/25/src/thirdparty/BerkeleyDB/5.1.25/src/src/mutex/mut_pthread.c:11:<br>
In file included from ./db_int.h:999:<br>
In file included from<br>
/export/home/sbn/thd/25/src/thirdparty/BerkeleyDB/5.1.25/src/src/dbinc/mutex.h:15:<br>
In file included from<br>
/export/home/sbn/thd/25/src/thirdparty/BerkeleyDB/5.1.25/src/src/dbinc/mutex_int.h:12:<br>
/export/home/sbn/thd/25/src/thirdparty/BerkeleyDB/5.1.25/src/src/dbinc/atomic.h:179:19:<br>
error: definition of builtin function '__atomic_compare_exchange'<br>
static inline int __atomic_compare_exchange(<br>
                   ^<br>
1 error generated.<br>
<br>
AFAIU this built-in was added rather recently since I was able to build<br>
it with clang a month or so ago.<br>
<br>
Is there any way to disable this built-in?<br>
'-fno-builtin' doesn't help.<br>
<br>
(Yes, I know that it's bad idea to start identifiers with underscores)<br></blockquote><div><br></div><div><br></div><div style>So what is the solution to this?</div><div style>I have out of tree backend with: </div>
<div style><div>  setOperationAction(ISD::ATOMIC_LOAD_SUB,  MVT::i32, Expand);</div><div><br></div><div style>Now i am trying to compile the actual implementation with clang :</div><div style><div><br></div><div>int32_t __sync_fetch_and_sub_4 (volatile int32_t *ptr, int32_t value, ...)</div>
<div>{</div><div>...</div><div>}</div></div></div><div style><br></div><div style>I get: <br></div><div style>    definition of builtin function '__sync_fetch_and_sub_4'<br></div><div style><br></div><div style>'-fno-builtin' doesn't help..<br>
</div><div style><br></div><div style>How is it possible to compile the builtins implementation with clang?</div><div> </div></div></div></div>