Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp485259imn; Wed, 27 Jul 2022 11:31:00 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sW+HO620RjJBpHUE3hMOuN2RkBQi6w03ZHkD7ZlHkAbsTUfXVk6zDVWzNIF3r80j/hS+bI X-Received: by 2002:aa7:c843:0:b0:43c:d6f0:7d6e with SMTP id g3-20020aa7c843000000b0043cd6f07d6emr851966edt.337.1658946659884; Wed, 27 Jul 2022 11:30:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658946659; cv=none; d=google.com; s=arc-20160816; b=joW0p9FeoD5zwcGYhKvuFRIZqH6Zzczdeg/ZfAV0b/QeFy9UqVFAdEC3bMNmwpBnzd 6z1idP6W8z7Tg5kf31OEUajdXXH7d7SBUOaaZ1YhbBMwzyYVVq3z1jzQ1Iyzgm/0TCPO SzZekKTHuulu7cKRqzVDwOX2/69rvyhz8W/vJBNKEuE7K0QhgcskgS2C/YrqQagvNBmI KRvZnRdQ9J4c91sqrdv4qtVnarLR0HkQVIvtqAV1v4u5OQkF3dVlpTEeAdSHmp6T7hIS btt9TKbIOUtekirOuAhjEOYsyR2HW1gfpjGtQvNX1XsNprytsQjeQV3CJ2EqvVDbF1U8 WuMg== 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=CMQ2x7JLoRBE4u3kblN9pxxOAR5wzIm46nMWw/zgFys=; b=IrOMHek5ZBqfumFEaSAxCAd1A6TgVTOGUXnEx8NT68OncCUHYKxNrBWCi61UZe2OiO vOAGFLm5X+c0xzWFdV+gk1TGtZD58lA1HkKm6oz7J6uBKrhHZ08w/x/aNmr17Y4zsXx7 jgTpOLVqffo7ngDdzKRE5sy/pmvUhgJIhEiHqwLT35YqcE3IO5825+AP/IwdA/D/a+MU 7M/Mmvq2K/CTRhAegV2tff/m7/D6I6bBxuoYa/m5dMp5V4BkvhfICMoc9iyq31zFuN5g +CfQHUE5mjtRb0oUZBgNTqeEhZlBHYn4vOOIIb8MuZGvKocXztblSCmlxnJULhIIVL0B 152g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OcPjFfyW; 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 x14-20020aa7d38e000000b0043c8dcf2de2si3469641edq.299.2022.07.27.11.30.34; Wed, 27 Jul 2022 11:30:59 -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=OcPjFfyW; 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 S235767AbiG0Qb5 (ORCPT + 99 others); Wed, 27 Jul 2022 12:31:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237332AbiG0QbL (ORCPT ); Wed, 27 Jul 2022 12:31:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B4E152DCA; Wed, 27 Jul 2022 09:25:30 -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 4CDBD619CB; Wed, 27 Jul 2022 16:24:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D348C433C1; Wed, 27 Jul 2022 16:24:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658939088; bh=eK8XCS3A41MxgxlDFeO9bCfc1XOeWvk+98vg4pkjDfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OcPjFfyWyYUV62JQBPZF63i9E+rseWsMFyS5U71eR2YotwxTBIU4LuTOSujXeqoHr phxy3YCltNOGNG3c6Rj6zmI8urgyI9snqYyNFVknown84vHmDxn9DYwJEqfij+JBJK eiHtMZuaRFhdbK5LFEiX8Lrt2dlzr13cBPMmxZIs= 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 4.19 01/62] riscv: add as-options for modules with assembly compontents Date: Wed, 27 Jul 2022 18:10:10 +0200 Message-Id: <20220727161004.224433015@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727161004.175638564@linuxfoundation.org> References: <20220727161004.175638564@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore 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 @@ -66,6 +66,7 @@ ifeq ($(CONFIG_MODULE_SECTIONS),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