From nobody Mon Feb 9 10:51:47 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81495EB64D9 for ; Mon, 10 Jul 2023 05:00:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230253AbjGJFAk (ORCPT ); Mon, 10 Jul 2023 01:00:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbjGJFAh (ORCPT ); Mon, 10 Jul 2023 01:00:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D8C3BC; Sun, 9 Jul 2023 22:00:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9EC0B60B90; Mon, 10 Jul 2023 05:00:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4498CC433C7; Mon, 10 Jul 2023 05:00:31 +0000 (UTC) From: Huacai Chen To: Arnd Bergmann , Huacai Chen Cc: loongarch@lists.linux.dev, linux-arch@vger.kernel.org, Xuefeng Li , Guo Ren , Xuerui Wang , Jiaxun Yang , linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn, Huacai Chen , WANG Xuerui Subject: [PATCH V2] LoongArch: Fix module relocation error with binutils 2.41 Date: Mon, 10 Jul 2023 13:00:24 +0800 Message-Id: <20230710050024.2519893-1-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Binutils 2.41 enables linker relaxation by default, but the kernel module loader doesn't support that, so just disable it. Otherwise we get such an error when loading modules: "Unknown relocation type 102" As an alternative, we could add linker relaxation support in the kernel module loader. But it is relatively large complexity that may or may not bring a similar gain, and we don't really want to include this linker pass in the kernel. Reviewed-by: WANG Xuerui Signed-off-by: Huacai Chen --- arch/loongarch/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile index 09ba338a64de..7466d3b15db8 100644 --- a/arch/loongarch/Makefile +++ b/arch/loongarch/Makefile @@ -68,6 +68,8 @@ LDFLAGS_vmlinux +=3D -static -n -nostdlib ifdef CONFIG_AS_HAS_EXPLICIT_RELOCS cflags-y +=3D $(call cc-option,-mexplicit-relocs) KBUILD_CFLAGS_KERNEL +=3D $(call cc-option,-mdirect-extern-access) +KBUILD_AFLAGS_MODULE +=3D $(call cc-option,-mno-relax) $(call cc-option,-= Wa$(comma)-mno-relax) +KBUILD_CFLAGS_MODULE +=3D $(call cc-option,-mno-relax) $(call cc-option,-= Wa$(comma)-mno-relax) else cflags-y +=3D $(call cc-option,-mno-explicit-relocs) KBUILD_AFLAGS_KERNEL +=3D -Wa,-mla-global-with-pcrel --=20 2.39.3