[make] Build with -ffreestanding
We should build with -ffreestanding since we are building an OS kernel and cannot rely on all hosted environment functionality being present. Specifically this fixes a compilation error with clang caused by the the #include_next <limits.h>: ``` In file included from target/pc-x86/config.c:9: In file included from dev/include/dev/driver.h:10: In file included from lib/libc/include/sys/types.h:10: In file included from lib/libc/include/limits.h:5: In file included from /usr/lib/llvm-15/lib/clang/15.0.7/include/limits.h:21: /usr/include/limits.h:26:10: fatal error: 'bits/libc-header-start.h' file not found #include <bits/libc-header-start.h> ``` The flag fixes this issue by ensuring that __STDC_HOSTED__ is no longer set to 1, so Clang's limits.h will not try to include the host system one.
This commit is contained in:
@@ -66,6 +66,9 @@ GLOBAL_COMPILEFLAGS := -g -include $(CONFIGHEADER)
|
||||
GLOBAL_COMPILEFLAGS += -Wextra -Wall -Werror=return-type -Wshadow -Wdouble-promotion
|
||||
GLOBAL_COMPILEFLAGS += -Wno-multichar -Wno-unused-parameter -Wno-unused-function -Wno-unused-label
|
||||
GLOBAL_COMPILEFLAGS += -fno-common
|
||||
# Build with -ffreestanding since we are building an OS kernel and cannot
|
||||
# rely on all hosted environment functionality being present.
|
||||
GLOBAL_COMPILEFLAGS += -ffreestanding
|
||||
GLOBAL_CFLAGS := --std=gnu11 -Werror-implicit-function-declaration -Wstrict-prototypes -Wwrite-strings
|
||||
GLOBAL_CPPFLAGS := --std=c++14 -fno-exceptions -fno-rtti -fno-threadsafe-statics
|
||||
GLOBAL_ASMFLAGS := -DASSEMBLY
|
||||
|
||||
Reference in New Issue
Block a user