Message ID | 20230710042924.2518198-1-chenhuacai@loongson.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4784985vqx; Sun, 9 Jul 2023 22:03:35 -0700 (PDT) X-Google-Smtp-Source: APBJJlFJx19NGVUYp6bO70dTyYWD3ntdrxmRp4MvtmM/gqz5oNFrdgAGZtqOivskDr2w3iJ5adrF X-Received: by 2002:a17:902:e746:b0:1b9:ce7a:8603 with SMTP id p6-20020a170902e74600b001b9ce7a8603mr6072875plf.66.1688965415578; Sun, 09 Jul 2023 22:03:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688965415; cv=none; d=google.com; s=arc-20160816; b=kxBKwTCW2QsJ2ggUxdBObTR1w6MzSonMC6Ax+KDRFo4VYsiDGjDMhz+j/uMGHrqW+U HPmiNYD/yyUTZBEzLGD/blbf9GW5Bxuduj1jT/bA0WxScwPzeFl+Gkv+H80xcOXiEV0J n/TDu1Dw9xHchQijSzXW8Y3JKZDdD/zijLPdEKPWi+c+LsOd9DWYG8mFg6NkGfmwQH3t 5H/x8yfz/ZHxYbXT2hcqiqxHPA+/mChh9xBIfL3zvsJ9nqi6v7VlhsqZNFL5zABgppVM VZDRjM09eLRX5bd5TL9ZljbPCVrr37mtoMH7BMUV6lA35C0h9Jbd/IQDwXm5KsjxlrhD Bskw== 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=+pbksyCdhG/NghpMHpzEA9zv3CT/qAVe2+8gazdpjE4=; fh=M0S33IGknW5HMl/TVez3aVn0g6Btxl5Dt4RVvkHN+KE=; b=DN3NcU64UmqGAFRXp882g89KLKX8G8Fg9VYuinn439qkVbLrLizxBZ5mBLg5y9aeEj ksGlNcAJQsHHRK6FoqlyIZxHYkSPtOp9HWhRaqh9hKR6EwcxoFS+eIRqliqiCFQtdE7t 922uQv6JXEuyFsf6APiocMidptnYlmdXoP9oDMbh9mqMEjTI8EOj+mfD0wsy9cF2IZJ+ m98Vm5DmlKcQKG4yVJWjYQbwtSuH1WyQcMztkhtCmozEe832E8h/S7y3Dvjx0gCSqPa+ 2VUFQb26UutYb+wwwhHrA91iDlmZFyv4SOpjbAhNFOGV7iT1Ntp3V542dQP/Vd0Apax/ zQuw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c9-20020a170902d48900b001b8b386ae30si8771260plg.335.2023.07.09.22.03.21; Sun, 09 Jul 2023 22:03:35 -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 S229575AbjGJEa0 (ORCPT <rfc822;ybw1215001957@gmail.com> + 99 others); Mon, 10 Jul 2023 00:30:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229631AbjGJEaS (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 10 Jul 2023 00:30:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0EF010C7; Sun, 9 Jul 2023 21:29:53 -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 7681F60D54; Mon, 10 Jul 2023 04:29:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B9FFC433C9; Mon, 10 Jul 2023 04:29:49 +0000 (UTC) From: Huacai Chen <chenhuacai@loongson.cn> To: Arnd Bergmann <arnd@arndb.de>, Huacai Chen <chenhuacai@kernel.org> Cc: loongarch@lists.linux.dev, linux-arch@vger.kernel.org, Xuefeng Li <lixuefeng@loongson.cn>, Guo Ren <guoren@kernel.org>, Xuerui Wang <kernel@xen0n.name>, Jiaxun Yang <jiaxun.yang@flygoat.com>, linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn, Huacai Chen <chenhuacai@loongson.cn> Subject: [PATCH] LoongArch: Fix module relocation error with binutils 2.41 Date: Mon, 10 Jul 2023 12:29:23 +0800 Message-Id: <20230710042924.2518198-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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771008599892170859 X-GMAIL-MSGID: 1771008599892170859 |
Series |
LoongArch: Fix module relocation error with binutils 2.41
|
|
Commit Message
Huacai Chen
July 10, 2023, 4:29 a.m. UTC
Binutils 2.41 enable linker relaxation by default, but kernel module
loader doesn't support that, so disable it. Otherwise we get such an
error when loading modules: "Unknown relocation type 102".
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
---
arch/loongarch/Makefile | 2 ++
1 file changed, 2 insertions(+)
Comments
On 2023/7/10 12:29, Huacai Chen wrote: > Binutils 2.41 enable linker relaxation by default, but kernel module "enables" / "will enable" > loader doesn't support that, so disable it. Otherwise we get such an > error when loading modules: "Unknown relocation type 102". IMO it could be better to also justify the disabling (instead of adding proper support): linker relaxation 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. > > Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> > --- > 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 The code changes are good. With the commit message improved: Reviewed-by: WANG Xuerui <git@xen0n.name>
On Mon, Jul 10, 2023 at 12:45 PM WANG Xuerui <kernel@xen0n.name> wrote: > > On 2023/7/10 12:29, Huacai Chen wrote: > > Binutils 2.41 enable linker relaxation by default, but kernel module > > "enables" / "will enable" > > > loader doesn't support that, so disable it. Otherwise we get such an > > error when loading modules: "Unknown relocation type 102". > > IMO it could be better to also justify the disabling (instead of adding > proper support): linker relaxation 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. OK, thanks. Huacai > > > > > Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> > > --- > > 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 > > The code changes are good. With the commit message improved: > > Reviewed-by: WANG Xuerui <git@xen0n.name> > > -- > WANG "xen0n" Xuerui > > Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/ > >
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