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

Andrii Nakryiko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 19 12:54:11 PST 2020


anakryiko added a comment.

Having an explicit special section for extern functions clearly indicating the intent (that it should match kernel function) is really good. Especially with static linking. Otherwise, this "try local function, otherwise fallback to kernel function" is going to be really painful for users if there is any error, because all such errors will be indicated at the load time instead of at the link time, where they should be detected and reported.

I do agree, though, that using VAR for "attaching" FUNC to datasec looks weird. We could extend DATASEC to list both VARs and FUNCs, of course. If ELF recorded section index for such externs that would solve the problem without any BTF extensions, because libbpf would be detecting what's the intent with extern func from ELF and then looking up function details in BTF, but I don't think that's the case with extern functions, just as it wasn't the case with extern variables.


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