[PATCH] riscv: Makefile: make it possible to use riscv64 compiler
Antony Pavlov
antonynpavlov at gmail.com
Wed Aug 5 03:32:58 EDT 2020
At the moment riscv64 toolchain can't be used to build
barebox for riscv32, e.g.
barebox$ make erizo_generic_defconfig
...
barebox$ make
...
riscv64-zephyr-elf-ld:
common/memory.o: ABI is incompatible with that of the selected
emulation:
target emulation `elf32-littleriscv' does not match `elf64-littleriscv'
The patch fixes the problem by explicit riscv32 target options selection.
Signed-off-by: Antony Pavlov <antonynpavlov at gmail.com>
Cc: Masahiro Yamada <masahiroy at kernel.org>
---
arch/riscv/Makefile | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index c71319507c..8cd5f51e30 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -3,7 +3,8 @@ KBUILD_DEFCONFIG := erizo_generic_defconfig
KBUILD_CPPFLAGS += -fno-strict-aliasing
ifeq ($(CONFIG_ARCH_RV32I),y)
- cflags-y += -march=rv32im
+ cflags-y += -march=rv32im -mabi=ilp32
+ riscv-ldflags-y += -melf32lriscv
endif
cflags-y += -fno-pic -pipe
@@ -14,6 +15,8 @@ LDFLAGS_barebox += -nostdlib
machine-$(CONFIG_MACH_ERIZO) := erizo
+LDFLAGS_barebox += $(riscv-ldflags-y)
+
TEXT_BASE = $(CONFIG_TEXT_BASE)
KBUILD_CPPFLAGS += -DTEXT_BASE=$(CONFIG_TEXT_BASE)
--
2.27.0
More information about the barebox
mailing list