Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp594550rwl; Wed, 9 Aug 2023 21:06:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEN/Eo34GCg/pGPhbmoJvG7oTy9HsQ3XLVHVrI+ZM9ZKGPfDsPSuVzCDt4EhIVUz/cAocPi X-Received: by 2002:a17:90b:4ac6:b0:268:565f:44a with SMTP id mh6-20020a17090b4ac600b00268565f044amr1105204pjb.9.1691640407325; Wed, 09 Aug 2023 21:06:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691640407; cv=none; d=google.com; s=arc-20160816; b=VicqL58R9sko3SORP5CSV8arsdK6tOl1xLV9eBTGi+qQetV9is+zrNMhTuwvt5O4vD 0B/fEP7EFGqRHWj7rAlSbmcpV2IR2DS0DN7ROwlKaQ5LCtuMxYuZ67HnNlfUaUW1CETh keFpO3d+FtPP4fMlolFGqn6O5eIswS5VAfcBYCVnh5A+XTpXWn4Xfxdbe2ObKUvQKj5b EoQX86mkHT915bfl6nRdODcxlE+pjJ/eY+EnR73r2o3iBpBu/thwSOF7nyZOyvPoieO9 Q43Si8RzDUXvN62Qjz8MzmQicL4pbTioDbvdp8ZkOaFq0LJX0jcf0pXE2fWwsoLsv4rC tptw== 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=H21tovFriof1RXfN6kVEANI3xSBRWg1Q875peZGoIFY=; fh=a0miJEml9l/G1UI8agkYJaTrHJJDLtmcHgk9qvXEaUw=; b=gPZ2ZJFe6J1ipIjSjHcEsQr2YOF+My0nLrS2jrPU1TIiHoCLcOZqh+XeWfTdwm/cY8 ii3t5xegNhmyvIA9gEkJK8IIkAbDxr34AEVBcgqAj0kA6GyhlNNz79OKdX/M2Z+aUMfj GVjIZAs6jqpCqoV8kl8ZImYVZ1LH8sTL23DT1NaSaYBgCBRaLAl/G6EP1Q6FXhtIVLyf c8GiYgOS0okMdxQf+xmE6XkjIQMxQ2mNN3vLGS8ze0xki6V4e8h5ZD0LAnLy8GThnZne krnS2jHUBI4BJdTobhsFhrC4kz1RkCVU8eSAxpLa4Y/YMw3Bm3QRef90q96w8zgZDV3Y aZ4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=u47TIKeQ; 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 e14-20020a17090301ce00b001bb86cdf12bsi655738plh.147.2023.08.09.21.06.35; Wed, 09 Aug 2023 21:06:47 -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=u47TIKeQ; 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 S232085AbjHJDep (ORCPT + 99 others); Wed, 9 Aug 2023 23:34:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229871AbjHJDeo (ORCPT ); Wed, 9 Aug 2023 23:34:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 941BE2100; Wed, 9 Aug 2023 20:34:43 -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 2ECCA64DF7; Thu, 10 Aug 2023 03:34:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E909C433C7; Thu, 10 Aug 2023 03:34:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691638482; bh=rCOsgCbjaN827PPhM108Ek17mZMzkYk4jK2hnYfjYGk=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=u47TIKeQiYlW2h4dgQKzh2rhWoHUFehCYA2RbBa7G/bT+CYjln4MKbyIjd3Q1B1Tv WdsiL4723pydlG+c7Oxrh+OciI/Ri73/ubezvm8FLdNZ66Eq/TGJ7uakVzm7RqG27j l0MI74RoAO2FTxV0iGqgSw8uoBQ9x/bO0qjjQyyBIBtH4pYxODNed9Y+6x7QMtYHIo j9VQBGMgsrK9Raw+AJs+WcwDr9cAL1JA/fSJu8gJ8FBYPk3TglqaF6FgcYNNISNbwB HE8Oi7KmFAoexiMT/14omAq8anI0LgvXahGFVUWye5e//voka6Lz9W7Gct/xqSLRkx 40riAQBHo9k9A== Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-99c47ef365cso73865666b.0; Wed, 09 Aug 2023 20:34:42 -0700 (PDT) X-Gm-Message-State: AOJu0YwDWnOt6O3pm+sV7uw62STWsjkFQvP2I/M3yw44g9fdgkZGpgAJ c0sG8wo8AJaZvspzLTN2EZIn2WuhndMhxV6QYtA= X-Received: by 2002:a17:906:dc:b0:99b:c8db:d92f with SMTP id 28-20020a17090600dc00b0099bc8dbd92fmr1018081eji.69.1691638480735; Wed, 09 Aug 2023 20:34:40 -0700 (PDT) MIME-Version: 1.0 References: <20230710050024.2519893-1-chenhuacai@loongson.cn> <292e6aa6b9399c8dd53562f51237090bcd6d19c5.camel@xry111.site> In-Reply-To: <292e6aa6b9399c8dd53562f51237090bcd6d19c5.camel@xry111.site> From: Huacai Chen Date: Thu, 10 Aug 2023 11:34:29 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH V2] LoongArch: Fix module relocation error with binutils 2.41 To: Xi Ruoyao Cc: Huacai Chen , Arnd Bergmann , 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, WANG Xuerui , stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.1 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 Hi, Ruoyao, On Thu, Aug 10, 2023 at 11:21=E2=80=AFAM Xi Ruoyao wro= te: > > On Thu, 2023-08-10 at 11:20 +0800, Xi Ruoyao wrote: > > Can we backport this patch into stable? It fixes a build error with > > binutils >=3D 2.41. > > Correction: not a build error, but all modules won't load if built with > binutils >=3D 2.41 without the patch. Generally we can backport, but I don't think there are users who use the old kernels. :) Huacai > > > On Mon, 2023-07-10 at 13:00 +0800, Huacai Chen wrote: > > > 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 kern= el > > > 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-relo= cs) > > > KBUILD_CFLAGS_KERNEL +=3D $(call cc-option,-mdirect-extern= -access) > > > +KBUILD_AFLAGS_MODULE +=3D $(call cc-option,-mno-relax) $(c= all cc-option,-Wa$(comma)-mno-relax) > > > +KBUILD_CFLAGS_MODULE +=3D $(call cc-option,-mno-relax) $(c= all cc-option,-Wa$(comma)-mno-relax) > > > else > > > cflags-y +=3D $(call cc-option,-mno-explicit-r= elocs) > > > KBUILD_AFLAGS_KERNEL +=3D -Wa,-mla-global-with-pcrel > > > > -- > Xi Ruoyao > School of Aerospace Science and Technology, Xidian University