build: Use -ffreestanding
authorKhem Raj <raj.khem@gmail.com>
Tue, 7 Jan 2020 02:41:06 +0000 (18:41 -0800)
committerAnup Patel <anup@brainfault.org>
Wed, 8 Jan 2020 03:40:24 +0000 (09:10 +0530)
this is a stand-alone/baremetal application, therefore demanding
-ffreestanding would help it compile with hosted toolchains e.g. ( linux
toolchains ), it also ensures that it won't be using platform
optimizations like inlining mem* str* functions which gcc might decide
especially with wrapper string functions in opensbi code

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Makefile

index 9aff070..aac422a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -159,7 +159,7 @@ GENFLAGS    +=      $(libsbiutils-genflags-y)
 GENFLAGS       +=      $(platform-genflags-y)
 GENFLAGS       +=      $(firmware-genflags-y)
 
-CFLAGS         =       -g -Wall -Werror -nostdlib -fno-strict-aliasing -O2
+CFLAGS         =       -g -Wall -Werror -ffreestanding -nostdlib -fno-strict-aliasing -O2
 CFLAGS         +=      -fno-omit-frame-pointer -fno-optimize-sibling-calls
 CFLAGS         +=      -mno-save-restore -mstrict-align
 CFLAGS         +=      -mabi=$(PLATFORM_RISCV_ABI) -march=$(PLATFORM_RISCV_ISA)