Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

selftests/bpf: fix a clang deprecated-declarations compilation error #2589

Closed
wants to merge 2 commits into from

Conversation

kernel-patches-bot
Copy link

Pull request for series with
subject: selftests/bpf: fix a clang deprecated-declarations compilation error
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=615545

@kernel-patches-bot
Copy link
Author

Master branch: b75daca
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=615545
version: 1

@kernel-patches-bot
Copy link
Author

Master branch: d24d2a2
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=615545
version: 1

@kernel-patches-bot
Copy link
Author

Master branch: 086d490
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=615545
version: 1

@kernel-patches-bot
Copy link
Author

Master branch: 9087c6f
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=615545
version: 1

Build the kernel and selftest with clang compiler with LLVM=1,
  make -j LLVM=1
  make -C tools/testing/selftests/bpf -j LLVM=1

I hit the following selftests/bpf compilation error:
  In file included from test_cpp.cpp:3:
  /.../tools/testing/selftests/bpf/tools/include/bpf/libbpf.h:73:8:
    error: 'relaxed_core_relocs' is deprecated: libbpf v0.6+: field has no effect [-Werror,-Wdeprecated-declarations]
  struct bpf_object_open_opts {
         ^
  test_cpp.cpp:56:2: note: in implicit move constructor for 'bpf_object_open_opts' first required here
          LIBBPF_OPTS(bpf_object_open_opts, opts);
          ^
  /.../tools/testing/selftests/bpf/tools/include/bpf/libbpf_common.h:77:3: note: expanded from macro 'LIBBPF_OPTS'
                  (struct TYPE) {                                             \
                  ^
  /.../tools/testing/selftests/bpf/tools/include/bpf/libbpf.h:90:2: note: 'relaxed_core_relocs' has been explicitly marked deprecated here
          LIBBPF_DEPRECATED_SINCE(0, 6, "field has no effect")
          ^
  /.../tools/testing/selftests/bpf/tools/include/bpf/libbpf_common.h:24:4: note: expanded from macro 'LIBBPF_DEPRECATED_SINCE'
                  (LIBBPF_DEPRECATED("libbpf v" # major "." # minor "+: " msg))
                   ^
  /.../tools/testing/selftests/bpf/tools/include/bpf/libbpf_common.h:19:47: note: expanded from macro 'LIBBPF_DEPRECATED'
  #define LIBBPF_DEPRECATED(msg) __attribute__((deprecated(msg)))

There are two ways to fix the issue, one is to use GCC diagnostic ignore pragma, and the
other is to open code bpf_object_open_opts instead of using LIBBPF_OPTS.
Since in general LIBBPF_OPTS is preferred, the patch fixed the issue by
adding proper GCC diagnostic ignore pragmas.

Signed-off-by: Yonghong Song <yhs@fb.com>
@kernel-patches-bot
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=615545 irrelevant now. Closing PR.

@kernel-patches-bot kernel-patches-bot deleted the series/615545=>bpf-next branch February 20, 2022 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants