[PATCH] D103864: BPF: fix relocation types in lib/Object/RelocationResolver.cpp

Yonghong Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 7 17:27:51 PDT 2021


yonghong-song created this revision.
yonghong-song added a reviewer: ast.
Herald added a subscriber: hiraditya.
yonghong-song requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Commit 6a2ea84600ba <https://reviews.llvm.org/rG6a2ea84600ba4bd3b2733bd8f08f5115eb32164b> ("BPF: Add more relocation kinds")
added new relocations R_BPF_64_ABS64 and R_BPF_64_ABS32
for normal 64-bit and 32-bit data relocations.
This is to replace some of functionalities with
R_BPF_64_64 and R_BPF_64_32 so that new R_BPF_64_64
and R_BPF_64_32 semantics are for ld_imm64 and 
call instructions only.

The BPF support in lib/Object/RelocationResolver.cpp
is used to perform normal data relocations for 
the case like DWARFObjInMemory with an object file
(search function getRelocationResolver() in file
DebugInfo/DWARF/DWARFContext.cpp) or llvm-readobj
to dump ".stack_sizes" section data.
In all these casees, normal 64-bit and 32-bit relocations
are performed and such resolution resolution
is exactly what implemented in RelocationResolver.cpp.

But Commit 6a2ea84600ba <https://reviews.llvm.org/rG6a2ea84600ba4bd3b2733bd8f08f5115eb32164b> missed to change
R_BPF_64_64/R_BPF_64_32 to R_BPF_64_ABS64/R_BPF_64_ABS32.
This patch fixed the issue and added a test for it
with llvm-readobj dumping ".stack_sizes" section.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103864

Files:
  llvm/lib/Object/RelocationResolver.cpp
  llvm/test/Object/BPF/lit.local.cfg
  llvm/test/Object/BPF/yaml2obj-elf-bpf-rel.yaml

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103864.350460.patch
Type: text/x-patch
Size: 3851 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210608/575bd05e/attachment.bin>


More information about the llvm-commits mailing list