summaryrefslogtreecommitdiff
path: root/Documentation/bpf/clang-notes.rst
diff options
context:
space:
mode:
authorDave Thaler <dthaler@microsoft.com>2022-09-27 18:59:46 +0000
committerAlexei Starovoitov <ast@kernel.org>2022-09-30 13:41:13 -0700
commit6c7aaffb24efbd5d1ae067b2b629b3ffcc37e18e (patch)
tree20036a755328a576149c31295c1604cc980a221b /Documentation/bpf/clang-notes.rst
parent9a0bf21337c667375d918adc41239ce54304a12c (diff)
bpf, docs: Move Clang notes to a separate file
Move Clang notes to a separate file. Signed-off-by: Dave Thaler <dthaler@microsoft.com> Link: https://lore.kernel.org/r/20220927185958.14995-3-dthaler1968@googlemail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'Documentation/bpf/clang-notes.rst')
-rw-r--r--Documentation/bpf/clang-notes.rst24
1 files changed, 24 insertions, 0 deletions
diff --git a/Documentation/bpf/clang-notes.rst b/Documentation/bpf/clang-notes.rst
new file mode 100644
index 000000000000..b15179cb5117
--- /dev/null
+++ b/Documentation/bpf/clang-notes.rst
@@ -0,0 +1,24 @@
+.. contents::
+.. sectnum::
+
+==========================
+Clang implementation notes
+==========================
+
+This document provides more details specific to the Clang/LLVM implementation of the eBPF instruction set.
+
+Versions
+========
+
+Clang defined "CPU" versions, where a CPU version of 3 corresponds to the current eBPF ISA.
+
+Clang can select the eBPF ISA version using ``-mcpu=v3`` for example to select version 3.
+
+Atomic operations
+=================
+
+Clang can generate atomic instructions by default when ``-mcpu=v3`` is
+enabled. If a lower version for ``-mcpu`` is set, the only atomic instruction
+Clang can generate is ``BPF_ADD`` *without* ``BPF_FETCH``. If you need to enable
+the atomics features, while keeping a lower ``-mcpu`` version, you can use
+``-Xclang -target-feature -Xclang +alu32``.