Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp34880772rwd; Sun, 9 Jul 2023 22:35:14 -0700 (PDT) X-Google-Smtp-Source: APBJJlH9GPm/EZvEJzu8k+c74ia2b+pAPes3Ja4LikHv5S0gi8tne1B4kmlkkt6ToPyqYg9+LM5z X-Received: by 2002:a05:6a20:72a5:b0:130:a15d:54eb with SMTP id o37-20020a056a2072a500b00130a15d54ebmr8635187pzk.24.1688967314430; Sun, 09 Jul 2023 22:35:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688967314; cv=none; d=google.com; s=arc-20160816; b=N/yOJRQEWewGCcJgnLd3eiBxlAQ4fDxJftaN87MQqRBEjaAxvtfZDQpj/+ZOz6cRgN VVCStOZsXQZh2YQJlnQjoHEYkfn9NGpLYNqT0r1cHtb+lw60eJsLCOwrNemW/KCzpfeV ov+9CdgFs24RTdPbWb9od12hxDFaKXbKTuLriFlUgBkPwq1oRQKOyj080c4+xPjIs8Wv fUOy/Hn9MRvNsvnSCgNkQlq3OnJb1V8iTjCdetKkBBpW7Dr/bWQHix5ziOv4RBPoWrWQ PMapMCWL2f417CwDPFAAj/vxQlXWUwb6e9AhI1hMj7WtfFFHNh4lR++pJDKHpCurwJHq KVKA== 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 :message-id:date:subject:cc:to:from; bh=hiEc2NX8GSmkzQovw26WDLgx+s6NrhQxGUW8I/DI88c=; fh=9srzircU042t1leULFVTFCAnjtIpxGD2sOXDf0x4B6Q=; b=YfRqSaCpU83tMqc6ipPfxDySfMrPiwyWz7CWi1fQ3z3hwbvyj9bOuL57/8NDZJYzU8 B2GaaPYiXt3m/bMF7IeWEYNtdGF499SHUjQgdtVWliM3r+bree+bajCR2bhFwOiB1GnT +1hf+Oi841OB/H7zeqaEZEBtAMDxn13Yz3ZDM6Hcmw0uz2A4ikYf1q323gm8V3BSYNdU bPTrWa+69xMY4bmIOqlfcgkRbM+EEBBVaSYWLbAKt6pdvmJTrjeDv5pRPG77vbcWTlwE bW5JEf6JFs759EhycBzmZ83QG1J9CO6x8LucJ9QeqxsA6a77DnBtEaRmPVEQNDjuR2bw 7nPw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t1-20020a170902e84100b001b18c3ee3fasi8534129plg.225.2023.07.09.22.35.02; Sun, 09 Jul 2023 22:35:14 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229968AbjGJFAj (ORCPT + 99 others); Mon, 10 Jul 2023 01:00:39 -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: 8bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 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 += -static -n -nostdlib ifdef CONFIG_AS_HAS_EXPLICIT_RELOCS cflags-y += $(call cc-option,-mexplicit-relocs) KBUILD_CFLAGS_KERNEL += $(call cc-option,-mdirect-extern-access) +KBUILD_AFLAGS_MODULE += $(call cc-option,-mno-relax) $(call cc-option,-Wa$(comma)-mno-relax) +KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-relax) $(call cc-option,-Wa$(comma)-mno-relax) else cflags-y += $(call cc-option,-mno-explicit-relocs) KBUILD_AFLAGS_KERNEL += -Wa,-mla-global-with-pcrel -- 2.39.3