[PATCH] D100568: BPF: generate BTF info for LD_imm64 loaded function pointer
Yonghong Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 15 08:28:21 PDT 2021
yonghong-song created this revision.
yonghong-song added reviewers: ast, anakryiko.
Herald added a subscriber: hiraditya.
yonghong-song requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
For an example like below,
extern int do_work(int);
long bpf_helper(void *callback_fn);
long prog() {
return bpf_helper(&do_work);
}
The final generated codes look like:
r1 = do_work ll
call bpf_helper
exit
where we have debuginfo for do_work() extern function:
!17 = !DISubprogram(name: "do_work", ...)
This patch implemented to add additional checking
in processing LD_imm64 operands for possible function pointers
so BTF for bpf function do_work() can be properly generated.
The original llvm function name processReloc() is renamed to
processGlobalValue() to better reflect what the function is doing.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D100568
Files:
llvm/lib/Target/BPF/BTFDebug.cpp
llvm/lib/Target/BPF/BTFDebug.h
llvm/test/CodeGen/BPF/BTF/extern-func-ptr.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100568.337777.patch
Type: text/x-patch
Size: 5860 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210415/aa4eaa67/attachment.bin>
More information about the llvm-commits
mailing list