From 86fef08ac53b06ce48a4160f8569a3c8d2c2b65c Mon Sep 17 00:00:00 2001 From: Sharan Santhanam Date: Thu, 4 Feb 2021 23:42:15 +0530 Subject: [PATCH] build: Support gcc-10 compilation on Unikraft When compiling Unikraft with gcc-10, the compiler replace the memset function with a recursive builtin memset call, which result in a infinite recursive call to the memset causing exhaustion of the stack memory eventually leading to crash. To fix this the gcc provides compiler flags -ffreestanding and -fhosted. Signed-off-by: Sharan Santhanam Reviewed-by: Vlad-Andrei Badoiu --- Makefile.uk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile.uk b/Makefile.uk index 9f0da22e6..73f46ab13 100644 --- a/Makefile.uk +++ b/Makefile.uk @@ -60,6 +60,9 @@ M4FLAGS += -DUK_VERSION=$(UK_VERSION).$(UK_SUBVERSION) # "--enable-default-pie" by default. COMPFLAGS-$(call gcc_version_ge,6,1) += -fno-PIC LDFLAGS-$(call gcc_version_ge,6,1) += -no-pie +ifeq ($(call gcc_version_ge,10,0),y) +COMPFLAGS-y += -fhosted -ffreestanding -fno-tree-loop-distribute-patterns +endif COMPFLAGS-$(call have_clang) += -fno-builtin -fno-PIC LDFLAGS-$(call have_clang) += -no-pie -- 2.39.5