Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp34877551rwd; Sun, 9 Jul 2023 22:32:03 -0700 (PDT) X-Google-Smtp-Source: APBJJlEz9Yiy4zX/NBPuTngFlbwoqrkWnn0vAx+JUNTMguXjjdaJS6f8ESWf+ueMuDU5gLYSEAH0 X-Received: by 2002:a05:6808:3089:b0:3a0:4636:d079 with SMTP id bl9-20020a056808308900b003a04636d079mr11045482oib.22.1688967123591; Sun, 09 Jul 2023 22:32:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688967123; cv=none; d=google.com; s=arc-20160816; b=EvBbsyC6jyq18prOEhHhnw+Aqg0gFh5gzYIC76GyWYGgnKw2uAZ8YhCvX/WN263DHM IV+BafVFeErz6gAQxmdpovIkquwMjlX/aN1D13xB1lTLma5Lc3nWf1lO/FdfmGlhx1pC saT805N9r6hE09SWmixqiDgK1RAcuEiCHLmivW2PCJICZ+WR7cha8JznE8uEPSHoYrj+ /zCp/oilfZJbEe8LOBdUfwhlVQrQt3n9MZjxKOB1AHH+IQLckn/+YVgz4VSi8R77MMti CL6iJqi1aYnG5aF0rpr1wW2eBSGdSWrJOrhX1ATN9LPFgPhZpAQsfyn6QVIR/PQIXX/Q ky4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=E8OIlrobRIC2KMj6A15OEVPpUtg+rbDOg1AIipuuTlo=; fh=btfJbmHfL1ZnuGTqUXHXdqUWaVuwGVPokkEQ2QV5oZY=; b=Haa2BWYOi2F6cJUqztQID6JEGiCPuJFapgJxabzXhSUWPuWPGxNX0fr6aFw6xD3cjE rPGowZyms3ge4cllJPBUvXfQzKuHczdzidNAaRu2FRz8M2ogKcNbHuuXqwZp6ULlP3J3 cGg/w/kxx/gLrAn1UGrVi+Rj50W+i18otLhkOpnTxil/E29G2dVhWxFOfm2FDAwuU7u2 EzBK63kdkHBR462ACt9pdQEW3FDIjDO0Wht7IomMjIOX/1aOLqPLb7dE6HEijBsuDL/D 0I9s7EYr7Cs+FtO4nlyig9H2IvMx3UtrGh20749w7zsSfHcJVUzUSGbinn7AyaBMte4d FmHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="OU6WT/nm"; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n5-20020a634d45000000b0055b635b788fsi7828241pgl.199.2023.07.09.22.31.51; Sun, 09 Jul 2023 22:32:03 -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=@kernel.org header.s=k20201202 header.b="OU6WT/nm"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230293AbjGJFBj (ORCPT + 99 others); Mon, 10 Jul 2023 01:01:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbjGJFBh (ORCPT ); Mon, 10 Jul 2023 01:01:37 -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 63924BC; Sun, 9 Jul 2023 22:01:36 -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 EC35E60B90; Mon, 10 Jul 2023 05:01:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6081BC433CA; Mon, 10 Jul 2023 05:01:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688965295; bh=hIQ/sg02GFBnzX1+ASxA+DzxH1Q7XpDP1DHHVadqzVY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=OU6WT/nmkF0xVZpwzeynXEPdiEXvp1jRykp6qezpi4pzCBBSnmwN7rSXqOC9a9vwr e9wvJdvvIMAVk/67DF83HUI3ZlJLsi8ZwpuPVY/XSC+rw/9V6w49CHKv7ytfyg8J2r PCXlUKKDwOlysIbvIWzVv7OZi+A94pangwNKoD6Xy6DiFUM19quvFsoqPgLfNf1XWh JdBmjaZ1Q1GfPe8rrz7crAi+1fAN491/vGXZCVBHPTu0EPgkoeyT8kMvGtdjUde0bR KVxaeFJ/Q/cRmWuD0n8uKUcYEIXcONezt0aL2lrIEvr3+YQ+k0YZGgEJJFloJoVJ4H cMtYtmVetZFOg== Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-51d885b0256so5646839a12.2; Sun, 09 Jul 2023 22:01:35 -0700 (PDT) X-Gm-Message-State: ABy/qLZ+Qja5r78eE7Btm8gnGnN4WPsnq0khTkDQUeMEuJOCInfO4+GU 9J4ug948G60ZAykAmpNCsYJiTMP6AbuHqpXCouQ= X-Received: by 2002:a05:6402:1b0b:b0:51d:9b4d:66bd with SMTP id by11-20020a0564021b0b00b0051d9b4d66bdmr10171546edb.9.1688965293643; Sun, 09 Jul 2023 22:01:33 -0700 (PDT) MIME-Version: 1.0 References: <20230710042924.2518198-1-chenhuacai@loongson.cn> <51181fd7-fc1f-2222-9b8a-8ce44fe85ea5@xen0n.name> In-Reply-To: <51181fd7-fc1f-2222-9b8a-8ce44fe85ea5@xen0n.name> From: Huacai Chen Date: Mon, 10 Jul 2023 13:01:21 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] LoongArch: Fix module relocation error with binutils 2.41 To: WANG Xuerui Cc: Huacai Chen , Arnd Bergmann , loongarch@lists.linux.dev, linux-arch@vger.kernel.org, Xuefeng Li , Guo Ren , Jiaxun Yang , linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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 On Mon, Jul 10, 2023 at 12:45=E2=80=AFPM WANG Xuerui wr= ote: > > 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 > > --- > > 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-ex= tern-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-reloc= s) > > KBUILD_AFLAGS_KERNEL +=3D -Wa,-mla-global-with-pcrel > > The code changes are good. With the commit message improved: > > Reviewed-by: WANG Xuerui > > -- > WANG "xen0n" Xuerui > > Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/ > >