Skip to content

Commit ac5678a

Browse files
bjotokernel-patches-bot
authored andcommitted
selftests/bpf: Fix broken riscv build
The selftests/bpf Makefile includes system include directories from the host, when building BPF programs. On RISC-V glibc requires that __riscv_xlen is defined. This is not the case for "clang -target bpf", which messes up __WORDSIZE (errno.h -> ... -> wordsize.h) and breaks the build. By explicitly defining __risc_xlen correctly for riscv, we can workaround this. Fixes: 167381f ("selftests/bpf: Makefile fix "missing" headers on build with -idirafter") Signed-off-by: Björn Töpel <bjorn.topel@gmail.com>
1 parent c9464d5 commit ac5678a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/testing/selftests/bpf/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,8 @@ $(RESOLVE_BTFIDS): $(BPFOBJ) | $(BUILD_DIR)/resolve_btfids \
219219
# build would have failed anyways.
220220
define get_sys_includes
221221
$(shell $(1) -v -E - </dev/null 2>&1 \
222-
| sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }')
222+
| sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }') \
223+
$(shell $(1) -dM -E - </dev/null | grep '#define __riscv_xlen ' |sed 's/#define /-D/' | sed 's/ /=/')
223224
endef
224225

225226
# Determine target endianness.

0 commit comments

Comments
 (0)