[RFC v3 2/2] Add initial RISC-V architecture support

Antony Pavlov antonynpavlov at gmail.com
Tue Dec 13 12:48:49 PST 2016


On Tue, 13 Dec 2016 20:02:41 +0300
Andrey Korolyov <andrey at xdel.ru> wrote:

> > +CONFIG_TEXT_BASE=0x80000000
> > +CONFIG_MEMORY_LAYOUT_FIXED=y
> > +CONFIG_STACK_BASE=0x807f0000
> > +CONFIG_STACK_SIZE=0x10000
> > +CONFIG_MALLOC_BASE=0x80800000
> 
> Due to changed offsets in e300/u500 configurations (as compared to v2-
> qemu config) linkage fails with binutils-2.25.1 and gcc-5.3.0:
> 
> arch/riscv/boot/built-in.o: In function `main_entry':
> /build/barebox/arch/riscv/boot/main_entry.c:34:(.text+0x0): relocation
> truncated to fit: R_RISCV_HI20 against symbol `__bss_start' defined in
> .bss section in barebox
> Makefile:756: recipe for target 'barebox' failed

You can fix the problem by explicitly selecting the 'Medium/Anywhere' gcc code model,
e.g.

--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -2,7 +2,7 @@ CPPFLAGS += -fno-strict-aliasing
 
 cflags-y += -fno-pic -pipe
 cflags-y += -Wall -Wmissing-prototypes -Wstrict-prototypes \
-	-Wno-uninitialized -Wno-format -Wno-main
+	-Wno-uninitialized -Wno-format -Wno-main -mcmodel=medany
 
 LDFLAGS += $(ldflags-y)
 LDFLAGS_barebox += -nostdlib


-- 
Best regards,
  Antony Pavlov



More information about the barebox mailing list