[PATCH] D71638: [BPF] extend BTF_KIND_FUNC to cover global, static and extern funcs

Yonghong Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 9 11:57:48 PST 2020


yonghong-song updated this revision to Diff 237144.
yonghong-song added a comment.

To handle cases (exposed when running linux kernel samples/bpf/sockex1) like below:

  unsigned long long load_byte(void *skb, unsigned long long off) asm("llvm.bpf.load.byte");
  unsigned long long test(void *skb) {
    return load_byte(skb, 10);
  }

previous approach emits load_byte as load_byte function is in module function reference list.
But actually this function is not called so we should not emit extern func BTF for this.

Change to check all JAL instructions and emit extern func if necessary.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71638/new/

https://reviews.llvm.org/D71638

Files:
  llvm/lib/Target/BPF/BTF.h
  llvm/lib/Target/BPF/BTFDebug.cpp
  llvm/lib/Target/BPF/BTFDebug.h
  llvm/test/CodeGen/BPF/BTF/binary-format.ll
  llvm/test/CodeGen/BPF/BTF/extern-builtin.ll
  llvm/test/CodeGen/BPF/BTF/extern-func-arg.ll
  llvm/test/CodeGen/BPF/BTF/extern-global-var.ll
  llvm/test/CodeGen/BPF/BTF/extern-var-func-weak-section.ll
  llvm/test/CodeGen/BPF/BTF/extern-var-func-weak.ll
  llvm/test/CodeGen/BPF/BTF/extern-var-func.ll
  llvm/test/CodeGen/BPF/BTF/extern-var-section.ll
  llvm/test/CodeGen/BPF/BTF/extern-var-struct-weak.ll
  llvm/test/CodeGen/BPF/BTF/extern-var-struct.ll
  llvm/test/CodeGen/BPF/BTF/extern-var-weak-section.ll
  llvm/test/CodeGen/BPF/BTF/filename.ll
  llvm/test/CodeGen/BPF/BTF/func-func-ptr.ll
  llvm/test/CodeGen/BPF/BTF/func-non-void.ll
  llvm/test/CodeGen/BPF/BTF/func-source.ll
  llvm/test/CodeGen/BPF/BTF/func-typedef.ll
  llvm/test/CodeGen/BPF/BTF/func-unused-arg.ll
  llvm/test/CodeGen/BPF/BTF/func-void.ll
  llvm/test/CodeGen/BPF/BTF/local-var.ll
  llvm/test/CodeGen/BPF/BTF/static-func.ll
  llvm/test/CodeGen/BPF/BTF/static-var-derived-type.ll
  llvm/test/CodeGen/BPF/BTF/static-var-inited-sec.ll
  llvm/test/CodeGen/BPF/BTF/static-var-inited.ll
  llvm/test/CodeGen/BPF/BTF/static-var-readonly-sec.ll
  llvm/test/CodeGen/BPF/BTF/static-var-readonly.ll
  llvm/test/CodeGen/BPF/BTF/static-var-sec.ll
  llvm/test/CodeGen/BPF/BTF/static-var-zerolen-array.ll
  llvm/test/CodeGen/BPF/BTF/static-var.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-basic.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-multilevel.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-struct-anonymous.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-struct-array.ll
  llvm/test/CodeGen/BPF/CORE/offset-reloc-union.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71638.237144.patch
Type: text/x-patch
Size: 56278 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200109/7a0d91d6/attachment.bin>


More information about the llvm-commits mailing list