[all-commits] [llvm/llvm-project] bba733: BPF: generate BTF info for LD_imm64 loaded functio...

yonghong-song via All-commits all-commits at lists.llvm.org
Mon Apr 26 17:24:04 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bba7338b8f5df15a444aad8b3026aec869767b2b
      https://github.com/llvm/llvm-project/commit/bba7338b8f5df15a444aad8b3026aec869767b2b
  Author: Yonghong Song <yhs at fb.com>
  Date:   2021-04-26 (Mon, 26 Apr 2021)

  Changed paths:
    M llvm/lib/Target/BPF/BTFDebug.cpp
    M llvm/lib/Target/BPF/BTFDebug.h
    A llvm/test/CodeGen/BPF/BTF/extern-func-ptr.ll

  Log Message:
  -----------
  BPF: generate BTF info for LD_imm64 loaded function pointer

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.

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




More information about the All-commits mailing list