Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp387439imn; Thu, 28 Jul 2022 04:01:28 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vZ4ynDV+3MTV5h9WGKAdGkp1eYzgDgOvkk3lRZ10Hg5YeTPXFgzCUaVPlGdPs3Gfwf+Kmd X-Received: by 2002:a17:907:9809:b0:72f:817:d433 with SMTP id ji9-20020a170907980900b0072f0817d433mr20844059ejc.483.1659006088093; Thu, 28 Jul 2022 04:01:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659006088; cv=none; d=google.com; s=arc-20160816; b=q/9XoJQEKPkxYSZipOfsU7nQM+HgI9/5+0eUX/pyIp2h9TPjaRVcUCiJbk9RMvNxfF KN95L431APauLiJ424mdoNj6nHcoMMeUpl6Few1LO5y8eXbIQJ0EbulgvaPwXAnxH61b beygWSWJ2PMdBdcklqRxHQWi68nuChHr1I42JtmkTLQkwegtocwmALFFXju7SSDvtrIa 9VNxRzBWj8GLSN05OSQlcDEMN+/jcBgW7LpVjFAT8WA3YKGF4BKZ6ig1BsxhPqJwmPNK Un08xpjISorvLA89FCLLCsHb4F96FS5vqFE8xzpsr+GbktzohjdO5JpeLjPwNO8v3f10 hbbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=yRmMveNaOUKifT4ewJ5e1rXURoy9i48LHR1X4r7j7CQ=; b=0wkJwQjjjYyNqvmPJw/VhUVBIKQhWgOAgLOqsZSPf/h8OsaphRGb9Dk7+lhLXXzSYT IwqOzMExUGcjX7VIlNR5AU4QknfGhffu24Z+Z96llUxhlDyFyExgWQsWSm02J4Vr0pG+ RHrnZo4kh/EuvYKe3ZEQe2kj4OC/QpdIWvPa5eO/rW3vHlYYVAfmne9RTVC54gWsN7aK ERUGVwXb1GIdLqy9QS223tnoU8OXlKxYEVIGXNCKMh2eifxYNTfQjKuIC4sRZxadlpE+ Z9+P1Z+WIeyUBS68i3yca1EFL/OufMl9Oa3/HkFh7iuPFRP4PxQ1c1Lv0nFdMqJmTMuu XbAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=JYpaftwl; 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=REJECT sp=REJECT dis=NONE) header.from=xry111.site Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qp4-20020a170907206400b006f508f07fa1si378357ejb.458.2022.07.28.04.01.03; Thu, 28 Jul 2022 04:01:28 -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=@xry111.site header.s=default header.b=JYpaftwl; 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=REJECT sp=REJECT dis=NONE) header.from=xry111.site Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236273AbiG1Kxh (ORCPT + 99 others); Thu, 28 Jul 2022 06:53:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234566AbiG1Kxf (ORCPT ); Thu, 28 Jul 2022 06:53:35 -0400 Received: from xry111.site (xry111.site [IPv6:2001:470:683e::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26E095A2EA for ; Thu, 28 Jul 2022 03:53:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1659005607; bh=yRmMveNaOUKifT4ewJ5e1rXURoy9i48LHR1X4r7j7CQ=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=JYpaftwlnDdye6MzckAT39py18n6vZ1gI3QYA3T+dVXlNR7twUrO9OUHPMGwrHmRP blxNw0wwU0uxGCO7k/wBaKs0Ww9/8fVb5k0HzWkfeTOgonME53uANDEbvB9OmzkBKz fn42Ifm8Xd+Sa1LrBlH4AmJxbSkOG0MQMoGMBLWc= Received: from localhost.localdomain (xry111.site [IPv6:2001:470:683e::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 8381B667D6; Thu, 28 Jul 2022 06:53:26 -0400 (EDT) Message-ID: <39d3b56e3265e70d26e1d08698b461d81c3e1c1d.camel@xry111.site> Subject: Re: [PATCH 1/5] LoongArch: Add section of GOT for kernel module From: Xi Ruoyao To: Youling Tang , loongarch@lists.linux.dev Cc: linux-kernel@vger.kernel.org, WANG Xuerui , Huacai Chen Date: Thu, 28 Jul 2022 18:53:24 +0800 In-Reply-To: References: <385f63bcbee8e37c42f479ce9cdc7e7d731d419b.camel@xry111.site> <3f43d51d530344f73a0a7087407799ff9dff3ba8.camel@xry111.site> <849f514e-f78a-72a2-b94e-6974074b75eb@loongson.cn> <00914cf65b64e06f370213fdc079111aa2a27145.camel@xry111.site> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.3 MIME-Version: 1.0 X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FROM_SUSPICIOUS_NTLD, PDS_OTHER_BAD_TLD,SPF_HELO_PASS,SPF_PASS autolearn=no 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 Thu, 2022-07-28 at 17:21 +0800, Youling Tang wrote: >=20 >=20 > On 07/28/2022 05:02 PM, Xi Ruoyao wrote: > > On Thu, 2022-07-28 at 16:29 +0800, Youling Tang wrote: > > > On 07/28/2022 12:26 AM, Xi Ruoyao wrote: > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0mod->arch.got.shdr->sh_t= ype =3D SHT_NOBITS; > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0mod->arch.got.shdr->sh_f= lags =3D SHF_ALLOC; > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0mod->arch.got.shdr->sh_a= ddralign =3D L1_CACHE_BYTES; > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0mod->arch.got.shdr->sh_s= ize =3D (num_plts + 1) * > > > > sizeof(struct plt_entry); > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0mod->arch.got.num_entrie= s =3D 0; > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0mod->arch.got.max_entrie= s =3D num_plts; > > > =C2=A0Hi, Ruoyao > > >=20 > > > =C2=A0 We should use num_gots instead of num_plts when creating .got > > > section. > >=20 > > Yes, it's a stupid error and I'll fix it in V2. > >=20 > > But why didn't this cause a malfunction on my system? :(. >=20 > Maybe num_plts is greater than num_gots, and the size of plt_entry is=20 > equivalent to the size of four got_entry, so that when the module is=20 > loaded, it just allocates a larger space without causing the module to > fail to load. I'll write a module to load address of 10 kernel symbols with only one printk call to test before sending V2 :). --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University