selftests/bpf: add LDFLAGS when building test_verifier
Subsystems (5)
PATCH 1/1 selftests/bpf: add LDFLAGS when building test_verifier
From: Jisheng Zhang <[email protected]>
This is useful for cross compile process to point linker to the correct libelf, libcap, libz path.
--- tools/testing/selftests/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/Makefile +1 -1
@@ -447,7 +447,7 @@ verifier/tests.h: verifier/*.c ) > verifier/tests.h) $(OUTPUT)/test_verifier: test_verifier.c verifier/tests.h $(BPFOBJ) | $(OUTPUT) $(call msg,BINARY,,$@) - $(Q)$(CC) $(CFLAGS) $(filter %.a %.o %.c,$^) $(LDLIBS) -o $@ + $(Q)$(CC) $(CFLAGS) $(LDFLAGS) $(filter %.a %.o %.c,$^) $(LDLIBS) -o $@ # Make sure we are able to include and link libbpf against c++. $(OUTPUT)/test_cpp: test_cpp.cpp $(OUTPUT)/test_core_extern.skel.h $(BPFOBJ)
Signature · 1 line
2.31.0
Quoted 5 lines · Jisheng Zhang
From: Jisheng Zhang <[email protected]>
This is useful for cross compile process to point linker to the correct libelf, libcap, libz path.
LGTM:
btw: Do we also need LDFLAGS for some other binaries, like test_cpp, TRUNNER_BINARY, etc?
Thanks,
Song
Quoted 23 lines
Signed-off-by Jisheng Zhang <[email protected]>--- tools/testing/selftests/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/testing/selftests/bpf/Makefile +1
-2@@ -447,7 +447,7 @@ verifier/tests.h: verifier/*.c ) > verifier/tests.h) $(OUTPUT)/test_verifier: test_verifier.c verifier/tests.h $(BPFOBJ) | $(OUTPUT) $(call msg,BINARY,,$@) - $(Q)$(CC) $(CFLAGS) $(filter %.a %.o %.c,$^) $(LDLIBS) -o $@ + $(Q)$(CC) $(CFLAGS) $(LDFLAGS) $(filter %.a %.o %.c,$^) $(LDLIBS) -o $@ # Make sure we are able to include and link libbpf against c++. $(OUTPUT)/test_cpp: test_cpp.cpp $(OUTPUT)/test_core_extern.skel.h $(BPFOBJ) --2.31.0
Quoted 5 lines · Jisheng Zhang
From: Jisheng Zhang <[email protected]>
This is useful for cross compile process to point linker to the correct libelf, libcap, libz path.
Is this enough to make cross-compilation of selftests/bpf work? I think there was a discussion another day about cross-compiling selftests/bpf, so I wonder if this is the only change that's needed to make it work.
Quoted 23 lines
Signed-off-by Jisheng Zhang <[email protected]>--- tools/testing/selftests/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/testing/selftests/bpf/Makefile +1
-2@@ -447,7 +447,7 @@ verifier/tests.h: verifier/*.c ) > verifier/tests.h) $(OUTPUT)/test_verifier: test_verifier.c verifier/tests.h $(BPFOBJ) | $(OUTPUT) $(call msg,BINARY,,$@) - $(Q)$(CC) $(CFLAGS) $(filter %.a %.o %.c,$^) $(LDLIBS) -o $@ + $(Q)$(CC) $(CFLAGS) $(LDFLAGS) $(filter %.a %.o %.c,$^) $(LDLIBS) -o $@ # Make sure we are able to include and link libbpf against c++. $(OUTPUT)/test_cpp: test_cpp.cpp $(OUTPUT)/test_core_extern.skel.h $(BPFOBJ) --2.31.0