From 688379d1ed8b8f05849e7c2efa653504e9f316f1 Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Tue, 29 Jun 2021 11:49:58 +0200 Subject: [PATCH] sel4: fix segmentation fault with CCACHE=yes Building the elfloader in kernel-sel4.inc has a problem with Genodes CCACHE make variable. When issuing ... ! ./tool/depot/create mstein/bin/*/base-sel4-* CCACHE=yes ..., building the elfloader used to consume all memory of the host system and then run into a segmentation fault: ! make[6]: *** [elfloader/elfloader.o] Segmentation fault (core dumped) This is because the other build system invokes the CCACHE variable as a command in front of the compiler command. If CCACHE is set to 'yes', the 'yes' command is called and produces an endless output into some output file. The problem can be fixed by locally re-setting the CCACHE variable for the 'make ... elfloader' command to 'ccache' (Genode CCACHE==yes) or '' (Genode CCACHE!=yes). Fixes #4212 --- repos/base-sel4/lib/mk/spec/arm/kernel-sel4.inc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/repos/base-sel4/lib/mk/spec/arm/kernel-sel4.inc b/repos/base-sel4/lib/mk/spec/arm/kernel-sel4.inc index 90a5fcc5ff..dc9cfee611 100644 --- a/repos/base-sel4/lib/mk/spec/arm/kernel-sel4.inc +++ b/repos/base-sel4/lib/mk/spec/arm/kernel-sel4.inc @@ -12,6 +12,12 @@ else all: endif +ifeq ($(CCACHE),yes) +SEL4_CCACHE=ccache +else +SEL4_CCACHE= +endif + elfloader/elfloader.o: $(VERBOSE)cp -r $(TOOLS_DIR)/elfloader-tool $(LIB_CACHE_DIR)/$(LIB)/elfloader $(VERBOSE)mkdir -p $(LIB_CACHE_DIR)/$(LIB)/elfloader/tools/kbuild @@ -25,7 +31,8 @@ elfloader/elfloader.o: ARCH=arm PLAT=$(PLAT) ARMV=armv7-a __ARM_32__="y" \ CPU=$(CPU) ASFLAGS="-march=armv7-a" \ CFLAGS="-march=armv7-a -D__KERNEL_32__ -fno-builtin" \ - SEL4_COMMON=. SOURCE_DIR=. STAGE_DIR=. srctree=. + SEL4_COMMON=. CCACHE=$(SEL4_CCACHE) SOURCE_DIR=. STAGE_DIR=. \ + srctree=. build_kernel: elfloader/elfloader.o $(VERBOSE)$(MAKE) \