aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-09-11 01:07:52 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2022-09-11 01:09:02 +0300
commit7101970b3cdb2a0190e69a98352275907ab935a4 (patch)
tree3081ce0e6fb986b340db7e1a18f0e6074cdd746e /Makefile
parentd9b427cab53849c503306af1ebebed30c35fb81f (diff)
downloadkmi-7101970b3cdb2a0190e69a98352275907ab935a4.tar.gz
kmi-7101970b3cdb2a0190e69a98352275907ab935a4.zip
allow building with riscv64-linux-gnu
+ May warn about PHDR not being in LOAD, there is a flag to silence it (--no-warn-rwx-segment) but it doesn't seem to exist in riscv64-unknown-elf for some reason.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile5
1 files changed, 3 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index a647267..3c29758 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ DEBUGFLAGS != [ $(RELEASE) ] \
&& echo "-flto -O2 -g -DNDEBUG" \
|| echo "-O0 -g -DDEBUG"
-CFLAGS = -ffreestanding -nostdlib -std=c17 -Wall -Wextra -Wvla -D$(ARCH)
+CFLAGS = -ffreestanding -nostdlib -static -fno-pie -std=c17 -Wall -Wextra -Wvla -D$(ARCH)
DEPFLAGS = -MT $@ -MMD -MP -MF $@.d
LINTFLAGS = -fsyntax-only
PREPROCESS = -E
@@ -47,7 +47,8 @@ LINK_FLAGS := $(LDFLAGS) $(ARCH_LDFLAGS)
INCLUDE_FLAGS := -I include -include config.h -include arch/$(ARCH)/config.h
# This makes sure .bss is loaded into the binary
-OBJCOPY_FLAGS ?= -Obinary --set-section-flags .bss=alloc,load,contents
+OBJCOPY_FLAGS ?= -Obinary -R .garbage \
+ --set-section-flags .bss=alloc,load,contents
COMPILE = $(COMPILER) $(DEBUGFLAGS)\
$(COMPILE_FLAGS) $(DEPFLAGS) $(INCLUDE_FLAGS)