OSDN Git Service

selftests/bpf: Add function linking selftest
authorAndrii Nakryiko <andrii@kernel.org>
Fri, 23 Apr 2021 18:13:45 +0000 (11:13 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 23 Apr 2021 21:05:27 +0000 (14:05 -0700)
commitf2644fb44de9abd54e57b55f584c7c67526f7c02
tree1567fc448eb051723471dea24054880933689bf0
parentb131aed910097a2eeac8180bf3cf214eea475d9a
selftests/bpf: Add function linking selftest

Add selftest validating various aspects of statically linking functions:
  - no conflicts and correct resolution for name-conflicting static funcs;
  - correct resolution of extern functions;
  - correct handling of weak functions, both resolution itself and libbpf's
    handling of unused weak function that "lost" (it leaves gaps in code with
    no ELF symbols);
  - correct handling of hidden visibility to turn global function into
    "static" for the purpose of BPF verification.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20210423181348.1801389-16-andrii@kernel.org
tools/testing/selftests/bpf/Makefile
tools/testing/selftests/bpf/prog_tests/linked_funcs.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/linked_funcs1.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/linked_funcs2.c [new file with mode: 0644]