-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BPF] Improve error message for seq_cst atomic load and store
Sequentially consistent (seq_cst) atomic load and store are not supported yet for BPF. Right now, calling __atomic_{load,store}{,_n}() with __ATOMIC_SEQ_CST will cause an error: $ cat bar.c int foo(int *ptr) { return __atomic_load_n(ptr, __ATOMIC_SEQ_CST); } $ clang --target=bpf -mcpu=v5 -c bar.c > /dev/null fatal error: error in backend: Cannot select: t8: i32,ch = AtomicLoad<(load seq_cst (s32) from %ir.0)> t7:1, t7 ... Which isn't very useful. Just like commit 379d908 ("BPF: provide better error message for unsupported atomic operations"), make it generate an error message saying that the requested operation isn't supported, before triggering that "fatal error": $ clang --target=bpf -mcpu=v5 -c bar.c > /dev/null bar.c:1:5: error: sequentially consistent (seq_cst) atomic load is not supported 1 | int foo(int *ptr) { return __atomic_load_n(ptr, __ATOMIC_SEQ_CST); } | ^ ...
- Loading branch information
Showing
2 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters