Skip to content

Conversation

@kernel-patches-daemon-bpf-rc
Copy link

Pull request for series with
subject: selftests/bpf: Guard addr_space_cast code with __BPF_FEATURE_ADDR_SPACE_CAST
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1014370

…CE_CAST

When compiling the BPF selftests with Clang versions that do not support
the addr_space_cast builtin, the build fails with assembly errors in
"verifier_ldsx.c" [1].

The root cause is that the inline assembly using addr_space_cast is
being processed by a compiler that lacks this feature. To resolve this,
wrap the affected code sections (specifically the arena_ldsx_* test
functions) with #if defined(__BPF_FEATURE_ADDR_SPACE_CAST). This
ensures the code is only compiled when the Clang supports the necessary
feature, preventing build failures on older or incompatible compiler
versions.

This change maintains test coverage for systems with support while
allowing the tests to build successfully in all environments.

[1]:
root:tools/testing/selftests/bpf$ make

  CLNG-BPF [test_progs] verifier_ldsx.bpf.o
progs/verifier_ldsx.c:322:2: error: invalid operand for instruction
  322 |         "r1 = %[arena] ll;"
      |         ^
<inline asm>:1:52: note: instantiated into assembly here
    1 |         r1 = arena ll;r0 = 0xdeadbeef;r0 = addr_space_cast(r0,...
      |                                                           ^

Fixes: f616549 ("selftests: bpf: Add tests for signed loads from arena")
Signed-off-by: Jiayuan Chen <[email protected]>
@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: e758657
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1014370
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

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

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