From patchwork Tue Dec 5 23:53:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 13480881 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2E237C4167B for ; Tue, 5 Dec 2023 23:54:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=d0V/4V29keqCjuHXqkyxOu1X70mnO4LZ2QJRa1JYSHM=; b=XR1DhDNwOWGk/N FW5lzaVV57S3KXueBM1yLaH/9XH7FKenW3BzwkqXWNpjTj3ZrFrHi9ESxpndAkUVXL79rg8pPzAmh sPcGZTx5+1fdupfcsUtY27R21GCDVGSeZW0xyLrT8RMLA5DKUTIClOnmhLOR/ZxVWEAgQeY++EZt5 +1nYJ4tHKj2SuqpH1dowxfKyy14kyHxm1LBBciMWah2VX3nsfYye/4n5t2kXlvZQ4fVV4xPng3dzy UcNq9vddb+5rKC2e1/c3++Pg+FIWmV/Tw2Pk/1anDtRmwu6cGjzFDeZcQ9bRUdXdyFa1rBRnNiBvd mLhKKZfW9bqUJTQSc9ew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rAfEp-008fR0-2w; Tue, 05 Dec 2023 23:54:03 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rAfEn-008fPu-1X for linux-riscv@lists.infradead.org; Tue, 05 Dec 2023 23:54:02 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id C59DC619B9; Tue, 5 Dec 2023 23:54:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9EF2C433CB; Tue, 5 Dec 2023 23:53:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701820440; bh=TkH9rrJU+gOQ6DZ9Djq7O32daD6bFD+fz9RSUAZrNm0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=JEZz+meehPGefxwsXQFCanCu2FwqpSVitp2XhhtQRG+aYTEa7aTpulJXmkePFgs1M IDyxDy/xA9P/xW9CNW71LolbjbVZ03hrHFus2lDLKj1Nf9uFRJOSeOWcvkfSAiRIwW TBYtdko3Anj47SUCkJucFLXXqejnGJvRVIItTosY7YYofPT1mckiDF6mznOJ5v9Lf/ 3TGugEotvQVvpNS0ktKbJIrECIjyUZFPeDDmmAZ5RblNAKeHkSSzuah4iIftMh1YvD nXo+GaNYWQJTFRyrHrFT7FmQPuPEHcnIMv004RXJcL5q1tmK5XOSjCNRlcXhI0Jj/3 EQy2Zwx1MgtNg== From: Nathan Chancellor Date: Tue, 05 Dec 2023 16:53:50 -0700 Subject: [PATCH v2 1/3] riscv: Hoist linker relaxation disabling logic into Kconfig MIME-Version: 1.0 Message-Id: <20231205-riscv-restrict-dwarf5-llvm-v2-1-aedf00a382ac@kernel.org> References: <20231205-riscv-restrict-dwarf5-llvm-v2-0-aedf00a382ac@kernel.org> In-Reply-To: <20231205-riscv-restrict-dwarf5-llvm-v2-0-aedf00a382ac@kernel.org> To: paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, conor@kernel.org Cc: maskray@google.com, ndesaulniers@google.com, linux-riscv@lists.infradead.org, llvm@lists.linux.dev, patches@lists.linux.dev, Nathan Chancellor X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1713; i=nathan@kernel.org; h=from:subject:message-id; bh=TkH9rrJU+gOQ6DZ9Djq7O32daD6bFD+fz9RSUAZrNm0=; b=owGbwMvMwCUmm602sfCA1DTG02pJDKn5O8RC9Iu1FtvquTzJc+OevOzWqcKG/5vfa+2zZT89W aK6zKyho5SFQYyLQVZMkaX6sepxQ8M5ZxlvnJoEM4eVCWQIAxenAExkZREjw+dZq96YVt3+kjHF M5btqvdEFSm1Fu0L/yZ4cOVwqBwyMmFk2FU175DqT0+vk/oHrwfKq0VKhXjcUXLeeXTa9JzGuWW SzAA= X-Developer-Key: i=nathan@kernel.org; a=openpgp; fpr=2437CB76E544CB6AB3D9DFD399739260CB6CB716 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231205_155401_559869_F9AF0D7D X-CRM114-Status: UNSURE ( 8.72 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Certain configurations may need to be disabled if linker relaxation is in use, such as DWARF5 with ld.lld < 18. Hoist the logic of whether or not linker relaxation is in use into Kconfig so decisions can be made at configuration time. Reviewed-by: Fangrui Song Signed-off-by: Nathan Chancellor --- arch/riscv/Kconfig | 5 +++++ arch/riscv/Makefile | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 95a2a06acc6a..72be1d8122a3 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -181,6 +181,11 @@ config HAVE_SHADOW_CALL_STACK # https://github.com/riscv-non-isa/riscv-elf-psabi-doc/commit/a484e843e6eeb51f0cb7b8819e50da6d2444d769 depends on $(ld-option,--no-relax-gp) +config RISCV_USE_LINKER_RELAXATION + def_bool y + # https://github.com/llvm/llvm-project/commit/6611d58f5bbcbec77262d392e2923e1d680f6985 + depends on !LD_IS_LLD || LLD_VERSION >= 150000 + config ARCH_MMAP_RND_BITS_MIN default 18 if 64BIT default 8 diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index a74be78678eb..e383aa9e2757 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -43,8 +43,7 @@ else KBUILD_LDFLAGS += -melf32lriscv endif -ifeq ($(CONFIG_LD_IS_LLD),y) -ifeq ($(call test-lt, $(CONFIG_LLD_VERSION), 150000),y) +ifndef CONFIG_RISCV_USE_LINKER_RELAXATION KBUILD_CFLAGS += -mno-relax KBUILD_AFLAGS += -mno-relax ifndef CONFIG_AS_IS_LLVM @@ -52,7 +51,6 @@ ifndef CONFIG_AS_IS_LLVM KBUILD_AFLAGS += -Wa,-mno-relax endif endif -endif ifeq ($(CONFIG_SHADOW_CALL_STACK),y) KBUILD_LDFLAGS += --no-relax-gp