Page MenuHomePhabricator

BPF: fix relocation types in lib/Object/RelocationResolver.cpp
ClosedPublic

Authored by yonghong-song on Jun 7 2021, 5:27 PM.

Details

Summary

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.

Diff Detail

Event Timeline

yonghong-song created this revision.Jun 7 2021, 5:27 PM
yonghong-song requested review of this revision.Jun 7 2021, 5:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 7 2021, 5:27 PM
ast accepted this revision.Jun 7 2021, 7:21 PM
This revision is now accepted and ready to land.Jun 7 2021, 7:21 PM