[PATCH] D70697: [BPF] Support to emit debugInfo for extern variables

Yonghong Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 25 14:11:55 PST 2019


yonghong-song created this revision.
yonghong-song added reviewers: ast, dblaikie, aprantl, RKSimon.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

Extern variable usage in BPF is different from traditional
pure user space application. Recent discussion in linux bpf 
mailing list has two use cases where debug info types are 
required to use extern variables:

- extern types are required to have a suitable interface in libbpf (bpf loader) to provide kernel config parameters to bpf programs. https://lore.kernel.org/bpf/CAEf4BzYCNo5GeVGMhp3fhysQ=_axAf=23PtwaZs-yAyafmXC9g@mail.gmail.com/T/#t
- extern types are required so kernel bpf verifier can verify program which uses external functions more precisely. This will make later link with actual external function no need to reverify. https://lore.kernel.org/bpf/87eez4odqp.fsf@toke.dk/T/#m8d5c3e87ffe7f2764e02d722cb0d8cbc136880ed

This patch added bpf support to consume such info into BTF,
which can then be used by bpf loader. Function processFuncPrototypes()
only adds extern function definitions into BTF. The functions
with actual definition have been added to BTF in some other places.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70697

Files:
  llvm/lib/Target/BPF/BTF.h
  llvm/lib/Target/BPF/BTFDebug.cpp
  llvm/lib/Target/BPF/BTFDebug.h
  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.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70697.230969.patch
Type: text/x-patch
Size: 22163 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191125/bdde37f7/attachment.bin>


More information about the llvm-commits mailing list