Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3358241ioo; Sun, 29 May 2022 23:24:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKZ8anWC2oMZXLpsYrB7yUaZvQ20pAtP0zRT3T2ME9GnqbWViBBx10IiUnHHc/JchzGpR/ X-Received: by 2002:a17:902:7c0c:b0:161:ef0f:9da8 with SMTP id x12-20020a1709027c0c00b00161ef0f9da8mr18286533pll.147.1653891843433; Sun, 29 May 2022 23:24:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653891843; cv=none; d=google.com; s=arc-20160816; b=RagvB18/0eOOVI1rG3FtM+EksRbiffM+axLFa05axijQKrWMK43QGMcivu6uqKbnvh jcVLztx3B023KXI1kVtBdkD0c7lFIbA7UMBk5KHrX+yHRxTaMgmnnHjE/F2GH8gPeYrJ CU9TcUFSpP9Yci3/XD0xdfPcl5n2pbmIa8UQph5XyjizWMI0HwuBzkItxu6LPGS98Lbb wuNViK9lPnkKUEeHzMXCVuUMbzO4PuqvJgucVISJMZuhby/VQ1zX3SiYBH97ZyxsvWyG fDhoLB5hSvLVVNDwUGGwl9xxtvh4E4qmmdnm3DL2BOh9ZplxHkgpS2UhuzKslhNvTku4 A8Wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=rv3/dnI2bKSpj6vkctXk9wNhFjnuHrpP9mrGCgW6B3U=; b=H1Eeqt+9Y/168ao5wMByYLVhhWyypt95AretDKpUEk04Yas8RqASnLtD+e/014yyyF YwnImIgKV5etqTMsIzycWOevWC8uQd0k/F8I5Pnn94nqwb3yMpNZjAoMN5FMauLEJCxH 8fhNgcSKhFRYuGMJm2xhFk1HeC8aYHcTvM6hosD5Erv2To+I3DQ/s1Y41hcDh03mzfC7 hOHph9x86lv6jpuC8f82XfBgcukoG6yhDYNYWAPbJ8HZ7cDxstWuRTuDn2p4yLdQk/HS 4cawOLUct5+wpvwszRkDKXjQUj0vJ8PRwUeFYNze9uGyL2ch3ZGC9/iXjdcYXV6wNU6P WvQA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=codethink.co.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i9-20020a17090332c900b00163e7655078si1780150plr.72.2022.05.29.23.23.52; Sun, 29 May 2022 23:24:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=codethink.co.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231183AbiE2PnF (ORCPT + 99 others); Sun, 29 May 2022 11:43:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230256AbiE2PnD (ORCPT ); Sun, 29 May 2022 11:43:03 -0400 X-Greylist: delayed 1406 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sun, 29 May 2022 08:43:01 PDT Received: from imap2.colo.codethink.co.uk (imap2.colo.codethink.co.uk [78.40.148.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C33EF67D2B for ; Sun, 29 May 2022 08:43:01 -0700 (PDT) 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 -- 2.35.1