Skip to contentSkip to conversation

build failure: conflicting bpf_arena_* prototypes between vmlinux.h and bpf_arena_common.h

mainline Venkat Rao Bagalkote 2 participants 2 messages May 4 BPF

lore
Share & tools
lore
#0 lore raw

Greetings!!!

I’m seeing a CLANG-BPF build failure in tools/testing/selftests/bpf related to conflicting prototypes of bpf_arena_* helpers between vmlinux.h and bpf_arena_common.h, on mainline kernel.

Error log:

  In file included from progs/arena_strsearch.c:12:
  In file included from tools/testing/selftests/bpf/bpf_arena_strsearch.h:4:
  tools/testing/selftests/bpf/bpf_arena_common.h:47:15:
    error: conflicting types for 'bpf_arena_alloc_pages'
      void __arena* bpf_arena_alloc_pages(void *map,
                                          void __arena *addr, __u32 page_cnt,
                                          __u32 node_id,
                                          __u64 flags);

  tools/testing/selftests/bpf/tools/include/vmlinux.h:135295:14:
    note: previous declaration is here
      extern void *bpf_arena_alloc_pages(void *p__map, void *addr__ign, u32 page_cnt, int node_id, u64 flags) __weak __ksym;

  tools/testing/selftests/bpf/bpf_arena_common.h:49:5:
    error: conflicting types for 'bpf_arena_reserve_pages' int bpf_arena_reserve_pages(void *map,
                                  void __arena *addr, __u32 page_cnt) __ksym __weak;

  tools/testing/selftests/bpf/tools/include/vmlinux.h:135297:12:
    note: previous declaration is here
      extern int bpf_arena_reserve_pages(void *p__map, void *ptr__ign, u32 page_cnt) __weak __ksym;

  tools/testing/selftests/bpf/bpf_arena_common.h:50:6:
    error: conflicting types for 'bpf_arena_free_pages' void bpf_arena_free_pages(void *map,
                                void __arena *ptr, __u32 page_cnt) __ksym __weak;

  tools/testing/selftests/bpf/tools/include/vmlinux.h:135296:13:
    note: previous declaration is here
      extern void bpf_arena_free_pages(void *p__map, void *ptr__ign, u32 page_cnt) __weak __ksym;

Tool chain Versions:

gcc (GCC) 14.2.0

# clang --version
clang version 23.0.0git (https://github.com/llvm/llvm-project.git bd6bfba3e50343c112a04b639394ab85be17c29b)
# llc --version
LLVM (http://llvm.org/):
  LLVM version 23.0.0git
  Optimized build.
  Default target: powerpc64le-unknown-linux-gnu
  Host CPU: (unknown)

  Registered Targets:
    bpf     - BPF (host endian)
    bpfeb   - BPF (big endian)
    bpfel   - BPF (little endian)
    ppc32   - PowerPC 32
    ppc32le - PowerPC 32 LE
    ppc64   - PowerPC 64
    ppc64le - PowerPC 64 LE

# objcopy --version | head -1
GNU objcopy version 2.35.2-67.el9_7.1
# ld --version | head -1
GNU ld version 2.35.2-67.el9_7.1

If you happen to fix this, please add below tag.

Regards,

Venkat.

#1 lore raw
Quoted 82 lines · Venkat Rao Bagalkote

Greetings!!!

I’m seeing a CLANG-BPF build failure in tools/testing/selftests/bpf related to conflicting prototypes of bpf_arena_* helpers between vmlinux.h and bpf_arena_common.h, on mainline kernel.

Error log:

In file included from progs/arena_strsearch.c:12:
In file included from
tools/testing/selftests/bpf/bpf_arena_strsearch.h:4:
tools/testing/selftests/bpf/bpf_arena_common.h:47:15:
error: conflicting types for 'bpf_arena_alloc_pages'
void __arena* bpf_arena_alloc_pages(void *map,
void __arena *addr, __u32 page_cnt, __u32 node_id, __u64 flags);

tools/testing/selftests/bpf/tools/include/vmlinux.h:135295:14:
note: previous declaration is here
extern void *bpf_arena_alloc_pages(void *p__map,
void *addr__ign, u32 page_cnt, int node_id, u64 flags) __weak __ksym;

tools/testing/selftests/bpf/bpf_arena_common.h:49:5:
error: conflicting types for 'bpf_arena_reserve_pages'
int bpf_arena_reserve_pages(void *map,
void __arena *addr, __u32 page_cnt) __ksym __weak;

tools/testing/selftests/bpf/tools/include/vmlinux.h:135297:12:
note: previous declaration is here
extern int bpf_arena_reserve_pages(void *p__map,
void *ptr__ign, u32 page_cnt) __weak __ksym;

tools/testing/selftests/bpf/bpf_arena_common.h:50:6:
error: conflicting types for 'bpf_arena_free_pages'
void bpf_arena_free_pages(void *map,
void __arena *ptr, __u32 page_cnt) __ksym __weak;

   tools/testing/selftests/bpf/tools/include/vmlinux.h:135296:13:
     note: previous declaration is here
       extern void bpf_arena_free_pages(void *p__map,
                                        void *ptr__ign,
                                        u32 page_cnt) __weak __ksym;

Tool chain Versions:

gcc (GCC) 14.2.0

# clang --version
clang version 23.0.0git (https://github.com/llvm/llvm-project.git
bd6bfba3e50343c112a04b639394ab85be17c29b)
# llc --version
LLVM (http://llvm.org/):
   LLVM version 23.0.0git
   Optimized build.
   Default target: powerpc64le-unknown-linux-gnu
   Host CPU: (unknown)

Registered Targets:

     bpf     - BPF (host endian)
     bpfeb   - BPF (big endian)
     bpfel   - BPF (little endian)
     ppc32   - PowerPC 32

ppc32le - PowerPC 32 LE
ppc64 - PowerPC 64
ppc64le - PowerPC 64 LE

# objcopy --version | head -1
GNU objcopy version 2.35.2-67.el9_7.1
# ld --version | head -1
GNU ld version 2.35.2-67.el9_7.1
Quoted 4 lines

If you happen to fix this, please add below tag.

The issue is in your setup.
It was brought up a couple times in the past.
Please search archives.