-
Notifications
You must be signed in to change notification settings - Fork 61
Build failure on RISC-V due missing __atomic_exchange_1 #1427
Comments
Interesting... Do you happen to know what recipes would we use on openembedded? meta/recipes-support/libatomic-ops? Would be fine with both, but I'd choose the first option right now if we can get away with it. |
I don't think we should change a perfectly valid code because of the issues with a specific compiler or platform when we have other options. Someone might change it back when we forget and it will break again. |
This is known to happen in multiple architectures and the safe approach is to always link to libatomic, as all the atomic operations are known to be provided there. |
Some other useful reference as well: riscv-collab/riscv-gnu-toolchain#183 (comment) |
Yeah, that would be the one. |
The problem is that this issue will also show up for people building aktualizr outside OE, so we need to handle this issue as part of the project itself. Guess the best way would be to add a configure flag to check and use libatomic and then we can use it on such architectures, or that automatically decides what is the best thing to do without such flags. |
This should be fixed by https://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg283700.html. We discussed this with the gcc RISC-V dev teams earlier, see the slide for details. |
To make it build on riscv subword atomics don't seem to be implemented. Inspiration from here: advancedtelematic/aktualizr#1427
When trying to build aktualizr 2019.9 for QEMU RISC-V 64:
Looks like this happens because not every atomic operation is currently supported by GCC on RISC-V.
Investigating further I found two possible ways to fix this issue:
1 - Change from atomic to atomic_uint (which is currently supported by gcc 9.2):
2 - Link to libatomic as it is known to have all the required atomic operations for RISC-V:
Option 1 doesn't require an extra library but this can bite us again in the future, option 2 seems safe but will add an extra library to aktualizr.
Any opinions?
The text was updated successfully, but these errors were encountered: