Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp479215imn; Wed, 27 Jul 2022 11:20:42 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uH9aXTgHzJRLiA9cX0cjiF9jSz1zxl/MBQGXVay/+V87PQ291fgoTkvYnapvHzl6RqYoUL X-Received: by 2002:a05:6402:f12:b0:43c:a70d:ee6 with SMTP id i18-20020a0564020f1200b0043ca70d0ee6mr5349048eda.316.1658946042376; Wed, 27 Jul 2022 11:20:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658946042; cv=none; d=google.com; s=arc-20160816; b=eMeFXaZQJyNeQvcU2Jipj7iGl5ekwpqEgUEdzC9nbJlqGuTF3suRsjLSPqoWQ5f+zO U3lLWnwpUYcycmqvdgfrh/5MX4dt1QFy8TZtPaG04KGDIzPtQmq/WUxaS5J+A7aKqMXo 44j+EePh3WQTUEhhPpl/qpjBGBPkdOUbZ76ENXYSmcJwx3yjhkQ8azVoK+dW/ys6XiMi 4DJwlgON2Mg9kFB5iVsCWAhdiaMpxMCl7kvtrl5oR+wBe6+vLc8X8pOhU+pvghkMWeTW iMRagFJK7gx45tzbVceJL0rSXXtcF9mm2IAWKqkvkC9IlWaCFJhylo+I6qtXeyV/gTKo jtMg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fRvxRfsyj/ZDOozQ0B86fKLW8mH8w5+L1agktrV1vg8=; b=JZoBz+zd7srH6oE1SIDLoZcYYvzEL+MUW+gQPj0MTcx2G/zXu601AkxmLPgCO6fgqL aeDiOcmqbPlx4kPMLRyXOtXphowfeNG+59g3UpbRVJnPkiGgiXCGYfOF/p8jdRThmqSU bHvMgasgQXG4OEtXK5tyzbQvFKsk1tEb2G3ycm+zfGUtuxAFNvpHZ1GpIEDZhXrFmSu8 FkBm5kcR23P/eHedfVNvlfndYk1ZGpPGUCDudQUEl0fJu4ZZVF2erLq/dAEmUqyJPKh6 zKsHl7UaUuvAwHB5D8Vr+ay6fc5EfwTaIRUnq66kSnwYHw3DUoV/pwND24WHBjJxD1ix N9OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2QEE64A9; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l10-20020a170906938a00b0072ee3fe1786si16852093ejx.729.2022.07.27.11.20.16; Wed, 27 Jul 2022 11:20:42 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2QEE64A9; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240131AbiG0Qs7 (ORCPT + 99 others); Wed, 27 Jul 2022 12:48:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240397AbiG0QsS (ORCPT ); Wed, 27 Jul 2022 12:48:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01E8A606AC; Wed, 27 Jul 2022 09:32:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8DA4A619FF; Wed, 27 Jul 2022 16:32:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E3C2C433C1; Wed, 27 Jul 2022 16:32:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658939542; bh=V57nnVM33eJ0YzjDgclMIxQPLhibnX+EzUHblugqnqI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2QEE64A9C1qQvPeqw4MsXdNFdSt16BUHuZbE1Pv2UcnFHZVOivK78ZWw+7x9TIdp7 kw3mzmzH5u8dLk8rvAX9Os+7tZ3L8/rlMm4GuxxEiS6yEC7MFreGGzjjfF3k+YZcsm EecJ0iVWdoRU71rb6o/e4GJ+Y9gJSpbkyLqP14NI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ben Dooks , Bin Meng , Palmer Dabbelt Subject: [PATCH 5.10 002/105] riscv: add as-options for modules with assembly compontents Date: Wed, 27 Jul 2022 18:09:48 +0200 Message-Id: <20220727161012.155044763@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727161012.056867467@linuxfoundation.org> References: <20220727161012.056867467@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 From: Ben Dooks commit c1f6eff304e4dfa4558b6a8c6b2d26a91db6c998 upstream. 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 Signed-off-by: Ben Dooks Reviewed-by: Bin Meng Link: https://lore.kernel.org/r/20220529152200.609809-1-ben.dooks@codethink.co.uk Fixes: ab1ef68e5401 ("RISC-V: Add sections of PLT and GOT for kernel module") Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman --- arch/riscv/Makefile | 1 + 1 file changed, 1 insertion(+) --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -73,6 +73,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