Commit ae574ae3 authored by Thomas Weißschuh's avatar Thomas Weißschuh

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: default avatarShuah Khan <skhan@linuxfoundation.org>
Acked-by: default avatarWilly Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20240807-nolibc-llvm-v2-10-c20f2f5fc7c2@weissschuh.netSigned-off-by: default avatarThomas Weißschuh <linux@weissschuh.net>
parent 1a1200b6
...@@ -5,7 +5,6 @@ ifeq ($(srctree),) ...@@ -5,7 +5,6 @@ ifeq ($(srctree),)
srctree := $(patsubst %/tools/testing/selftests/,%,$(dir $(CURDIR))) srctree := $(patsubst %/tools/testing/selftests/,%,$(dir $(CURDIR)))
endif endif
include $(srctree)/tools/scripts/Makefile.include
include $(srctree)/tools/scripts/utilities.mak include $(srctree)/tools/scripts/utilities.mak
# We need this for the "cc-option" macro. # We need this for the "cc-option" macro.
include $(srctree)/tools/build/Build.include include $(srctree)/tools/build/Build.include
...@@ -14,6 +13,9 @@ ifneq ($(O),) ...@@ -14,6 +13,9 @@ ifneq ($(O),)
ifneq ($(call is-absolute,$(O)),y) ifneq ($(call is-absolute,$(O)),y)
$(error Only absolute O= parameters are supported) $(error Only absolute O= parameters are supported)
endif endif
objtree := $(O)
else
objtree ?= $(srctree)
endif endif
ifeq ($(ARCH),) ifeq ($(ARCH),)
...@@ -21,8 +23,6 @@ include $(srctree)/scripts/subarch.include ...@@ -21,8 +23,6 @@ include $(srctree)/scripts/subarch.include
ARCH = $(SUBARCH) ARCH = $(SUBARCH)
endif endif
objtree ?= $(srctree)
# XARCH extends the kernel's ARCH with a few variants of the same # XARCH extends the kernel's ARCH with a few variants of the same
# architecture that only differ by the configuration, the toolchain # architecture that only differ by the configuration, the toolchain
# and the Qemu program used. It is copied as-is into ARCH except for # 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 ...@@ -155,6 +155,9 @@ CFLAGS ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 -W -Wall -Wex
$(CFLAGS_$(XARCH)) $(CFLAGS_STACKPROTECTOR) $(CFLAGS_EXTRA) $(CFLAGS_$(XARCH)) $(CFLAGS_STACKPROTECTOR) $(CFLAGS_EXTRA)
LDFLAGS := LDFLAGS :=
# Modify CFLAGS based on LLVM=
include $(srctree)/tools/scripts/Makefile.include
REPORT ?= awk '/\[OK\][\r]*$$/{p++} /\[FAIL\][\r]*$$/{if (!f) printf("\n"); f++; print;} /\[SKIPPED\][\r]*$$/{s++} \ REPORT ?= awk '/\[OK\][\r]*$$/{p++} /\[FAIL\][\r]*$$/{if (!f) printf("\n"); f++; print;} /\[SKIPPED\][\r]*$$/{s++} \
END{ printf("\n%3d test(s): %3d passed, %3d skipped, %3d failed => status: ", p+s+f, p, s, f); \ END{ printf("\n%3d test(s): %3d passed, %3d skipped, %3d failed => status: ", p+s+f, p, s, f); \
if (f || !p) printf("failure\n"); else if (s) printf("warning\n"); else printf("success\n");; \ if (f || !p) printf("failure\n"); else if (s) printf("warning\n"); else printf("success\n");; \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment