Skip to content

Commit 97a79e5

Browse files
bjorn-rivosanakryiko
authored andcommitted
selftests/bpf: Add cross-build support for urandom_read et al
Some userland programs in the BPF test suite, e.g. urandom_read, is missing cross-build support. Add cross-build support for these programs Signed-off-by: Björn Töpel <bjorn@rivosinc.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20231004122721.54525-2-bjorn@kernel.org
1 parent cbcb199 commit 97a79e5

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

tools/testing/selftests/bpf/Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,16 +198,18 @@ endif
198198
# do not fail. Static builds leave urandom_read relying on system-wide shared libraries.
199199
$(OUTPUT)/liburandom_read.so: urandom_read_lib1.c urandom_read_lib2.c liburandom_read.map
200200
$(call msg,LIB,,$@)
201-
$(Q)$(CLANG) $(filter-out -static,$(CFLAGS) $(LDFLAGS)) \
201+
$(Q)$(CLANG) $(CLANG_TARGET_ARCH) \
202+
$(filter-out -static,$(CFLAGS) $(LDFLAGS)) \
202203
$(filter %.c,$^) $(filter-out -static,$(LDLIBS)) \
203204
-fuse-ld=$(LLD) -Wl,-znoseparate-code -Wl,--build-id=sha1 \
204205
-Wl,--version-script=liburandom_read.map \
205206
-fPIC -shared -o $@
206207

207208
$(OUTPUT)/urandom_read: urandom_read.c urandom_read_aux.c $(OUTPUT)/liburandom_read.so
208209
$(call msg,BINARY,,$@)
209-
$(Q)$(CLANG) $(filter-out -static,$(CFLAGS) $(LDFLAGS)) $(filter %.c,$^) \
210-
-lurandom_read $(filter-out -static,$(LDLIBS)) -L$(OUTPUT) \
210+
$(Q)$(CLANG) $(CLANG_TARGET_ARCH) \
211+
$(filter-out -static,$(CFLAGS) $(LDFLAGS)) $(filter %.c,$^) \
212+
-lurandom_read $(filter-out -static,$(LDLIBS)) -L$(OUTPUT) \
211213
-fuse-ld=$(LLD) -Wl,-znoseparate-code -Wl,--build-id=sha1 \
212214
-Wl,-rpath=. -o $@
213215

0 commit comments

Comments
 (0)