aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-04-10 20:37:51 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2022-04-10 20:37:51 +0300
commit4c6be9cb63ff66ce49a6f733c1e00d1889f2c95f (patch)
tree898854069101e6616620e2bd732a48e5eca08fd2 /Makefile
parent8aa17b12f29536ea9c8b6ca22c7f153e8d90fa3b (diff)
downloadkmi-4c6be9cb63ff66ce49a6f733c1e00d1889f2c95f.tar.gz
kmi-4c6be9cb63ff66ce49a6f733c1e00d1889f2c95f.zip
add basic ubsan and fix issues reported by it
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile15
1 files changed, 9 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 0ef7a60..f250e4f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,11 @@
-DO != echo > deps.mk
+DO != echo -n > deps.mk
# this could be done better
DEBUGFLAGS != [ $(RELEASE) ] \
&& echo "-flto -O2 -DNDEBUG" \
|| echo "-O0 -ggdb3 -DDEBUG"
-CFLAGS = -ffreestanding -nostdlib -std=c17 -Wall -Wextra
+CFLAGS = -ffreestanding -nostdlib -std=c17 -Wall -Wextra -Wvla
DEPFLAGS = -MT $@ -MMD -MP -MF $@.d
LINTFLAGS = -fsyntax-only
PREPROCESS = -E
@@ -56,10 +56,13 @@ KERN_INFO = sed "s/<KERNEL_SIZE>/$$($(KERN_SIZE))/"
KERNEL_LINK := arch/$(ARCH)/conf/kernel-link
INIT_LINK := arch/$(ARCH)/conf/init-link
-KERNEL_OBJECTS != ./scripts/gen-deps --compile "$(KERNEL_SOURCES)"
-INIT_OBJECTS != ./scripts/gen-deps --compile "$(INIT_SOURCES)"
-KERNEL_LD != ./scripts/gen-deps --link "$(KERNEL_LINK).S"
-INIT_LD != ./scripts/gen-deps --link "$(INIT_LINK).S"
+KERN_FLAGS != [ $(UBSAN) ] && echo -fsanitize=undefined
+INIT_FLAGS :=
+
+KERNEL_OBJECTS != ./scripts/gen-deps --kernel --compile "$(KERNEL_SOURCES)"
+INIT_OBJECTS != ./scripts/gen-deps --init --compile "$(INIT_SOURCES)"
+KERNEL_LD != ./scripts/gen-deps --kernel --link "$(KERNEL_LINK).S"
+INIT_LD != ./scripts/gen-deps --init --link "$(INIT_LINK).S"
include deps.mk