On Sat, Apr 10, 2021 at 6:49 PM Yonghong Song <yhs@xxxxxx> wrote: > > selftests/bpf/Makefile includes lib.mk. With the following command > make -j60 LLVM=1 LLVM_IAS=1 <=== compile kernel > make -j60 -C tools/testing/selftests/bpf LLVM=1 LLVM_IAS=1 V=1 > some files are still compiled with gcc. This patch > fixed lib.mk issue which sets CC to gcc in all cases. > > Cc: Sedat Dilek <sedat.dilek@xxxxxxxxx> > Signed-off-by: Yonghong Song <yhs@xxxxxx> > --- > tools/testing/selftests/lib.mk | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk > index a5ce26d548e4..9a41d8bb9ff1 100644 > --- a/tools/testing/selftests/lib.mk > +++ b/tools/testing/selftests/lib.mk > @@ -1,6 +1,10 @@ > # This mimics the top-level Makefile. We do it explicitly here so that this > # Makefile can operate with or without the kbuild infrastructure. > +ifneq ($(LLVM),) > +CC := clang > +else > CC := $(CROSS_COMPILE)gcc > +endif > Why not use include "include ../../../scripts/Makefile.include" here and include CC and GNU or LLVM (bin)utils from there? Should the CC line have a $(CROSS_COMPILE) for people doing cross-compilation? CC := $(CROSS_COMPILE)clang - Sedat - > ifeq (0,$(MAKELEVEL)) > ifeq ($(OUTPUT),) > -- > 2.30.2 >