From: Joe Lawrence <joe.lawrence@redhat.com>
The tests target already passes ARCH and CROSS_COMPILE into
run-tests.sh. lib.sh uses those to pick a default compiler and
binutils:
CC=${CC:-${CROSS_COMPILE}gcc}
LD=${LD:-${CROSS_COMPILE}ld}
READELF=${READELF:-${CROSS_COMPILE}readelf}
OBJCOPY=${OBJCOPY:-${CROSS_COMPILE}objcopy}
Those defaults only apply when the variables reach the shell that sources
lib.sh. The recipe passed OBJTOOL, ARCH and CROSS_COMPILE explicitly, but
not CC or the binutils. Makefile-assigned values (e.g. from LLVM=1) are
not visible in the recipe environment unless forwarded:
$ LLVM=1 make -C tools/objtool tests
...
# preflight
# compiler gcc (GCC) ...
Pass CC, LD, READELF and OBJCOPY the same way as ARCH and CROSS_COMPILE,
so fixtures are built and inspected with the toolchain make selected:
$ LLVM=1 make -C tools/objtool tests
...
# preflight
# compiler clang version 21.1.8 ...
Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
Assisted-by: Claude:claude-opus-5
Signed-off-by: Song Liu <song@kernel.org>
---
tools/objtool/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
index ed5cf146ef2e..4429ae6db888 100644
--- a/tools/objtool/Makefile
+++ b/tools/objtool/Makefile
@@ -153,6 +153,7 @@ mrproper: clean
tests: $(OBJTOOL)
$(Q)OBJTOOL=$(abspath $(OBJTOOL)) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) \
+ CC='$(CC)' LD='$(LD)' READELF='$(READELF)' OBJCOPY='$(OBJCOPY)' \
KEEP=$(KEEP) $(srctree)/tools/objtool/tests/run-tests.sh
FORCE:
--
2.53.0-Meta