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 B07C5C433F5 for ; Mon, 14 Feb 2022 13:58:09 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 00D8F83C21; Mon, 14 Feb 2022 14:57:42 +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="FNMepV95"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0221F83BF8; Mon, 14 Feb 2022 06:31:18 +0100 (CET) Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) (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 C28EE83BF2 for ; Mon, 14 Feb 2022 06:31:14 +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-pj1-x1030.google.com with SMTP id m7so13521173pjk.0 for ; Sun, 13 Feb 2022 21:31:14 -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=FNMepV95ahQC7x2seYwr43tFknvt6aFNg/pzkBSV+FDumE0mdfuBhtLBRwtY6qREwn H43SjI/kJb3yoHh+ysGiQVg7sZPU/c6GYuqa4bShs3RCUgxPajbvhvwzJ8B9cOHGvQUK 1ZjPGzyj6daKDvXvvmq4wR0OXA3cXa1TKK0w4eng8Hb3aLPHojRAA6CbskIJb7Xz8FCV F4AfAkSDRUMutzrUWk3Y9LpxiGO/ZmXSIWHii83KWGs9ZK/oL6A1GHop9+Cual9j4egJ 21MF1RIW4cAgOa7emXDW1C9kjBQa9CDNFbBh9FnasBiOTORyJCUazkRT9tq1DkyigPkF cRVg== 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=iuv/OeOKtx62TnA6wu8fL40xp6L27wn4CAhSfy0CDFxBZwOQuobePR0newM6ksyGGv jDY3yZHoxejC/H771ivv8jkaIdiwr+yVR/VXF3V9IvkA7XJ4GjXlvL1b3hf0igAVZgo4 62EuB/Qxem56GZY3pmqz+jwByxadEr7qYy2LLWKCOeGMM6NbLFNK4frvofmvimnqpqfm ya8h707fuQJ+OYdA34+tM6GAHhjJLc8hfbmk3kCtxW8XHmaitMdZRwJsyODXgs3IlAv6 2zaECYzOrQDdkt57zx73fd+lXsGWjLOrhGlt2KVsMLUE8Ix6HQ0g6VCm/tzFVtt1m9zZ W26Q== X-Gm-Message-State: AOAM533E3+1xswEmQjyNAO0J6B0qJ4tq4aBWpbmq6kK81Xr4tSQSt6jM gjGpBLYRtdLng52e3P/ruOebyrwfeK55Pg== X-Google-Smtp-Source: ABdhPJxo34eggZ8so2tJFeKQ6wX0wrJCzzWqFek9XNN8yoh6Ky+jqHJHJgiNxV7bSwcZlvjxjmBMOw== X-Received: by 2002:a17:90a:e553:: with SMTP id ei19mr12936311pjb.177.1644816672995; Sun, 13 Feb 2022 21:31:12 -0800 (PST) Received: from apollo.hsd1.ca.comcast.net ([2601:646:9200:a0f0::fb6e]) by smtp.gmail.com with ESMTPSA id n13sm12280488pjq.13.2022.02.13.21.31.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Feb 2022 21:31:12 -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:31:09 -0800 Message-Id: <20220214053109.41648-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