From patchwork Thu Aug 30 07:54:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 963783 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="rPYn5hsZ"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 421FCk700sz9rvt for ; Thu, 30 Aug 2018 17:55:30 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id ACF08C21DCA; Thu, 30 Aug 2018 07:52:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 5F768C21C93; Thu, 30 Aug 2018 07:50:38 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 02156C21DF3; Thu, 30 Aug 2018 07:50:26 +0000 (UTC) Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by lists.denx.de (Postfix) with ESMTPS id 8B1AEC21E02 for ; Thu, 30 Aug 2018 07:50:22 +0000 (UTC) Received: by mail-pf1-f180.google.com with SMTP id i26-v6so3503240pfo.12 for ; Thu, 30 Aug 2018 00:50:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=OkB7DnjvaP2mGO4V39GxZ7Sf5AhsxCce3aPBy6vsoXE=; b=rPYn5hsZNZm1ABSlXeJJOkeZR1UNjV3GNySHHtRtHQvByWwhOWfgcc4dUQz2GO3LoQ 48NFxsX+SN6Oz8sUjTVoPogjS7i1jqA3YJWy7o83Iti0WpfVHk0RT2yuLeLL6t6Ldch1 bx4SS6WFmyprJ0PWpW9tKrWm4OYTWSQTVFRU6Mvdn2+4e5HuLLYj6hcBuvoqV5fRe3yB 2qLsXTIFtGvEA3DZ6icWn0lyX7a+Fiem21eB6t0sgv0yXGXqJflP06Vtj+YtfKMDeJpm wymDj2kQkeHBkiujtsjL+j98bwSSGEBplevohTE3zRS0eUGNR+o4aD8GezYOZBshP3kp xrZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=OkB7DnjvaP2mGO4V39GxZ7Sf5AhsxCce3aPBy6vsoXE=; b=M8JVOvdKUEC8wSxbPtTJ/1zh2zreJUt/4c83mwaNslUyrCOH98YQTi/KxSiriKLqha VgW30a84ypNQHCmi8/Ztr7hxCqLET283xNAeIXc1P6IJ9s8cNcl6lDlsOgce/REYrLIk U8mtPfeVe2jfrzphDHn7EY+PZVF4jtZv44BYPa2etDwIZejMw8JypPwJtcCrhvYgMj5G SN0GLkoI7xQJ+03kTbZDFZNuTZrjjz8WQwZrD3HtQe3CpGRRIcg0TVymJHmbeXro7l4b w2g8ZdQN/HVwrpJPO6LGygzdjLpihGzZhvcPtE1FiysbQJmuWxDp9YYTMVzoLNp4C2rj 3/AQ== X-Gm-Message-State: APzg51CHClOdbNdZcOVYkmXCj6I1DHg1dp30q7Hq/dwTJ+a+hcNAaSwx BJFqdPA9P9r5FtXcxGrIGQY= X-Google-Smtp-Source: ANB0VdbCG94Ok/n31pZoe6I1nWwbh/ZZyT56HDscnjjnFAmZuu+374PVR2xLiAld/bTIlplWepiM6w== X-Received: by 2002:a62:c406:: with SMTP id y6-v6mr9355425pff.161.1535615419378; Thu, 30 Aug 2018 00:50:19 -0700 (PDT) Received: from ala-d2121-lx1.wrs.com (unknown-156-139.windriver.com. [147.11.156.139]) by smtp.gmail.com with ESMTPSA id z17-v6sm12234266pfl.146.2018.08.30.00.50.17 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 30 Aug 2018 00:50:17 -0700 (PDT) From: Bin Meng To: Rick Chen , U-Boot Mailing List Date: Thu, 30 Aug 2018 00:54:30 -0700 Message-Id: <1535615675-24819-8-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1535615675-24819-1-git-send-email-bmeng.cn@gmail.com> References: <1535615675-24819-1-git-send-email-bmeng.cn@gmail.com> Subject: [U-Boot] [PATCH 07/12] riscv: Explicitly pass -march and -mabi to the compiler X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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 --- 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