diff options
author | Yonghong Song <yhs@fb.com> | 2021-05-26 17:24:57 +0200 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2021-05-28 22:12:04 +0200 |
commit | fc8c262e0eb5aa248af5051377e4ff3348841ac5 (patch) | |
tree | 8c704e6afdfcc4c36db912ff82a735ff15d94c26 /tools/testing/selftests/bpf/README.rst | |
parent | libbpf: Move BPF_SEQ_PRINTF and BPF_SNPRINTF to bpf_helpers.h (diff) | |
download | linux-fc8c262e0eb5aa248af5051377e4ff3348841ac5.tar.xz linux-fc8c262e0eb5aa248af5051377e4ff3348841ac5.zip |
bpf, docs: Add llvm_reloc.rst to explain llvm bpf relocations
LLVM upstream commit https://reviews.llvm.org/D102712 made some changes
to bpf relocations to make them llvm linker lld friendly. The scope of
existing relocations R_BPF_64_{64,32} is narrowed and new relocations
R_BPF_64_{ABS32,ABS64,NODYLD32} are introduced.
Let us add some documentation about llvm bpf relocations so people can
understand how to resolve them properly in their respective tools.
Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20210526152457.335210-1-yhs@fb.com
Diffstat (limited to 'tools/testing/selftests/bpf/README.rst')
-rw-r--r-- | tools/testing/selftests/bpf/README.rst | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/README.rst b/tools/testing/selftests/bpf/README.rst index 3353778c30f8..8deec1ca9150 100644 --- a/tools/testing/selftests/bpf/README.rst +++ b/tools/testing/selftests/bpf/README.rst @@ -202,3 +202,22 @@ generate valid BTF information for weak variables. Please make sure you use Clang that contains the fix. __ https://reviews.llvm.org/D100362 + +Clang relocation changes +======================== + +Clang 13 patch `clang reloc patch`_ made some changes on relocations such +that existing relocation types are broken into more types and +each new type corresponds to only one way to resolve relocation. +See `kernel llvm reloc`_ for more explanation and some examples. +Using clang 13 to compile old libbpf which has static linker support, +there will be a compilation failure:: + + libbpf: ELF relo #0 in section #6 has unexpected type 2 in .../bpf_tcp_nogpl.o + +Here, ``type 2`` refers to new relocation type ``R_BPF_64_ABS64``. +To fix this issue, user newer libbpf. + +.. Links +.. _clang reloc patch: https://reviews.llvm.org/D102712 +.. _kernel llvm reloc: /Documentation/bpf/llvm_reloc.rst |