* Re: [PATCH bpf-next v2 8/8] selftests/bpf: Avoid static LLVM linking for cross builds
@ 2026-06-02 21:00 kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-06-02 21:00 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp
::::::
:::::: Manual check reason: "low confidence bisect report"
:::::: Manual check reason: "only suspicious fbc files changed"
::::::
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20260602-tools_build_fix_zero_init_bpf_only-v2-8-c76e5250ea1c@arm.com>
References: <20260602-tools_build_fix_zero_init_bpf_only-v2-8-c76e5250ea1c@arm.com>
TO: Leo Yan <leo.yan@arm.com>
TO: Quentin Monnet <qmo@kernel.org>
TO: Alexei Starovoitov <ast@kernel.org>
TO: Daniel Borkmann <daniel@iogearbox.net>
TO: Andrii Nakryiko <andrii@kernel.org>
TO: Martin KaFai Lau <martin.lau@linux.dev>
TO: Eduard Zingerman <eddyz87@gmail.com>
TO: Song Liu <song@kernel.org>
TO: Yonghong Song <yonghong.song@linux.dev>
TO: John Fastabend <john.fastabend@gmail.com>
TO: KP Singh <kpsingh@kernel.org>
TO: Stanislav Fomichev <sdf@fomichev.me>
TO: Hao Luo <haoluo@google.com>
TO: Jiri Olsa <jolsa@kernel.org>
TO: Shuah Khan <skhan@linuxfoundation.org>
TO: Lorenz Bauer <lmb@isovalent.com>
TO: Nathan Chancellor <nathan@kernel.org>
TO: Nick Desaulniers <nick.desaulniers+lkml@gmail.com>
TO: Bill Wendling <morbo@google.com>
TO: Justin Stitt <justinstitt@google.com>
CC: Arnaldo Carvalho de Melo <acme@kernel.org>
CC: Namhyung Kim <namhyung@kernel.org>
CC: Ian Rogers <irogers@google.com>
CC: James Clark <james.clark@linaro.org>
CC: Kees Cook <kees@kernel.org>
CC: bpf@vger.kernel.org
CC: linux-kernel@vger.kernel.org
CC: linux-kselftest@vger.kernel.org
CC: llvm@lists.linux.dev
CC: Leo Yan <leo.yan@arm.com>
Hi Leo,
kernel test robot noticed the following build warnings:
[auto build test WARNING on b93c55b4932dd7e32dca8cf34a3443cc87a02906]
url: https://github.com/intel-lab-lkp/linux/commits/Leo-Yan/bpftool-Pass-host-flags-to-bootstrap-libbpf/20260602-231100
base: b93c55b4932dd7e32dca8cf34a3443cc87a02906
patch link: https://lore.kernel.org/r/20260602-tools_build_fix_zero_init_bpf_only-v2-8-c76e5250ea1c%40arm.com
patch subject: [PATCH bpf-next v2 8/8] selftests/bpf: Avoid static LLVM linking for cross builds
:::::: branch date: 6 hours ago
:::::: commit date: 6 hours ago
config: riscv-allnoconfig-bpf (https://download.01.org/0day-ci/archive/20260602/202606022207.PcDtt93e-lkp@intel.com/config)
compiler: riscv64-linux-gnu-gcc (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260602/202606022207.PcDtt93e-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/r/202606022207.PcDtt93e-lkp@intel.com/
All warnings (new ones prefixed by >>):
Makefile.config:577: No elfutils/debuginfod.h found, no debuginfo server support, please install libdebuginfod-dev/elfutils-debuginfod-client-devel or equivalent
Makefile.config:964: No libllvm 13+ found, slower source file resolution, please install llvm-devel/llvm-dev
Makefile.config:1160: Rust is not found. Test workloads with rust are disabled.
PERF_VERSION = 7.1.rc5.g381f7c643a0a
>> cc1: warning: '-Wformat-y2k' ignored without '-Wformat' [-Wformat-y2k]
>> cc1: warning: '-Wformat-security' ignored without '-Wformat' [-Wformat-security]
builtin-trace.c: In function 'syscall_arg__strtoul_btf_enum':
builtin-trace.c:967:27: error: comparison of integer expressions of different signedness: 'int' and '__u32' {aka 'unsigned int'} [-Werror=sign-compare]
967 | for (int i = 0; i < btf_vlen(bt); ++i, ++be) {
| ^
util/btf.c: In function '__btf_type__find_member_by_name':
util/btf.c:19:43: error: comparison of integer expressions of different signedness: 'int' and '__u32' {aka 'unsigned int'} [-Werror=sign-compare]
19 | for (i = 0, m = btf_members(t); i < btf_vlen(t); i++, m++) {
| ^
cc1: all warnings being treated as errors
make[4]: *** [tools/build/Makefile.build:95: util/btf.o] Error 1
make[4]: *** Waiting for unfinished jobs....
cc1: all warnings being treated as errors
make[3]: *** [tools/build/Makefile.build:95: builtin-trace.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: *** [tools/build/Makefile.build:158: util] Error 2
make[2]: *** [Makefile.perf:802: perf-util-in.o] Error 2
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [Makefile.perf:775: perf-in.o] Error 2
make[1]: *** [Makefile.perf:288: sub-make] Error 2
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH bpf-next v2 0/8] tools build: bpf: Append EXTRA_CFLAGS and HOST_EXTRACFLAGS
@ 2026-06-02 14:47 Leo Yan
2026-06-02 14:47 ` [PATCH bpf-next v2 8/8] selftests/bpf: Avoid static LLVM linking for cross builds Leo Yan
0 siblings, 1 reply; 3+ messages in thread
From: Leo Yan @ 2026-06-02 14:47 UTC (permalink / raw)
To: Quentin Monnet, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
Hao Luo, Jiri Olsa, Shuah Khan, Lorenz Bauer, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt
Cc: Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers, James Clark,
Kees Cook, bpf, linux-kernel, linux-kselftest, llvm, Leo Yan,
Ihor Solodrai
Append EXTRA_CFLAGS and HOST_EXTRACFLAGS to the BPF build.
This mitigates an issue introduced in GCC 15, where a {0} initializer
does not guarantee zeroing the entire union [1].
The common changes under tools to support EXTRA_CFLAGS and
HOST_EXTRACFLAGS are sent separately [2]. As suggested, BPF patches
would be picked up via the bpf tree, so this series only includes BPF
related changes.
Verification on bpf-ci (with tools changes [2]:
https://github.com/kernel-patches/bpf/actions/runs/26815163486
[1] https://gcc.gnu.org/gcc-15/changes.html
[2] https://lore.kernel.org/all/20260602-tools_build_fix_zero_init-v7-0-631baf679fe7@arm.com/
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
Changes in v2:
- Used strscpy() instead in patch 06 (Ihor).
- Added prefix "bpf-next" in subject (Alexei).
- Added patch 01 to pass host cflags to bootstrap libbpf.
- Added patch 08 to avoid static LLVM linking for cross build.
- Link to v1: https://lore.kernel.org/r/20260323-tools_build_fix_zero_init_bpf_only-v1-0-d1cfad2f4cd1@arm.com
---
Leo Yan (8):
bpftool: Pass host flags to bootstrap libbpf
bpftool: Avoid adding EXTRA_CFLAGS to HOST_CFLAGS
bpftool: Append extra host flags
libbpf: Initialize CFLAGS before including Makefile.include
tools/bpf: build: Append extra cflags
selftests/bpf: Initialize operation name before use
selftests/bpf: Use common CFLAGS for urandom_read
selftests/bpf: Avoid static LLVM linking for cross builds
tools/bpf/Makefile | 1 +
tools/bpf/bpftool/Makefile | 15 ++++++++++++---
tools/lib/bpf/Makefile | 17 +++++++++--------
tools/testing/selftests/bpf/Makefile | 19 +++++++++++++------
tools/testing/selftests/bpf/prog_tests/verifier_log.c | 1 +
5 files changed, 36 insertions(+), 17 deletions(-)
---
base-commit: b93c55b4932dd7e32dca8cf34a3443cc87a02906
change-id: 20260323-tools_build_fix_zero_init_bpf_only-52232f62fb7f
Best regards,
--
Leo Yan <leo.yan@arm.com>
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH bpf-next v2 8/8] selftests/bpf: Avoid static LLVM linking for cross builds
2026-06-02 14:47 [PATCH bpf-next v2 0/8] tools build: bpf: Append EXTRA_CFLAGS and HOST_EXTRACFLAGS Leo Yan
@ 2026-06-02 14:47 ` Leo Yan
2026-06-02 17:33 ` sashiko-bot
0 siblings, 1 reply; 3+ messages in thread
From: Leo Yan @ 2026-06-02 14:47 UTC (permalink / raw)
To: Quentin Monnet, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
Hao Luo, Jiri Olsa, Shuah Khan, Lorenz Bauer, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt
Cc: Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers, James Clark,
Kees Cook, bpf, linux-kernel, linux-kselftest, llvm, Leo Yan
The BPF selftests prefer static LLVM linking, which works for native
builds but can break cross builds. Its --link-static output may include
host-only libraries that are unavailable for the cross compilation,
causing link failures.
Avoid static LLVM linking for cross builds and use shared LLVM libraries
instead. Native builds keep the existing behavior.
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/testing/selftests/bpf/Makefile | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 1e47e29ba4214925c62afc0595a7edb859ace944..ffa90674e86f639d3a9cadb833e57f3693d77bdc 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -188,8 +188,15 @@ ifeq ($(feature-llvm),1)
LLVM_CONFIG_LIB_COMPONENTS := mcdisassembler all-targets
# both llvm-config and lib.mk add -D_GNU_SOURCE, which ends up as conflict
LLVM_CFLAGS += $(filter-out -D_GNU_SOURCE,$(shell $(LLVM_CONFIG) --cflags))
- # Prefer linking statically if it's available, otherwise fallback to shared
- ifeq ($(shell $(LLVM_CONFIG) --link-static --libs >/dev/null 2>&1 && echo static),static)
+ # Cross compilation must use dynamic linking to avoid unresolved library
+ # dependencies. For native build, prefer linking statically if it's
+ # available, otherwise fallback to shared.
+ ifneq ($(ARCH), $(HOSTARCH))
+ LLVM_LINK_STATIC :=
+ else
+ LLVM_LINK_STATIC := $(shell $(LLVM_CONFIG) --link-static --libs >/dev/null 2>&1 && echo y)
+ endif
+ ifeq ($(LLVM_LINK_STATIC),y)
LLVM_LDLIBS += $(shell $(LLVM_CONFIG) --link-static --libs $(LLVM_CONFIG_LIB_COMPONENTS))
LLVM_LDLIBS += $(filter-out -lxml2,$(shell $(LLVM_CONFIG) --link-static --system-libs $(LLVM_CONFIG_LIB_COMPONENTS)))
LLVM_LDLIBS += -lstdc++
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH bpf-next v2 8/8] selftests/bpf: Avoid static LLVM linking for cross builds
2026-06-02 14:47 ` [PATCH bpf-next v2 8/8] selftests/bpf: Avoid static LLVM linking for cross builds Leo Yan
@ 2026-06-02 17:33 ` sashiko-bot
0 siblings, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-06-02 17:33 UTC (permalink / raw)
To: Leo Yan; +Cc: bpf
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Flawed native vs cross-build detection using un-normalized `ARCH` against normalized `HOSTARCH`.
--
commit 9a32865094dbf702cf09a9de14d120a1f3ca8a92
Author: Leo Yan <leo.yan@arm.com>
selftests/bpf: Avoid static LLVM linking for cross builds
This commit modifies the BPF selftests Makefile to avoid static LLVM linking
during cross builds. It intends to use dynamic linking for cross compilation
while preserving the existing preference for static linking on native builds.
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 1e47e29ba4214..ffa90674e86f6 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -188,8 +188,15 @@ ifeq ($(feature-llvm),1)
> LLVM_CONFIG_LIB_COMPONENTS := mcdisassembler all-targets
> # both llvm-config and lib.mk add -D_GNU_SOURCE, which ends up as conflict
> LLVM_CFLAGS += $(filter-out -D_GNU_SOURCE,$(shell $(LLVM_CONFIG) --cflags))
> - # Prefer linking statically if it's available, otherwise fallback to shared
> - ifeq ($(shell $(LLVM_CONFIG) --link-static --libs >/dev/null 2>&1 && echo static),static)
> + # Cross compilation must use dynamic linking to avoid unresolved library
> + # dependencies. For native build, prefer linking statically if it's
> + # available, otherwise fallback to shared.
> + ifneq ($(ARCH), $(HOSTARCH))
[Severity: Medium]
Will this comparison accurately identify native builds?
The kernel build system normalizes $(HOSTARCH) (for example, "x86_64" becomes
"x86"), but $(ARCH) might retain the un-normalized string if passed from the
environment or top-level Makefile.
If $(ARCH) is "x86_64" and $(HOSTARCH) is "x86", this check evaluates to true
even on a native build, unintentionally forcing shared LLVM libraries instead
of keeping the static linking behavior as intended.
Would it be more robust to compare $(SRCARCH) to $(HOSTARCH), or to check if
$(CROSS_COMPILE) is empty instead?
> + LLVM_LINK_STATIC :=
> + else
> + LLVM_LINK_STATIC := $(shell $(LLVM_CONFIG) --link-static --libs >/dev/null 2>&1 && echo y)
> + endif
> + ifeq ($(LLVM_LINK_STATIC),y)
> LLVM_LDLIBS += $(shell $(LLVM_CONFIG) --link-static --libs $(LLVM_CONFIG_LIB_COMPONENTS))
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260602-tools_build_fix_zero_init_bpf_only-v2-0-c76e5250ea1c@arm.com?part=8
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-02 21:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-02 21:00 [PATCH bpf-next v2 8/8] selftests/bpf: Avoid static LLVM linking for cross builds kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2026-06-02 14:47 [PATCH bpf-next v2 0/8] tools build: bpf: Append EXTRA_CFLAGS and HOST_EXTRACFLAGS Leo Yan
2026-06-02 14:47 ` [PATCH bpf-next v2 8/8] selftests/bpf: Avoid static LLVM linking for cross builds Leo Yan
2026-06-02 17:33 ` sashiko-bot
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.