All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bin Meng <bmeng.cn@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 07/15] riscv: Explicitly pass -march and -mabi to the compiler
Date: Mon, 10 Sep 2018 21:37:32 -0700	[thread overview]
Message-ID: <1536640660-3376-8-git-send-email-bmeng.cn@gmail.com> (raw)
In-Reply-To: <1536640660-3376-1-git-send-email-bmeng.cn@gmail.com>

At present the compiler flag against which architecture and abi
variant the riscv image is built for is not explicitly indicated
which means the default compiler configuration is used. But this
does not work if we want to build a different target (eg: 32-bit
riscv images using a toolchain configured for 64-bit riscv).

Fix this by explicitly passing -march and -mabi to the compiler.
Since generically we don't use floating point in U-Boot, specify
the RV[32|64]IMA ISA and software floating ABI.

This also fix some alignment coding style issues.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

Changes in v2: None

 arch/riscv/config.mk | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/riscv/config.mk b/arch/riscv/config.mk
index 219e666..1484887 100644
--- a/arch/riscv/config.mk
+++ b/arch/riscv/config.mk
@@ -18,12 +18,16 @@ endif
 64bit-emul		:= elf64lriscv
 
 ifdef CONFIG_32BIT
+PLATFORM_CPPFLAGS	+= -march=rv32ima -mabi=ilp32
 PLATFORM_LDFLAGS	+= -m $(32bit-emul)
+CFLAGS_EFI		+= -march=rv32ima -mabi=ilp32
 EFI_LDS			:= elf_riscv32_efi.lds
 endif
 
 ifdef CONFIG_64BIT
+PLATFORM_CPPFLAGS	+= -march=rv64ima -mabi=lp64
 PLATFORM_LDFLAGS	+= -m $(64bit-emul)
+CFLAGS_EFI		+= -march=rv64ima -mabi=lp64
 EFI_LDS			:= elf_riscv64_efi.lds
 endif
 
@@ -31,8 +35,9 @@ CONFIG_STANDALONE_LOAD_ADDR = 0x00000000 \
 			      -T $(srctree)/examples/standalone/riscv.lds
 
 PLATFORM_CPPFLAGS	+= -ffixed-gp -fpic
-PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -gdwarf-2 -ffunction-sections
-LDFLAGS_u-boot += --gc-sections -static -pie
+PLATFORM_RELFLAGS	+= -fno-strict-aliasing -fno-common -gdwarf-2 \
+			   -ffunction-sections
+LDFLAGS_u-boot		+= --gc-sections -static -pie
 
 EFI_CRT0		:= crt0_riscv_efi.o
 EFI_RELOC		:= reloc_riscv_efi.o
-- 
2.7.4

  parent reply	other threads:[~2018-09-11  4:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-11  4:37 [U-Boot] [PATCH v2 00/15] riscv: Add QEMU virt board support Bin Meng
2018-09-11  4:37 ` [U-Boot] [PATCH v2 01/15] riscv: kconfig: Normalize architecture name spelling Bin Meng
2018-09-11  4:37 ` [U-Boot] [PATCH v2 02/15] riscv: Remove setup.h Bin Meng
2018-09-11  4:37 ` [U-Boot] [PATCH v2 03/15] riscv: bootm: Correct the 1st kernel argument to hart id Bin Meng
2018-09-11  4:37 ` [U-Boot] [PATCH v2 04/15] riscv: Remove mach type Bin Meng
2018-09-11  4:37 ` [U-Boot] [PATCH v2 05/15] riscv: Move the linker script to the CPU root directory Bin Meng
2018-09-11  4:37 ` [U-Boot] [PATCH v2 06/15] riscv: Fix coding style issues in the linker script Bin Meng
2018-09-11  4:37 ` Bin Meng [this message]
2018-09-11  4:37 ` [U-Boot] [PATCH v2 08/15] riscv: Add a helper routine to print CPU information Bin Meng
2018-09-11  4:37 ` [U-Boot] [PATCH v2 09/15] riscv: Remove CSR read/write defines in encoding.h Bin Meng
2018-09-11  4:37 ` [U-Boot] [PATCH v2 10/15] riscv: bootm: Pass mhartid CSR value to kernel Bin Meng
2018-09-11  4:37 ` [U-Boot] [PATCH v2 11/15] riscv: Make start.S available for all targets Bin Meng
2018-09-11  4:37 ` [U-Boot] [PATCH v2 12/15] riscv: ae350: Clean up mixed tabs and spaces in the dts Bin Meng
2018-09-11  4:37 ` [U-Boot] [PATCH v2 13/15] riscv: kconfig: Select DM and OF_CONTROL Bin Meng
2018-09-11  4:37 ` [U-Boot] [PATCH v2 14/15] riscv: Add QEMU virt board support Bin Meng
2018-09-11  4:37 ` [U-Boot] [PATCH v2 15/15] riscv: Move do_reset() to a common place Bin Meng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1536640660-3376-8-git-send-email-bmeng.cn@gmail.com \
    --to=bmeng.cn@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.