[cfe-dev] Trying to add __atomic_load_x support to a sparc-gaisler-elf-clang++ project

Pete Blacker via cfe-dev cfe-dev at lists.llvm.org
Tue Aug 7 05:06:23 PDT 2018


Hi There,


I'm currently trying to setup a build system using the tensorflow XLA
compiler <https://www.tensorflow.org/performance/xla/> and the gaisler
version of clang
<https://www.gaisler.com/index.php/products/operating-systems/bcc> which
generates code for the LEON family of CPU's.


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'


How would I go about adding these functions into this project so that the
XLA compiler output can be successfully linked?


I've tried adding the compiler-rt/lib/builtins/atomic.c
<https://github.com/llvm-mirror/compiler-rt/blob/master/lib/builtins/atomic.c>
source
into the project but it produced the following compiler warning and failed
to link with the same error as above:


sparc-gaisler-elf-clang: warning: treating 'c' input as 'c++' when in C++
mode, this behavior is deprecated [-Wdeprecated]
atomic.c:162:6: warning: #pragma redefine_extname is applicable to external
C declarations only; not applied to function '__atomic_load_c' [-Wpragmas]
void __atomic_load_c(int size, void *src, void *dest, int model) {

Am I remotely on the right track to add support for atomic operations?

Any ideas would be greatly appreciated.

Pete
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180807/6515728d/attachment.html>


More information about the cfe-dev mailing list