[PATCH] D93563: BPF: add extern func to data sections if specified

Yonghong Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 18 13:30:39 PST 2020


yonghong-song created this revision.
yonghong-song added reviewers: ast, andriigrynenko, iamkafai.
Herald added a subscriber: hiraditya.
yonghong-song requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This permits BTF_KIND_FUNC style extern var to be added to
BTF_KIND_DATASEC if specific section name is specified.
For example,

  -bash-4.4$ cat t.c 
  void foo(int) __attribute__((section(".kernel.funcs")));
  int test(void) {
    foo(5);
    return 0;
  }

A variable (BTF_KIND_VAR) will generated for extern func foo,
and this variable will be put into BTF_KIND_DATASEC with name
".kernel.funcs".

This will help to differentiate two kinds of external functions,
functions in kernel and functions defined in other bpf programs.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93563

Files:
  llvm/lib/Target/BPF/BTFDebug.cpp
  llvm/test/CodeGen/BPF/BTF/extern-var-func-weak-section.ll
  llvm/test/CodeGen/BPF/BTF/extern-var-section.ll
  llvm/test/CodeGen/BPF/BTF/extern-var-weak-section.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93563.312884.patch
Type: text/x-patch
Size: 6625 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201218/9a80546a/attachment.bin>


More information about the llvm-commits mailing list