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 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 9226AC433EF for ; Sun, 29 May 2022 15:22:18 +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=0airgKURBSE32xrHzUptMbmD33dN8hN9lVI4X5iJMuY=; b=PuasidRtBtP6qk jKpj730GDZ+qlra1GsFWFWyZ60NX7Q+SZci0S2iohhv4O8MU83KMHZntgvYPHEsItnnalKO7EZwn2 lnz+aMw4D2omCyDHySgw6HSyNlif6jQa5kW8Fdm5/+7hRR+9ZpF5mSxfsDKxvIIZqkCNx/n3OfxrR NCBX0GUEpJ7ySeGRUOv9Kw6FH1BHwNfiuFRAvLkB8co9tyupjubgyqQ/mSxNUeEaJs5meaivGShK3 ROUGRos0YpH8EY8+R23Rht9RM/vVVsUsbBwLkmyOCNohap+Op+/UHgxsU4uU9RjbPSqqychjJ8Srb exDZKrbpuJ94DAljFeyg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nvKk6-0049ga-Kd; Sun, 29 May 2022 15:22:10 +0000 Received: from imap3.hz.codethink.co.uk ([176.9.8.87]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nvKk4-0049ec-9z for linux-riscv@lists.infradead.org; Sun, 29 May 2022 15:22:09 +0000 Received: from cpc152649-stkp13-2-0-cust121.10-2.cable.virginm.net ([86.15.83.122] helo=rainbowdash) by imap3.hz.codethink.co.uk with esmtpsa (Exim 4.92 #3 (Debian)) id 1nvKjx-0004xX-Um; Sun, 29 May 2022 16:22:01 +0100 Received: from ben by rainbowdash with local (Exim 4.95) (envelope-from ) id 1nvKjw-002Ydq-Qz; Sun, 29 May 2022 16:22:00 +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] [PATCH v2] riscv: add as-options for modules with assembly compontents Date: Sun, 29 May 2022 16:22:00 +0100 Message-Id: <20220529152200.609809-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_082208_397633_A2F774C5 X-CRM114-Status: GOOD ( 11.48 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org When trying to load modules built for RISC-V which include assembly files the kernel loader errors with "unexpected relocation type 'R_RISCV_ALIGN'" due to R_RISCV_ALIGN relocations being generated by the assembler. The R_RISCV_ALIGN relocations can be removed at the expense of code space by adding -mno-relax to gcc and as. In commit 7a8e7da42250138 ("RISC-V: Fixes to module loading") -mno-relax is added to the build variable KBUILD_CFLAGS_MODULE. See [1] for more info. The issue is that when kbuild builds a .S file, it invokes gcc with the -mno-relax flag, but this is not being passed through to the assembler. Adding -Wa,-mno-relax to KBUILD_AFLAGS_MODULE ensures that the assembler is invoked correctly. This may have now been fixed in gcc[2] and this addition should not stop newer gcc and as from working. [1] https://github.com/riscv/riscv-elf-psabi-doc/issues/183 [2] https://github.com/gcc-mirror/gcc/commit/3b0a7d624e64eeb81e4d5e8c62c46d86ef521857 Notes: Signed-off-by: Ben Dooks Reviewed-by: Bin Meng --- arch/riscv/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index 1f5c03082976..fca40511a8c6 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -60,6 +60,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 -- 2.35.1 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EA20C433F5 for ; Sun, 29 May 2022 15:45:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230521AbiE2PpF (ORCPT ); Sun, 29 May 2022 11:45:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231269AbiE2PpB (ORCPT ); Sun, 29 May 2022 11:45:01 -0400 X-Greylist: delayed 1369 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sun, 29 May 2022 08:45:00 PDT Received: from imap3.hz.codethink.co.uk (imap3.hz.codethink.co.uk [176.9.8.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B298069290 for ; Sun, 29 May 2022 08:45:00 -0700 (PDT) Received: from cpc152649-stkp13-2-0-cust121.10-2.cable.virginm.net ([86.15.83.122] helo=rainbowdash) by imap3.hz.codethink.co.uk with esmtpsa (Exim 4.92 #3 (Debian)) id 1nvKjx-0004xX-Um; Sun, 29 May 2022 16:22:01 +0100 Received: from ben by rainbowdash with local (Exim 4.95) (envelope-from ) id 1nvKjw-002Ydq-Qz; Sun, 29 May 2022 16:22:00 +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] [PATCH v2] riscv: add as-options for modules with assembly compontents Date: Sun, 29 May 2022 16:22:00 +0100 Message-Id: <20220529152200.609809-1-ben.dooks@codethink.co.uk> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When trying to load modules built for RISC-V which include assembly files the kernel loader errors with "unexpected relocation type 'R_RISCV_ALIGN'" due to R_RISCV_ALIGN relocations being generated by the assembler. The R_RISCV_ALIGN relocations can be removed at the expense of code space by adding -mno-relax to gcc and as. In commit 7a8e7da42250138 ("RISC-V: Fixes to module loading") -mno-relax is added to the build variable KBUILD_CFLAGS_MODULE. See [1] for more info. The issue is that when kbuild builds a .S file, it invokes gcc with the -mno-relax flag, but this is not being passed through to the assembler. Adding -Wa,-mno-relax to KBUILD_AFLAGS_MODULE ensures that the assembler is invoked correctly. This may have now been fixed in gcc[2] and this addition should not stop newer gcc and as from working. [1] https://github.com/riscv/riscv-elf-psabi-doc/issues/183 [2] https://github.com/gcc-mirror/gcc/commit/3b0a7d624e64eeb81e4d5e8c62c46d86ef521857 Notes: Signed-off-by: Ben Dooks Reviewed-by: Bin Meng --- arch/riscv/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index 1f5c03082976..fca40511a8c6 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -60,6 +60,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 -- 2.35.1