<div dir="ltr">Hi David,<div><br></div><div>I spoke too soon it turns out. That was a version control error on my part.<div><br></div><div>atomic.c now compiles without warning but it's failing to link with a lot of undefined reference to `__atomic_is_lock_free' errors. This is definitely progress!</div></div><div><br></div><div>Is this simply a case of adding another source file from the llvm builtins?</div><div><br></div><div>Pete</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 7, 2018 at 1:09 PM, David Chisnall <span dir="ltr"><<a href="mailto:David.Chisnall@cl.cam.ac.uk" target="_blank">David.Chisnall@cl.cam.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> On 7 Aug 2018, at 13:06, Pete Blacker via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br>
> <br>
> Hi There,<br>
> <br>
> I'm currently trying to setup a build system using the tensorflow XLA compiler and the gaisler version of clang which generates code for the LEON family of CPU's. <br>
> <br>
> The problem I've hit is that the C++11 support in this version of clang doesn't appear to be complete, it doesn't support std::atomic. Meanwhile the XLA compiler is producing an IR as well as a header file for inclusion in the project, when compiled and linked this has a dependency on the library call __atomic_load_1. Which then causes a linker error : undefined reference to `__atomic_load_1'<br>
> <br>
> How would I go about adding these functions into this project so that the XLA compiler output can be successfully linked? <br>
> <br>
> I've tried adding the compiler-rt/lib/builtins/<wbr>atomic.c source into the project but it produced the following compiler warning and failed to link with the same error as above:<br>
> <br>
> sparc-gaisler-elf-clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]<br>
> atomic.c:162:6: warning: #pragma redefine_extname is applicable to external C declarations only; not applied to function '__atomic_load_c' [-Wpragmas]<br>
> void __atomic_load_c(int size, void *src, void *dest, int model) {<br>
> <br>
> Am I remotely on the right track to add support for atomic operations?<br>
<br>
</span>Yes, I believe that the only thing that you’re doing wrong is passing atomic.c to clang++ instead of clang.  If you compile it with clang (or, I believe, with 'clang++ -x c’) separately and then link the resulting .o file, then it is likely to work.<br>
<span class="HOEnZb"><font color="#888888"><br>
David<br>
<br>
</font></span></blockquote></div><br></div>