[all-commits] [llvm/llvm-project] 8ce45f: BPF: fix relocation types in lib/Object/Relocation...

yonghong-song via All-commits all-commits at lists.llvm.org
Mon Jun 7 20:59:55 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8ce45f97283460a330201a199e686e8e088805e0
      https://github.com/llvm/llvm-project/commit/8ce45f97283460a330201a199e686e8e088805e0
  Author: Yonghong Song <yhs at fb.com>
  Date:   2021-06-07 (Mon, 07 Jun 2021)

  Changed paths:
    M llvm/lib/Object/RelocationResolver.cpp
    A llvm/test/Object/BPF/lit.local.cfg
    A llvm/test/Object/BPF/yaml2obj-elf-bpf-rel.yaml

  Log Message:
  -----------
  BPF: fix relocation types in lib/Object/RelocationResolver.cpp

Commit 6a2ea84600ba ("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 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.

Differential Revision: https://reviews.llvm.org/D103864




More information about the All-commits mailing list