Skip to content

Commit 3157b7c

Browse files
committed
Merge branch 'selftest/bpf, riscv: Improved cross-building support'
Björn Töpel says: ==================== From: Björn Töpel <bjorn@rivosinc.com> Yet another "more cross-building support for RISC-V" series. An example how to invoke a gen_tar build: | make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- CC=riscv64-linux-gnu-gcc \ | HOSTCC=gcc O=/workspace/kbuild FORMAT= \ | SKIP_TARGETS="arm64 ia64 powerpc sparc64 x86 sgx" -j $(($(nproc)-1)) \ | -C tools/testing/selftests gen_tar Björn ==================== Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 parents cbcb199 + e096ab9 commit 3157b7c

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

tools/testing/selftests/bpf/Makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ TEST_GEN_PROGS_EXTENDED = test_sock_addr test_skb_cgroup_id_user \
104104
xskxceiver xdp_redirect_multi xdp_synproxy veristat xdp_hw_metadata \
105105
xdp_features
106106

107-
TEST_GEN_FILES += liburandom_read.so urandom_read sign-file
107+
TEST_GEN_FILES += liburandom_read.so urandom_read sign-file uprobe_multi
108108

109109
# Emit succinct information message describing current building step
110110
# $1 - generic step name (e.g., CC, LINK, etc);
@@ -188,7 +188,7 @@ $(OUTPUT)/%:%.c
188188
$(Q)$(LINK.c) $^ $(LDLIBS) -o $@
189189

190190
# LLVM's ld.lld doesn't support all the architectures, so use it only on x86
191-
ifeq ($(SRCARCH),x86)
191+
ifeq ($(SRCARCH),$(filter $(SRCARCH),x86 riscv))
192192
LLD := lld
193193
else
194194
LLD := ld
@@ -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)