From 90340c87e5eed344f6f947661ff170c8369635db Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Fri, 28 Jul 2017 23:14:28 +0200 Subject: [PATCH 1/2] arch/sh: allow building in big-endian mode The SuperH architecture allows to be run in either little or big endian mode. Some SuperH SoCs get the little vs. big endian decision through mode pins sampled at reset, so if big endian has been choosen by HW designers, it cannot be easily changed. Therefore, it makes sense to allow building U-Boot for SuperH in big endian mode. To allow this, the only change needed is to adjust the OUTPUT_FORMAT() in the linker script. Signed-off-by: Thomas Petazzoni --- arch/sh/cpu/u-boot.lds | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/sh/cpu/u-boot.lds b/arch/sh/cpu/u-boot.lds index 7fc91bc4aa..bd4fde9f2c 100644 --- a/arch/sh/cpu/u-boot.lds +++ b/arch/sh/cpu/u-boot.lds @@ -9,7 +9,12 @@ #include "config.h" +#ifdef CONFIG_SYS_BIG_ENDIAN +OUTPUT_FORMAT("elf32-shbig-linux", "elf32-shbig-linux", "elf32-sh-linux") +#else OUTPUT_FORMAT("elf32-sh-linux", "elf32-sh-linux", "elf32-sh-linux") +#endif + OUTPUT_ARCH(sh) MEMORY From f40ad66fa066c7eacbcbb11c2e2f251bb82426e0 Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Fri, 28 Jul 2017 23:46:36 +0200 Subject: [PATCH 2/2] arch/sh: don't bring common/env_embedded.o into the link The linker script for SuperH brings the .ppcenv and .ppcenvr section of common/env_embedded.o into the .text section. However, the .ppcenv section is only ever filled in by env_embedded.o when CONFIG_SYS_USE_PPCENV is defined, but no platforms in mainline U-Boot use this. In addition, common/env_embedded.o is not always built (when you use CONFIG_ENV_IS_NOWHERE for example), which causes the following build failure: Fixes: LD u-boot /home/thomas/sh4aeb-linux-musl/bin/sh4aeb-linux-ld.bfd: cannot find common/env_embedded.o We fix this by no longer adding the .ppcenv and .ppcenvr sections from common/env_embedded.o into the .text section. Signed-off-by: Thomas Petazzoni Signed-off-by: Nobuhiro Iwamatsu --- arch/sh/cpu/u-boot.lds | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arch/sh/cpu/u-boot.lds b/arch/sh/cpu/u-boot.lds index bd4fde9f2c..2f2bdb5b83 100644 --- a/arch/sh/cpu/u-boot.lds +++ b/arch/sh/cpu/u-boot.lds @@ -38,10 +38,6 @@ SECTIONS KEEP(CONFIG_BOARDDIR/lowlevel_init.o (.text .spiboot1.text)) KEEP(*(.spiboot2.text)) . = ALIGN(8192); - env/embedded.o (.ppcenv) - . = ALIGN(8192); - env/embedded.o (.ppcenvr) - . = ALIGN(8192); *(.text) . = ALIGN(4); } >ram =0xFF