-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Atomics not working with Newlib toolchain #1181
Comments
Is this of any relevance? Does the code compile and link if you omit the |
Thanks a lot! Yes, this clarifies the situation and I think the idea of using the necessary code from the Linux As a note, I tried to compile the code without the |
Do you have to use the bare metal/newlib toolchain or could you use the Linux one? Maybe with |
Hmm, that is a good question. The problem is that I have to integrate with lots of existing code, some of which provides low level calls to make Newlib run on our specific bare metal hardware. Furthermore, we need to have code that is really optimized for size, which makes the Linux/glibc toolchain maybe not so appropriate. So I think in principle one could use the Linux toolchain but due to the above requirements I think I will go for the above-described solution. Thanks again for your help! |
One other thing - presumably you are targeting a multi hart/CPU environment that actually does need atomics? Just that, if not, then they are presumably redundant and you could just as well target your |
Thanks for the hint! However, I will be running the code on a cluster with several RISCV32 cores that need to be synchronized at certain points, so I actually do need the |
Fair enough. Just asking in case... :-) |
@Plociennik Did you have this done successfully? I want to know how many extra efforts I need put in. thanks in advance. |
No, I was not able to build libatomic in the Newlib build. |
Dear all,
I am trying to use the Newlib toolchain for the
ima/ilp32
architecture and ABI to compile source code making use of atomics, e.g., the following one (from the LLVM code base):When trying to build this using
riscv32-unknown-elf-g++
I get the following error:I tried to supply
-latomic
but it seems this library is not included in the Newlib build.I am having trouble to understand what to do here. I can find the C++
atomic
header in my toolchain build, and the compiler also seems to generate atomic builtins, but I cannot find any definition for the required functions in any of the libraries.As mentioned, I am using the
ima
ISA, so my target machine has atomics support, but I cannot see how I could use it.Am I doing something wrong here and is there a way to make this work with the Newlib toolchain? I noticed that
libatomic
is built for the Linux toolchain, but I cannot use that one since I want to run my code on a bare metal target.Any help would be greatly appreciated.
The text was updated successfully, but these errors were encountered: