[all-commits] [llvm/llvm-project] 444812: [BPF] Support to emit debugInfo for extern variables

yonghong-song via All-commits all-commits at lists.llvm.org
Mon Dec 9 21:55:17 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 4448125007712d78fd114997a6fffc44b61b131d
      https://github.com/llvm/llvm-project/commit/4448125007712d78fd114997a6fffc44b61b131d
  Author: Yonghong Song <yhs at fb.com>
  Date:   2019-12-09 (Mon, 09 Dec 2019)

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

  Log Message:
  -----------
  [BPF] Support to emit debugInfo for extern variables

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.

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




More information about the All-commits mailing list