diff options
| author | Andrii Nakryiko <[email protected]> | 2021-05-07 05:41:18 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <[email protected]> | 2021-05-11 22:07:17 +0000 |
| commit | e5670fa0293b05e8e24dae7d18481aba281cb85d (patch) | |
| tree | d7e62cbc4a3f692ad40e1f3ead6b2e24357789f0 | |
| parent | libbpf: Fix ELF symbol visibility update logic (diff) | |
| download | kernel-e5670fa0293b05e8e24dae7d18481aba281cb85d.tar.gz kernel-e5670fa0293b05e8e24dae7d18481aba281cb85d.zip | |
libbpf: Treat STV_INTERNAL same as STV_HIDDEN for functions
Do the same global -> static BTF update for global functions with STV_INTERNAL
visibility to turn on static BPF verification mode.
Signed-off-by: Andrii Nakryiko <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
| -rw-r--r-- | tools/lib/bpf/libbpf.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index e2a3cf437814..b8cf93fa1b4d 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -700,13 +700,14 @@ bpf_object__add_programs(struct bpf_object *obj, Elf_Data *sec_data, if (err) return err; - /* if function is a global/weak symbol, but has hidden - * visibility (STV_HIDDEN), mark its BTF FUNC as static to - * enable more permissive BPF verification mode with more - * outside context available to BPF verifier + /* if function is a global/weak symbol, but has restricted + * (STV_HIDDEN or STV_INTERNAL) visibility, mark its BTF FUNC + * as static to enable more permissive BPF verification mode + * with more outside context available to BPF verifier */ if (GELF_ST_BIND(sym.st_info) != STB_LOCAL - && GELF_ST_VISIBILITY(sym.st_other) == STV_HIDDEN) + && (GELF_ST_VISIBILITY(sym.st_other) == STV_HIDDEN + || GELF_ST_VISIBILITY(sym.st_other) == STV_INTERNAL)) prog->mark_btf_static = true; nr_progs++; |
