Thread (82 messages) 82 messages, 2 authors, 15d ago

Re: [PATCH v3 11/58] objtool: Forward toolchain variables to the klp test runner

From: sashiko-bot@kernel.org
Date: 2026-09-14 23:45:34

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] objtool: tests target silently falls back to GNU objcopy under LLVM=1
--

commit 11c79ea0e223d9512f0e164886cfdec6a0e5e3b2
Author: Joe Lawrence [off-list ref]

objtool: Forward toolchain variables to the klp test runner

The tests target passes toolchain variables like CC, LD, READELF, and OBJCOPY
into the test scripts so that fixtures are built and inspected with the
selected toolchain.

[ ... ]
quoted hunk ↗ jump to hunk
diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
index ed5cf146ef2e2..a3d09a5af7a20 100644
--- a/tools/objtool/Makefile
+++ b/tools/objtool/Makefile
@@ -153,6 +153,8 @@ mrproper: clean
 
 tests: $(OBJTOOL)
 	$(Q)OBJTOOL=$(abspath $(OBJTOOL)) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) \
+		CC='$(CC) $(CLANG_CROSS_FLAGS)' LD='$(LD)' \
+		READELF='$(READELF)' OBJCOPY='$(OBJCOPY)' \
[Severity: Medium]
Will the tests target silently fall back to GNU objcopy when building with
LLVM=1?

It appears that tools/scripts/Makefile.include defines LLVM_OBJCOPY but leaves
OBJCOPY unset for LLVM builds. As a result, $(OBJCOPY) evaluates to an empty
string here in the tests recipe.

When this empty variable is passed to tools/objtool/tests/lib.sh, the fallback
logic:

OBJCOPY="${OBJCOPY:-${CROSS_COMPILE}objcopy}"

treats the empty OBJCOPY as null due to the :- operator. This substitutes the
default GNU objcopy instead of the intended llvm-objcopy, which defeats the
goal of using the selected LLVM toolchain.
 		KEEP=$(KEEP) $(srctree)/tools/objtool/tests/run-tests.sh
 
 FORCE:
-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260914230355.3422996-1-song@kernel.org?part=11
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help