* [PATCH bpf 1/2] selftests/bpf: Explicitly pass RESOLVE_BTFIDS to sub-make
@ 2022-11-15 18:20 ` Björn Töpel
0 siblings, 0 replies; 10+ messages in thread
From: Björn Töpel @ 2022-11-15 18:20 UTC (permalink / raw)
To: bpf, Andrii Nakryiko, Alexei Starovoitov, Daniel Borkmann
Cc: Björn Töpel, linux-riscv, netdev, Anders Roxell,
Mykola Lysenko, linux-kselftest
From: Björn Töpel <bjorn@rivosinc.com>
When cross-compiling selftests/bpf, the resolve_btfids binary end up
in a different directory, than the regular resolve_btfids
builds. Populate RESOLVE_BTFIDS for sub-make, so it can find the
binary.
Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
---
tools/testing/selftests/bpf/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index e6cf21fad69f..8f8ede30e94e 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -200,7 +200,7 @@ $(OUTPUT)/sign-file: ../../../../scripts/sign-file.c
$(OUTPUT)/bpf_testmod.ko: $(VMLINUX_BTF) $(wildcard bpf_testmod/Makefile bpf_testmod/*.[ch])
$(call msg,MOD,,$@)
$(Q)$(RM) bpf_testmod/bpf_testmod.ko # force re-compilation
- $(Q)$(MAKE) $(submake_extras) -C bpf_testmod
+ $(Q)$(MAKE) $(submake_extras) RESOLVE_BTFIDS=$(RESOLVE_BTFIDS) -C bpf_testmod
$(Q)cp bpf_testmod/bpf_testmod.ko $@
DEFAULT_BPFTOOL := $(HOST_SCRATCH_DIR)/sbin/bpftool
base-commit: 47df8a2f78bc34ff170d147d05b121f84e252b85
--
2.37.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH bpf 1/2] selftests/bpf: Explicitly pass RESOLVE_BTFIDS to sub-make
@ 2022-11-15 18:20 ` Björn Töpel
0 siblings, 0 replies; 10+ messages in thread
From: Björn Töpel @ 2022-11-15 18:20 UTC (permalink / raw)
To: bpf, Andrii Nakryiko, Alexei Starovoitov, Daniel Borkmann
Cc: Björn Töpel, linux-riscv, netdev, Anders Roxell,
Mykola Lysenko, linux-kselftest
From: Björn Töpel <bjorn@rivosinc.com>
When cross-compiling selftests/bpf, the resolve_btfids binary end up
in a different directory, than the regular resolve_btfids
builds. Populate RESOLVE_BTFIDS for sub-make, so it can find the
binary.
Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
---
tools/testing/selftests/bpf/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index e6cf21fad69f..8f8ede30e94e 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -200,7 +200,7 @@ $(OUTPUT)/sign-file: ../../../../scripts/sign-file.c
$(OUTPUT)/bpf_testmod.ko: $(VMLINUX_BTF) $(wildcard bpf_testmod/Makefile bpf_testmod/*.[ch])
$(call msg,MOD,,$@)
$(Q)$(RM) bpf_testmod/bpf_testmod.ko # force re-compilation
- $(Q)$(MAKE) $(submake_extras) -C bpf_testmod
+ $(Q)$(MAKE) $(submake_extras) RESOLVE_BTFIDS=$(RESOLVE_BTFIDS) -C bpf_testmod
$(Q)cp bpf_testmod/bpf_testmod.ko $@
DEFAULT_BPFTOOL := $(HOST_SCRATCH_DIR)/sbin/bpftool
base-commit: 47df8a2f78bc34ff170d147d05b121f84e252b85
--
2.37.2
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH bpf 2/2] selftests/bpf: Pass target triple to get_sys_includes macro
2022-11-15 18:20 ` Björn Töpel
@ 2022-11-15 18:20 ` Björn Töpel
-1 siblings, 0 replies; 10+ messages in thread
From: Björn Töpel @ 2022-11-15 18:20 UTC (permalink / raw)
To: bpf, Andrii Nakryiko, Alexei Starovoitov, Daniel Borkmann
Cc: Björn Töpel, linux-riscv, netdev, Anders Roxell,
Mykola Lysenko, linux-kselftest
From: Björn Töpel <bjorn@rivosinc.com>
When cross-compiling [1], the get_sys_includes make macro should use
the target system include path, and not the build hosts system include
path.
Make clang honor the CROSS_COMPILE triple.
[1] e.g. "ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- make"
Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
---
tools/testing/selftests/bpf/Makefile | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 8f8ede30e94e..a2a1eae75820 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -309,9 +309,9 @@ $(RESOLVE_BTFIDS): $(HOST_BPFOBJ) | $(HOST_BUILD_DIR)/resolve_btfids \
# Use '-idirafter': Don't interfere with include mechanics except where the
# build would have failed anyways.
define get_sys_includes
-$(shell $(1) -v -E - </dev/null 2>&1 \
+$(shell $(1) $(2) -v -E - </dev/null 2>&1 \
| sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }') \
-$(shell $(1) -dM -E - </dev/null | grep '__riscv_xlen ' | awk '{printf("-D__riscv_xlen=%d -D__BITS_PER_LONG=%d", $$3, $$3)}')
+$(shell $(1) $(2) -dM -E - </dev/null | grep '__riscv_xlen ' | awk '{printf("-D__riscv_xlen=%d -D__BITS_PER_LONG=%d", $$3, $$3)}')
endef
# Determine target endianness.
@@ -319,7 +319,11 @@ IS_LITTLE_ENDIAN = $(shell $(CC) -dM -E - </dev/null | \
grep 'define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__')
MENDIAN=$(if $(IS_LITTLE_ENDIAN),-mlittle-endian,-mbig-endian)
-CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG))
+ifneq ($(CROSS_COMPILE),)
+CLANG_TARGET_ARCH = --target=$(notdir $(CROSS_COMPILE:%-=%))
+endif
+
+CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH))
BPF_CFLAGS = -g -Werror -D__TARGET_ARCH_$(SRCARCH) $(MENDIAN) \
-I$(INCLUDE_DIR) -I$(CURDIR) -I$(APIDIR) \
-I$(abspath $(OUTPUT)/../usr/include)
@@ -539,7 +543,7 @@ $(eval $(call DEFINE_TEST_RUNNER,test_progs,no_alu32))
# Define test_progs BPF-GCC-flavored test runner.
ifneq ($(BPF_GCC),)
TRUNNER_BPF_BUILD_RULE := GCC_BPF_BUILD_RULE
-TRUNNER_BPF_CFLAGS := $(BPF_CFLAGS) $(call get_sys_includes,gcc)
+TRUNNER_BPF_CFLAGS := $(BPF_CFLAGS) $(call get_sys_includes,gcc,)
$(eval $(call DEFINE_TEST_RUNNER,test_progs,bpf_gcc))
endif
--
2.37.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH bpf 2/2] selftests/bpf: Pass target triple to get_sys_includes macro
@ 2022-11-15 18:20 ` Björn Töpel
0 siblings, 0 replies; 10+ messages in thread
From: Björn Töpel @ 2022-11-15 18:20 UTC (permalink / raw)
To: bpf, Andrii Nakryiko, Alexei Starovoitov, Daniel Borkmann
Cc: Björn Töpel, linux-riscv, netdev, Anders Roxell,
Mykola Lysenko, linux-kselftest
From: Björn Töpel <bjorn@rivosinc.com>
When cross-compiling [1], the get_sys_includes make macro should use
the target system include path, and not the build hosts system include
path.
Make clang honor the CROSS_COMPILE triple.
[1] e.g. "ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- make"
Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
---
tools/testing/selftests/bpf/Makefile | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 8f8ede30e94e..a2a1eae75820 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -309,9 +309,9 @@ $(RESOLVE_BTFIDS): $(HOST_BPFOBJ) | $(HOST_BUILD_DIR)/resolve_btfids \
# Use '-idirafter': Don't interfere with include mechanics except where the
# build would have failed anyways.
define get_sys_includes
-$(shell $(1) -v -E - </dev/null 2>&1 \
+$(shell $(1) $(2) -v -E - </dev/null 2>&1 \
| sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }') \
-$(shell $(1) -dM -E - </dev/null | grep '__riscv_xlen ' | awk '{printf("-D__riscv_xlen=%d -D__BITS_PER_LONG=%d", $$3, $$3)}')
+$(shell $(1) $(2) -dM -E - </dev/null | grep '__riscv_xlen ' | awk '{printf("-D__riscv_xlen=%d -D__BITS_PER_LONG=%d", $$3, $$3)}')
endef
# Determine target endianness.
@@ -319,7 +319,11 @@ IS_LITTLE_ENDIAN = $(shell $(CC) -dM -E - </dev/null | \
grep 'define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__')
MENDIAN=$(if $(IS_LITTLE_ENDIAN),-mlittle-endian,-mbig-endian)
-CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG))
+ifneq ($(CROSS_COMPILE),)
+CLANG_TARGET_ARCH = --target=$(notdir $(CROSS_COMPILE:%-=%))
+endif
+
+CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH))
BPF_CFLAGS = -g -Werror -D__TARGET_ARCH_$(SRCARCH) $(MENDIAN) \
-I$(INCLUDE_DIR) -I$(CURDIR) -I$(APIDIR) \
-I$(abspath $(OUTPUT)/../usr/include)
@@ -539,7 +543,7 @@ $(eval $(call DEFINE_TEST_RUNNER,test_progs,no_alu32))
# Define test_progs BPF-GCC-flavored test runner.
ifneq ($(BPF_GCC),)
TRUNNER_BPF_BUILD_RULE := GCC_BPF_BUILD_RULE
-TRUNNER_BPF_CFLAGS := $(BPF_CFLAGS) $(call get_sys_includes,gcc)
+TRUNNER_BPF_CFLAGS := $(BPF_CFLAGS) $(call get_sys_includes,gcc,)
$(eval $(call DEFINE_TEST_RUNNER,test_progs,bpf_gcc))
endif
--
2.37.2
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH bpf 1/2] selftests/bpf: Explicitly pass RESOLVE_BTFIDS to sub-make
2022-11-15 18:20 ` Björn Töpel
@ 2022-11-17 7:49 ` Jiri Olsa
-1 siblings, 0 replies; 10+ messages in thread
From: Jiri Olsa @ 2022-11-17 7:49 UTC (permalink / raw)
To: Björn Töpel
Cc: bpf, Andrii Nakryiko, Alexei Starovoitov, Daniel Borkmann,
Björn Töpel, linux-riscv, netdev, Anders Roxell,
Mykola Lysenko, linux-kselftest
On Tue, Nov 15, 2022 at 07:20:50PM +0100, Björn Töpel wrote:
> From: Björn Töpel <bjorn@rivosinc.com>
>
> When cross-compiling selftests/bpf, the resolve_btfids binary end up
> in a different directory, than the regular resolve_btfids
> builds. Populate RESOLVE_BTFIDS for sub-make, so it can find the
> binary.
>
> Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
thanks,
jirka
> ---
> tools/testing/selftests/bpf/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index e6cf21fad69f..8f8ede30e94e 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -200,7 +200,7 @@ $(OUTPUT)/sign-file: ../../../../scripts/sign-file.c
> $(OUTPUT)/bpf_testmod.ko: $(VMLINUX_BTF) $(wildcard bpf_testmod/Makefile bpf_testmod/*.[ch])
> $(call msg,MOD,,$@)
> $(Q)$(RM) bpf_testmod/bpf_testmod.ko # force re-compilation
> - $(Q)$(MAKE) $(submake_extras) -C bpf_testmod
> + $(Q)$(MAKE) $(submake_extras) RESOLVE_BTFIDS=$(RESOLVE_BTFIDS) -C bpf_testmod
> $(Q)cp bpf_testmod/bpf_testmod.ko $@
>
> DEFAULT_BPFTOOL := $(HOST_SCRATCH_DIR)/sbin/bpftool
>
> base-commit: 47df8a2f78bc34ff170d147d05b121f84e252b85
> --
> 2.37.2
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH bpf 1/2] selftests/bpf: Explicitly pass RESOLVE_BTFIDS to sub-make
@ 2022-11-17 7:49 ` Jiri Olsa
0 siblings, 0 replies; 10+ messages in thread
From: Jiri Olsa @ 2022-11-17 7:49 UTC (permalink / raw)
To: Björn Töpel
Cc: bpf, Andrii Nakryiko, Alexei Starovoitov, Daniel Borkmann,
Björn Töpel, linux-riscv, netdev, Anders Roxell,
Mykola Lysenko, linux-kselftest
On Tue, Nov 15, 2022 at 07:20:50PM +0100, Björn Töpel wrote:
> From: Björn Töpel <bjorn@rivosinc.com>
>
> When cross-compiling selftests/bpf, the resolve_btfids binary end up
> in a different directory, than the regular resolve_btfids
> builds. Populate RESOLVE_BTFIDS for sub-make, so it can find the
> binary.
>
> Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
thanks,
jirka
> ---
> tools/testing/selftests/bpf/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index e6cf21fad69f..8f8ede30e94e 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -200,7 +200,7 @@ $(OUTPUT)/sign-file: ../../../../scripts/sign-file.c
> $(OUTPUT)/bpf_testmod.ko: $(VMLINUX_BTF) $(wildcard bpf_testmod/Makefile bpf_testmod/*.[ch])
> $(call msg,MOD,,$@)
> $(Q)$(RM) bpf_testmod/bpf_testmod.ko # force re-compilation
> - $(Q)$(MAKE) $(submake_extras) -C bpf_testmod
> + $(Q)$(MAKE) $(submake_extras) RESOLVE_BTFIDS=$(RESOLVE_BTFIDS) -C bpf_testmod
> $(Q)cp bpf_testmod/bpf_testmod.ko $@
>
> DEFAULT_BPFTOOL := $(HOST_SCRATCH_DIR)/sbin/bpftool
>
> base-commit: 47df8a2f78bc34ff170d147d05b121f84e252b85
> --
> 2.37.2
>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH bpf 2/2] selftests/bpf: Pass target triple to get_sys_includes macro
2022-11-15 18:20 ` Björn Töpel
@ 2022-11-17 9:03 ` Anders Roxell
-1 siblings, 0 replies; 10+ messages in thread
From: Anders Roxell @ 2022-11-17 9:03 UTC (permalink / raw)
To: Björn Töpel
Cc: bpf, Andrii Nakryiko, Alexei Starovoitov, Daniel Borkmann,
Björn Töpel, linux-riscv, netdev, Mykola Lysenko,
linux-kselftest
On Tue, 15 Nov 2022 at 19:21, Björn Töpel <bjorn@kernel.org> wrote:
>
> From: Björn Töpel <bjorn@rivosinc.com>
>
> When cross-compiling [1], the get_sys_includes make macro should use
> the target system include path, and not the build hosts system include
> path.
>
> Make clang honor the CROSS_COMPILE triple.
>
> [1] e.g. "ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- make"
>
> Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
For both patches.
Tested-by: Anders Roxell <anders.roxell@linaro.org>
> ---
> tools/testing/selftests/bpf/Makefile | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 8f8ede30e94e..a2a1eae75820 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -309,9 +309,9 @@ $(RESOLVE_BTFIDS): $(HOST_BPFOBJ) | $(HOST_BUILD_DIR)/resolve_btfids \
> # Use '-idirafter': Don't interfere with include mechanics except where the
> # build would have failed anyways.
> define get_sys_includes
> -$(shell $(1) -v -E - </dev/null 2>&1 \
> +$(shell $(1) $(2) -v -E - </dev/null 2>&1 \
> | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }') \
> -$(shell $(1) -dM -E - </dev/null | grep '__riscv_xlen ' | awk '{printf("-D__riscv_xlen=%d -D__BITS_PER_LONG=%d", $$3, $$3)}')
> +$(shell $(1) $(2) -dM -E - </dev/null | grep '__riscv_xlen ' | awk '{printf("-D__riscv_xlen=%d -D__BITS_PER_LONG=%d", $$3, $$3)}')
> endef
>
> # Determine target endianness.
> @@ -319,7 +319,11 @@ IS_LITTLE_ENDIAN = $(shell $(CC) -dM -E - </dev/null | \
> grep 'define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__')
> MENDIAN=$(if $(IS_LITTLE_ENDIAN),-mlittle-endian,-mbig-endian)
>
> -CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG))
> +ifneq ($(CROSS_COMPILE),)
> +CLANG_TARGET_ARCH = --target=$(notdir $(CROSS_COMPILE:%-=%))
> +endif
> +
> +CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH))
Maybe it would make sense to move this trick into selftests/lib.mk
since there are more Makefiles that
would benefit from this, like tc-testing or net/bpf to name a few.
Cheers,
Anders
> BPF_CFLAGS = -g -Werror -D__TARGET_ARCH_$(SRCARCH) $(MENDIAN) \
> -I$(INCLUDE_DIR) -I$(CURDIR) -I$(APIDIR) \
> -I$(abspath $(OUTPUT)/../usr/include)
> @@ -539,7 +543,7 @@ $(eval $(call DEFINE_TEST_RUNNER,test_progs,no_alu32))
> # Define test_progs BPF-GCC-flavored test runner.
> ifneq ($(BPF_GCC),)
> TRUNNER_BPF_BUILD_RULE := GCC_BPF_BUILD_RULE
> -TRUNNER_BPF_CFLAGS := $(BPF_CFLAGS) $(call get_sys_includes,gcc)
> +TRUNNER_BPF_CFLAGS := $(BPF_CFLAGS) $(call get_sys_includes,gcc,)
> $(eval $(call DEFINE_TEST_RUNNER,test_progs,bpf_gcc))
> endif
>
> --
> 2.37.2
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH bpf 2/2] selftests/bpf: Pass target triple to get_sys_includes macro
@ 2022-11-17 9:03 ` Anders Roxell
0 siblings, 0 replies; 10+ messages in thread
From: Anders Roxell @ 2022-11-17 9:03 UTC (permalink / raw)
To: Björn Töpel
Cc: bpf, Andrii Nakryiko, Alexei Starovoitov, Daniel Borkmann,
Björn Töpel, linux-riscv, netdev, Mykola Lysenko,
linux-kselftest
On Tue, 15 Nov 2022 at 19:21, Björn Töpel <bjorn@kernel.org> wrote:
>
> From: Björn Töpel <bjorn@rivosinc.com>
>
> When cross-compiling [1], the get_sys_includes make macro should use
> the target system include path, and not the build hosts system include
> path.
>
> Make clang honor the CROSS_COMPILE triple.
>
> [1] e.g. "ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- make"
>
> Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
For both patches.
Tested-by: Anders Roxell <anders.roxell@linaro.org>
> ---
> tools/testing/selftests/bpf/Makefile | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 8f8ede30e94e..a2a1eae75820 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -309,9 +309,9 @@ $(RESOLVE_BTFIDS): $(HOST_BPFOBJ) | $(HOST_BUILD_DIR)/resolve_btfids \
> # Use '-idirafter': Don't interfere with include mechanics except where the
> # build would have failed anyways.
> define get_sys_includes
> -$(shell $(1) -v -E - </dev/null 2>&1 \
> +$(shell $(1) $(2) -v -E - </dev/null 2>&1 \
> | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }') \
> -$(shell $(1) -dM -E - </dev/null | grep '__riscv_xlen ' | awk '{printf("-D__riscv_xlen=%d -D__BITS_PER_LONG=%d", $$3, $$3)}')
> +$(shell $(1) $(2) -dM -E - </dev/null | grep '__riscv_xlen ' | awk '{printf("-D__riscv_xlen=%d -D__BITS_PER_LONG=%d", $$3, $$3)}')
> endef
>
> # Determine target endianness.
> @@ -319,7 +319,11 @@ IS_LITTLE_ENDIAN = $(shell $(CC) -dM -E - </dev/null | \
> grep 'define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__')
> MENDIAN=$(if $(IS_LITTLE_ENDIAN),-mlittle-endian,-mbig-endian)
>
> -CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG))
> +ifneq ($(CROSS_COMPILE),)
> +CLANG_TARGET_ARCH = --target=$(notdir $(CROSS_COMPILE:%-=%))
> +endif
> +
> +CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH))
Maybe it would make sense to move this trick into selftests/lib.mk
since there are more Makefiles that
would benefit from this, like tc-testing or net/bpf to name a few.
Cheers,
Anders
> BPF_CFLAGS = -g -Werror -D__TARGET_ARCH_$(SRCARCH) $(MENDIAN) \
> -I$(INCLUDE_DIR) -I$(CURDIR) -I$(APIDIR) \
> -I$(abspath $(OUTPUT)/../usr/include)
> @@ -539,7 +543,7 @@ $(eval $(call DEFINE_TEST_RUNNER,test_progs,no_alu32))
> # Define test_progs BPF-GCC-flavored test runner.
> ifneq ($(BPF_GCC),)
> TRUNNER_BPF_BUILD_RULE := GCC_BPF_BUILD_RULE
> -TRUNNER_BPF_CFLAGS := $(BPF_CFLAGS) $(call get_sys_includes,gcc)
> +TRUNNER_BPF_CFLAGS := $(BPF_CFLAGS) $(call get_sys_includes,gcc,)
> $(eval $(call DEFINE_TEST_RUNNER,test_progs,bpf_gcc))
> endif
>
> --
> 2.37.2
>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH bpf 1/2] selftests/bpf: Explicitly pass RESOLVE_BTFIDS to sub-make
2022-11-15 18:20 ` Björn Töpel
@ 2022-11-17 23:30 ` patchwork-bot+netdevbpf
-1 siblings, 0 replies; 10+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-11-17 23:30 UTC (permalink / raw)
To: =?utf-8?b?QmrDtnJuIFTDtnBlbCA8Ympvcm5Aa2VybmVsLm9yZz4=?=
Cc: bpf, andrii, ast, daniel, bjorn, linux-riscv, netdev,
anders.roxell, mykolal, linux-kselftest
Hello:
This series was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:
On Tue, 15 Nov 2022 19:20:50 +0100 you wrote:
> From: Björn Töpel <bjorn@rivosinc.com>
>
> When cross-compiling selftests/bpf, the resolve_btfids binary end up
> in a different directory, than the regular resolve_btfids
> builds. Populate RESOLVE_BTFIDS for sub-make, so it can find the
> binary.
>
> [...]
Here is the summary with links:
- [bpf,1/2] selftests/bpf: Explicitly pass RESOLVE_BTFIDS to sub-make
https://git.kernel.org/bpf/bpf-next/c/c4525f05ca3c
- [bpf,2/2] selftests/bpf: Pass target triple to get_sys_includes macro
https://git.kernel.org/bpf/bpf-next/c/98b2afc8a67f
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH bpf 1/2] selftests/bpf: Explicitly pass RESOLVE_BTFIDS to sub-make
@ 2022-11-17 23:30 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 10+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-11-17 23:30 UTC (permalink / raw)
To: =?utf-8?b?QmrDtnJuIFTDtnBlbCA8Ympvcm5Aa2VybmVsLm9yZz4=?=
Cc: bpf, andrii, ast, daniel, bjorn, linux-riscv, netdev,
anders.roxell, mykolal, linux-kselftest
Hello:
This series was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:
On Tue, 15 Nov 2022 19:20:50 +0100 you wrote:
> From: Björn Töpel <bjorn@rivosinc.com>
>
> When cross-compiling selftests/bpf, the resolve_btfids binary end up
> in a different directory, than the regular resolve_btfids
> builds. Populate RESOLVE_BTFIDS for sub-make, so it can find the
> binary.
>
> [...]
Here is the summary with links:
- [bpf,1/2] selftests/bpf: Explicitly pass RESOLVE_BTFIDS to sub-make
https://git.kernel.org/bpf/bpf-next/c/c4525f05ca3c
- [bpf,2/2] selftests/bpf: Pass target triple to get_sys_includes macro
https://git.kernel.org/bpf/bpf-next/c/98b2afc8a67f
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-11-17 23:30 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-15 18:20 [PATCH bpf 1/2] selftests/bpf: Explicitly pass RESOLVE_BTFIDS to sub-make Björn Töpel
2022-11-15 18:20 ` Björn Töpel
2022-11-15 18:20 ` [PATCH bpf 2/2] selftests/bpf: Pass target triple to get_sys_includes macro Björn Töpel
2022-11-15 18:20 ` Björn Töpel
2022-11-17 9:03 ` Anders Roxell
2022-11-17 9:03 ` Anders Roxell
2022-11-17 7:49 ` [PATCH bpf 1/2] selftests/bpf: Explicitly pass RESOLVE_BTFIDS to sub-make Jiri Olsa
2022-11-17 7:49 ` Jiri Olsa
2022-11-17 23:30 ` patchwork-bot+netdevbpf
2022-11-17 23:30 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.