Skip to content

Commit ae574ae

Browse files
committed
selftests/nolibc: add support for LLVM= parameter
Makefile.include can modify CC and CFLAGS for usage with clang. Make use of it. Makefile.include is currently used to handle the O= variable. This is incompatible with the LLVM= handling as for O= it has to be included as early as possible, while for LLVM= it needs to be included after CFLAGS are set up. To avoid this incompatibility, switch the O= handling to custom logic. Reviewed-by: Shuah Khan <[email protected]> Acked-by: Willy Tarreau <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Thomas Weißschuh <[email protected]>
1 parent 1a1200b commit ae574ae

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tools/testing/selftests/nolibc/Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ ifeq ($(srctree),)
55
srctree := $(patsubst %/tools/testing/selftests/,%,$(dir $(CURDIR)))
66
endif
77

8-
include $(srctree)/tools/scripts/Makefile.include
98
include $(srctree)/tools/scripts/utilities.mak
109
# We need this for the "cc-option" macro.
1110
include $(srctree)/tools/build/Build.include
@@ -14,15 +13,16 @@ ifneq ($(O),)
1413
ifneq ($(call is-absolute,$(O)),y)
1514
$(error Only absolute O= parameters are supported)
1615
endif
16+
objtree := $(O)
17+
else
18+
objtree ?= $(srctree)
1719
endif
1820

1921
ifeq ($(ARCH),)
2022
include $(srctree)/scripts/subarch.include
2123
ARCH = $(SUBARCH)
2224
endif
2325

24-
objtree ?= $(srctree)
25-
2626
# XARCH extends the kernel's ARCH with a few variants of the same
2727
# architecture that only differ by the configuration, the toolchain
2828
# and the Qemu program used. It is copied as-is into ARCH except for
@@ -155,6 +155,9 @@ CFLAGS ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 -W -Wall -Wex
155155
$(CFLAGS_$(XARCH)) $(CFLAGS_STACKPROTECTOR) $(CFLAGS_EXTRA)
156156
LDFLAGS :=
157157

158+
# Modify CFLAGS based on LLVM=
159+
include $(srctree)/tools/scripts/Makefile.include
160+
158161
REPORT ?= awk '/\[OK\][\r]*$$/{p++} /\[FAIL\][\r]*$$/{if (!f) printf("\n"); f++; print;} /\[SKIPPED\][\r]*$$/{s++} \
159162
END{ printf("\n%3d test(s): %3d passed, %3d skipped, %3d failed => status: ", p+s+f, p, s, f); \
160163
if (f || !p) printf("failure\n"); else if (s) printf("warning\n"); else printf("success\n");; \

0 commit comments

Comments
 (0)