From patchwork Sun May 29 15:19:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Dooks X-Patchwork-Id: 12864177 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 D8CCDC433FE for ; Sun, 29 May 2022 15:19:47 +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:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=9eDYaj8LQVOJfk4064ltRrQsrdIx76Szz3JRu/ZdrNk=; b=ikK6nhvmJ4owuQ S6mPmh6vIRLykYhus8LEMN1iZdS7Bzdn2vE3ooAS+0M/FvQdcsx8w0RleE9cY7iYgYnxuAmRV6DGk 9oBip/ILrtCmcNztDIu1Km7XbS3K7MJvRR6GVjn0YCEvu6NMw+xGrPgoJAu01i5+0z+XHL3PA8R30 IvPALOBudxlpf9ZzEcDSVJkDbwzs/QvzeSm64FePUcrlwdbD0fH9bdnv3KeGb68yFyKGy1lRAGbjV 9dzwh5oE7uW+gvg/uMreXap4pWRwg7NoV/KKuy0jM+dWShp5QQzG4sBY55xQCQE70r3F0eSvAA9FN OJKMRaUfr1GUCiIW3gCQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nvKhb-0049HS-RT; Sun, 29 May 2022 15:19:35 +0000 Received: from imap2.colo.codethink.co.uk ([78.40.148.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nvKhY-0049Fk-PH for linux-riscv@lists.infradead.org; Sun, 29 May 2022 15:19:34 +0000 Received: from cpc152649-stkp13-2-0-cust121.10-2.cable.virginm.net ([86.15.83.122] helo=rainbowdash) by imap2.colo.codethink.co.uk with esmtpsa (Exim 4.92 #3 (Debian)) id 1nvKhO-0004tV-94; Sun, 29 May 2022 16:19:22 +0100 Received: from ben by rainbowdash with local (Exim 4.95) (envelope-from ) id 1nvKhN-002Yb9-Bk; Sun, 29 May 2022 16:19:21 +0100 From: Ben Dooks To: linux-kernel@lists.codethink.co.uk, linux-riscv@lists.infradead.org Cc: palmer@dabbelt.com, aou@eecs.berkeley.edu, linux-kernel@vger.kernel.org, Ben Dooks , Bin Meng Subject: [PATCH] riscv: add correct as-options for assembly in modules Date: Sun, 29 May 2022 16:19:20 +0100 Message-Id: <20220529151920.609642-1-ben.dooks@codethink.co.uk> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220529_081932_878902_7563D743 X-CRM114-Status: UNSURE ( 9.80 ) 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 When trying to load modules built for riscv which include assembly the kernel loader errors with "unexpected relocation type 'R_RISCV_ALIGN'" due to R_RISCV_ALIGN relocations being generated by the assembler. In commit 7a8e7da42250138 ("RISC-V: Fixes to module loading") the CFLAGS have -mno-relax added. This however does not get applied to KBUILD_AFLAGS_MODULE so when a module builds a .S file, the -mno-relax is not passed and the above error is seen. Fix it by adding the flags '-Wa,-mno-relax' to KBUILD_AFLAGS_MODULE. This may have been fixed in gcc, in: https://github.com/gcc-mirror/gcc/commit/3b0a7d624e64eeb81e4d5e8c62c46d86ef521857 Signed-off-by: Ben Dooks Reviewed-by: Bin Meng --- Changes since v1: - added Bin Meng's review of the original patch --- arch/riscv/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index 0289a97325d1..cf2ea9a1ac20 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -58,6 +58,7 @@ ifeq ($(CONFIG_PERF_EVENTS),y) endif KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-relax) +KBUILD_AFLAGS_MODULE += $(call as-option,-Wa$(comma)-mno-relax) # GCC versions that support the "-mstrict-align" option default to allowing # unaligned accesses. While unaligned accesses are explicitly allowed in the