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

Yonghong Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 19 10:29:17 PST 2020


yonghong-song added a comment.

> libbpf can use order to find proper function. foo can be extern as it is right now. Then libbpf will first try to match between multiple elf bpf files. If still not found it will search in vmlinux/mods.

This is something Martin and I discussed try to avoid. We want code level indication whether it is an extern func from bpf program or from kernel. We could do what you suggested here, but feel this way we may misinterpret user intentions. But this may be a really really corner case we may not care about as long as we document what is the expectation.

> I think using KIND_VAR is incorrect. There is no variable here.

In current BTF design, yes, KIND_VAR does not refer to func pointers. In LLVM IR, func_proto actually referred as a type. I agree that KIND_VAR referring to functions not good, and referring to extern func only (not other functions) seems not consistent and a little bit awkward.

Overall, I am okay not using sections (sections actually will be ignored), and libbpf does priority matching against bpf library first and then kernel functions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93563



More information about the llvm-commits mailing list