Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp483968imn; Wed, 27 Jul 2022 11:28:51 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t4tecU4+QHoIuVnEcXjNiaFPkhU4myxDWBb40sO22SQ/fBrBW5vZe7Nr2xP3Xo04CdvXVe X-Received: by 2002:a17:907:9483:b0:72f:6e4f:f54c with SMTP id dm3-20020a170907948300b0072f6e4ff54cmr18770500ejc.471.1658946531458; Wed, 27 Jul 2022 11:28:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658946531; cv=none; d=google.com; s=arc-20160816; b=FkpWn94CgvkbCZ85uxGveiV8eTrZtxtHsPbbFFmwXEO8E6slTjxWTEoSjTZneaq+du SllYK5ZoBvNF/OQ6dlN0+T4CE9PBCTWX5nEyF6dIKw/8qn1vaVbZduf+GpyUHKCJ1Wun YNvMahIesNTBeB15yVmF5Zmu0Bg/KOYXg2B+Foc7ToYURfBLyNNobb01XMdY9/b+n/pQ iUT1CQvxpkWzRG89K7nVsOWEnllwYcUGEoEOYefsg2evFVRydXh3NFz7LQEkftj9np/T XTfgeQZ3mUa/ZuEswDJDmPBlkaXo8iwKZbZdLbpRN9wNM7BVUnCP+qwSfBgu+OE1eJ55 AqkQ== 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=ikMcubRCeadx7trYQxn7ggiHUOjlcudr5BQKuINiJRw=; b=HwIWsZ20B//VAlCsU9R0Ce0zsBpJf+nUz6cTNYqXgzrTCU5pik3i2YvhJbeOUit/iZ 9LV9WxGgAa8kgb39w6AhfRWwSFtYndVKMppzHL5XdkbG8riUmmB+SB9EHxhDIgbBuy/9 LSy0yV+UoVZzFBhO8IFvxrLWuPMim2qbz60DxW2vR+/ZenSYxA/62YNFT0+d2GKZqo4/ 5t4ewbTXV/j/9+Zza8PMU12kIRUwEeq+ztgRjhG/MdEeKhmIVztUAYT36G/INEKThWtL vZVTrgOQ1wPnYS9XtLmeaP9Q1ePQ4MTzAkQOvXhhfqfiNY89PoDIvI4xaSoPinznIOHc DXoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mGk1FCYp; 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 n8-20020a05640205c800b0043aa5c2ce35si22934315edx.264.2022.07.27.11.28.27; Wed, 27 Jul 2022 11:28:51 -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=mGk1FCYp; 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 S238661AbiG0QhY (ORCPT + 99 others); Wed, 27 Jul 2022 12:37:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238514AbiG0Qfi (ORCPT ); Wed, 27 Jul 2022 12:35:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42B1A4F67C; Wed, 27 Jul 2022 09:27:55 -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 3029661A1E; Wed, 27 Jul 2022 16:27:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F991C433C1; Wed, 27 Jul 2022 16:27:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658939271; bh=ioKXvpnEvVWDvJvsf5Jhoz5YlsC326vJT2NP/rjUhN4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mGk1FCYp8lxGz1g7F80xZRzyBcdu/6Gr8Vrh9PGGpAxp8+svhZn4aP3YTMNwq06vN Z6o+z4wdf3owPZ/2tP+iClYm/DueoMqdDfUnOsp/4tBP2g/TsFGzD/bTtb1KzTe4ZW WHedHKVBlbBIBrO3hpn4P1p6zba74FwuFD8yqLag= 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.4 02/87] riscv: add as-options for modules with assembly compontents Date: Wed, 27 Jul 2022 18:09:55 +0200 Message-Id: <20220727161009.095522278@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727161008.993711844@linuxfoundation.org> References: <20220727161008.993711844@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 @@ -74,6 +74,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