From patchwork Mon Jul 12 17:48:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Dooks X-Patchwork-Id: 12371807 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68AD8C07E99 for ; Mon, 12 Jul 2021 17:49:15 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 0F8FD6120A for ; Mon, 12 Jul 2021 17:49:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0F8FD6120A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=codethink.co.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org 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=Uvvr4vLXmUF2T4HRc6gUGRQ1T6v9mf2T1DwPgR37Ybk=; b=IpRHJ1zodxACTY hrYKHgBeWJaPmVK0MqJewiFeMbBQtbttC1ix0oaJqw/nTMgW6eUIYacR6tOpxsdsluDRqBqcjXcrD Eft/lo2LY6/5aS3sV/M19/ea+9i9SJMu2H44bjXp2epKGx+crHgoGRV+XR9GqXUDNjFvRNYAqlFfr 56pDQOFa+h5nV9svLjNBrYW+Ko3W43oLPCNL6oiHxumSyl2++eR+WwxEcwDGEyKS4ajZsDomriho1 lssGhtlbVf++HXGW8efR1w7ht+aJzxVxWR933h/CLLhsvix2mUp7j2g9ojsATy52R81pbkbWN0foH 4GXuvniEhO2Ci2nLKLxg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m303B-0087AB-LP; Mon, 12 Jul 2021 17:49:01 +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 1m3038-00879C-Ii for linux-riscv@lists.infradead.org; Mon, 12 Jul 2021 17:48:59 +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 1m3032-0000CA-0D; Mon, 12 Jul 2021 18:48:52 +0100 Received: from ben by rainbowdash with local (Exim 4.94.2) (envelope-from ) id 1m3030-009EvY-Q4; Mon, 12 Jul 2021 18:48:50 +0100 From: Ben Dooks To: linux-kernel@lists.codethink.co.uk, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Ben Dooks Subject: [PATCH] riscv: add correct as-options for assembly in modules Date: Mon, 12 Jul 2021 18:48:49 +0100 Message-Id: <20210712174849.2202287-1-ben.dooks@codethink.co.uk> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210712_104858_662988_B80812AC X-CRM114-Status: GOOD ( 10.54 ) 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 fix for gcc adds -mno-relax to the command line when building C files. However this was never applied to assembly flags, and gcc does no pass -mno-relax to gas when presented with a .S file. The fix (other than making gcc always pass -mno-relax to gas) is to add -Wa,-mno-relax to gcc to make sure the as is invoked with the right options. 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