summaryrefslogtreecommitdiffstats
path: root/meta/recipes-bsp/opensbi/files/0001-build-Use-ffreestanding.patch
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2020-01-08 08:42:54 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-01-10 21:18:22 +0000
commit019f8d3c0023b3d74790896148c174060cb2a604 (patch)
tree4f4cab89e7fcb1b2475100710ffab85dc7392f85 /meta/recipes-bsp/opensbi/files/0001-build-Use-ffreestanding.patch
parent1eecc83125ae1dee10537a13620c8355edf1d001 (diff)
downloadpoky-019f8d3c0023b3d74790896148c174060cb2a604.tar.gz
opensbi: Use -ffreestanding compiler options
This usually helps compiler to not use built-in optimizations for string functions and mem* functions unnecessarily, since OE's compiler is hosted for linux cross compile, this also means we instruct it rightly for building a baremetal application Refresh the patches to apply without fuzz Fixes linking errors e.g. platform/qemu/virt/lib/libplatsbi.a(sbi_string.o): in function `sbi_memset': | /mnt/b/yoe/build/tmp/work/riscv64-yoe-linux/opensbi/0.5-r0/git/lib/sbi/sbi_string.c:102: undefined reference to `memset' | collect2: error: ld returned 1 exit status (From OE-Core rev: f599b6c77f3585c8917f4d685689da4cc8a8bf04) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-bsp/opensbi/files/0001-build-Use-ffreestanding.patch')
-rw-r--r--meta/recipes-bsp/opensbi/files/0001-build-Use-ffreestanding.patch28
1 files changed, 28 insertions, 0 deletions
diff --git a/meta/recipes-bsp/opensbi/files/0001-build-Use-ffreestanding.patch b/meta/recipes-bsp/opensbi/files/0001-build-Use-ffreestanding.patch
new file mode 100644
index 0000000000..4899fad6aa
--- /dev/null
+++ b/meta/recipes-bsp/opensbi/files/0001-build-Use-ffreestanding.patch
@@ -0,0 +1,28 @@
1From efa39afecedf75a1f3154c39507bdde2810bc140 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 6 Jan 2020 18:21:02 -0800
4Subject: [PATCH] build: Use -ffreestanding
5
6this is a stand-alone/baremetal application, therefore demanding
7-ffreestanding would help it compile with hosted toolchains e.g. ( linux
8toolchains ), it also ensures that it won't be using platform
9optimizations like inlining mem* str* functions which gcc might decide
10especially with wrapper string functions in opensbi code
11
12Upstream-Status: Accepted [https://github.com/riscv/opensbi/commit/049ad0b3877352527ab470eba33bc767e9b54961]
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14---
15 Makefile | 2 +-
16 1 file changed, 1 insertion(+), 1 deletion(-)
17
18--- a/Makefile
19+++ b/Makefile
20@@ -159,7 +159,7 @@ GENFLAGS += $(libsbiutils-genflags-y)
21 GENFLAGS += $(platform-genflags-y)
22 GENFLAGS += $(firmware-genflags-y)
23
24-CFLAGS = -g -Wall -Werror -nostdlib -fno-strict-aliasing -O2
25+CFLAGS = -g -Wall -Werror -ffreestanding -nostdlib -fno-strict-aliasing -O2
26 CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
27 CFLAGS += -mno-save-restore -mstrict-align
28 CFLAGS += -mcmodel=$(PLATFORM_RISCV_CODE_MODEL)