From 112035f99161ceedd86a72e00fd35aaa94959162 Mon Sep 17 00:00:00 2001 From: Marco Schlumpp Date: Fri, 3 Feb 2023 15:52:34 +0100 Subject: [PATCH] Apply -ffreestanding for the musl source code MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This is the corresponding commit for unikraft/unikraft#740. This prevents a self dependency caused by compiler optimizations, because the libc implementation cannot rely on underlying presence of a libc. Signed-off-by: Marco Schlumpp Reviewed-by: Maria Sfiraiala Reviewed-by: Eduard Vintilă Approved-by: Razvan Deaconescu Tested-by: Unikraft CI GitHub-Closes: #35 --- Makefile.uk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile.uk b/Makefile.uk index e419fea..11f3971 100644 --- a/Makefile.uk +++ b/Makefile.uk @@ -148,6 +148,10 @@ LIBMUSL_CFLAGS-y += -DUK_LIBC_SYSCALL=0 LIBMUSL_CFLAGS-y += -D_XOPEN_SOURCE=700 LIBMUSL_CFLAGS-y += $(LIBMUSL_HDRS_FLAGS-y) +# musl cannot rely on a libc library. Therefore, compile it as freestanding +# code. +LIBMUSL_CFLAGS-y += -ffreestanding + # We globally switch off warnings that are caused by musl's public headers CFLAGS += $(LIBMUSL_HDRS_FLAGS-y) CXXFLAGS += $(LIBMUSL_HDRS_FLAGS-y) -- 2.39.5