From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7FB3DC433F5 for ; Mon, 14 Feb 2022 13:57:57 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id ECF4483C13; Mon, 14 Feb 2022 14:57:36 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="EihtSYVD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 99D8B83BF4; Mon, 14 Feb 2022 06:28:53 +0100 (CET) Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 796AA83BEF for ; Mon, 14 Feb 2022 06:28:50 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=raj.khem@gmail.com Received: by mail-pl1-x630.google.com with SMTP id 10so9679547plj.1 for ; Sun, 13 Feb 2022 21:28:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=c0TYhP70xjueB68LfrGAuszVvGk6sp4xPXQCBU0SYRU=; b=EihtSYVDO/XluVqKwIF1FeGdtm85kxPCIhkpuJy7GlS5Ajz5E153GKtE5gnLatjEGM oWEfpRH4H57s71BRtBWSiACugYRmNGbrbnGerjthVLZvhaoiNSa/FIRL5Zg5nU58KA58 veNj6pXd95SD6LnGKToMpGgGeArNZQqzZBgeg5ZDSL2A2ES0o9etB+pey9WxBxwnMxD0 KVnqj/857CAbteQTp/rSx0bMMTqBLI13JgTwyRVsUgdTaKz4CQhIc8oaEV/u7NK1IQgw ugDG3uBas3ABo2A86VVTB82VFSKLmHSxQKblKjPUTbTTo58UGHU7jYXEYX2G/kG1qR1g Towg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=c0TYhP70xjueB68LfrGAuszVvGk6sp4xPXQCBU0SYRU=; b=VhF0I5kN4HTwCsN1GauLfql4NmeOuXi2joyRUsPg2Lxue7BG1UcM6hmpb02HdNvcdh gffR8IC2FKngOmdspgorehy0wa0LhO0Y9aakcsKgZA6gfS+D3FdwuahYUD4N7QaESERt X2YaIa7N15/wawtlqTniPb7Aw6uVAJHZG9g6TpS+M2OX/Oa98jKfKiKiUb8nUcuN943E njmfrtJDFcW+uP4/e+9D7w9kOyIaZTBkL+WR9l2TW4LJfubvQjxlWc30xgLfIhfeO2f5 vZxYWzLz2F47zH/Qkqd4ByoNV0au8CMVwOtYxUxcq+KWu3D9RPTr0RY/FFAI/5xNtVDp XKRA== X-Gm-Message-State: AOAM530n5RUcVcvma7bfiHJ+HlzAbcq0S8ByS+rK+ujhOc1S6yscFI7f FO+jCwZ7avQ/hXj+h+Rgakb1tYVE1sv3zg== X-Google-Smtp-Source: ABdhPJxW667kH1/rMUSejQjlADhLWsLHJcT2VwxesXBH2vVnc8Qbd2onlY6ns4XVv6liaF8KotOuKg== X-Received: by 2002:a17:902:ac88:: with SMTP id h8mr12497059plr.128.1644816528281; Sun, 13 Feb 2022 21:28:48 -0800 (PST) Received: from apollo.hsd1.ca.comcast.net ([2601:646:9200:a0f0::fb6e]) by smtp.gmail.com with ESMTPSA id q21sm35906359pfu.104.2022.02.13.21.28.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Feb 2022 21:28:47 -0800 (PST) From: Khem Raj To: u-boot@lists.denx.de Cc: Khem Raj , Rick Chen , Leo Subject: [PATCH] riscv: fix build with binutils 2.38 Date: Sun, 13 Feb 2022 21:28:45 -0800 Message-Id: <20220214052845.40610-1-raj.khem@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Mon, 14 Feb 2022 14:57:23 +0100 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean >From version 2.38, binutils default to ISA spec version 20191213. This means that the csr read/write (csrr*/csrw*) instructions and fence.i instruction has separated from the `I` extension, become two standalone extensions: Zicsr and Zifencei. The fix is to specify those extensions explicitly in -march. However as older binutils version do not support this, we first need to detect that. Fixes arch/riscv/lib/cache.c: Assembler messages: arch/riscv/lib/cache.c:12: Error: unrecognized opcode `fence.i' Signed-off-by: Khem Raj Cc: Rick Chen Cc: Leo --- arch/riscv/Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index 0b80eb8d86..e6fe1fc02b 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -24,7 +24,12 @@ ifeq ($(CONFIG_CMODEL_MEDANY),y) CMODEL = medany endif -ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_C) -mabi=$(ABI) \ +# Newer binutils versions default to ISA spec version 20191213 which moves some +# instructions from the I extension to the Zicsr and Zifencei extensions. +toolchain-need-zicsr-zifencei := $(call cc-option-yn, -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_C)_zicsr_zifencei) +zicsr_zifencei-$(toolchain-need-zicsr-zifencei) := _zicsr_zifencei + +ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_C)$(zicsr_zifencei-y) -mabi=$(ABI) \ -mcmodel=$(CMODEL) PLATFORM_CPPFLAGS += $(ARCH_FLAGS) -- 2.35.1