Re: [PATCH bpf-next v2 8/9] selftests/bpf: Add selftests for load-acquire and store-release instructions

From: Eduard Zingerman
Date: Mon Feb 10 2025 - 19:20:33 EST


On Sat, 2025-02-08 at 02:20 +0000, Peilin Ye wrote:

[...]

> Sorry, that wasn't very accurate - we need to make sure there are no
> "holes" in the .addr_space.1 ELF section, e.g.:
>
> /* 8-byte-aligned */
> __u8 __arena_global load_acquire8_value = 0x12;
> /* 1-byte hole, causing clang-17 to crash */
> __u16 __arena_global load_acquire16_value = 0x1234;
>
> LLVM commit f27c4903c43b ("MC: Add .data. and .rodata. prefixes to
> MCContext section classification") fixed this issue.

This is a bit strange, from commit log it looks like LLVM-17 should
include this commit. But in any case, targeting LLVM >= 18 seems
reasonable to me, the main goal is to have these tests run by CI for
some compiler version.

> - - -
> For now, I think I should:
>
> 1. change existing #if guards to
> "#if defined(__TARGET_ARCH_arm64) && __clang_major__ >= 18"
>
> 2. additionally, guard "__arena_global" variable definitions behind
> "#if __clang_major >= 18" so that clang-17 doesn't try to compile
> that part (then crash)
>
> Will fix in v3.
>
> Thanks,
> Peilin Ye
>