Message ID | 1683615352-10794-1-git-send-email-yangtiezhu@loongson.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2678227vqo; Tue, 9 May 2023 00:09:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6SLikE3shjhJ1BObG9SM+RvAWBCfOM9ydIx+KKJqdwDL5VQ18CGPMQfBd9euJUGUOkCNPo X-Received: by 2002:a05:6a20:9f4d:b0:eb:a859:cace with SMTP id ml13-20020a056a209f4d00b000eba859cacemr14342571pzb.41.1683616187857; Tue, 09 May 2023 00:09:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683616187; cv=none; d=google.com; s=arc-20160816; b=BycedvgUIbknkXQKfp6RnGQtceyas0PPFf+5Zo4Ex5xCb3Y4dNvar1eBAZA2tfdNOX Qb0t5W1N12Xt478ldJ/4sS9LP/G2y+WHy6T4HiW9l/0svE6HSgieDGp0HrJ1h2Lx6mfC FrNn/A1bJh6beEufYyOrMNKDxufPyi5Ddq33/Xba4q7OAm65Y+Xk9SV419+S762W2Fw8 bxiyv9TGlKw5y7h3HfJpW1RhHDVls3NHIjwEIBEgRqdK4bZRYDsfsPMbHXMrxfKjCfvC LY41J34l0O1k4WQtNXOi2XeNl7lSmew9gnP4ILzy303wKHeXQiz5IC3CcowvZQ4mZkYP vnXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=UlQmMKu5zfOGCmDWxkKCb1bajxV/GViWCjGvsiQwSiQ=; b=jDkY8pyzd0jq/8Ad6MSjsw4q7YjcgziSODj1/hwYsISS2HOm1FyWunYdvoYqfSHCci TFB+n33sRFk9raFFEv/wjLAUaCyp2laUhdh2YqoY/Mq+znLdptULnQdR4rL6DpGq67qk 9ZVqI88yrsOu1WvigZt0ohDIT5TEE9OXRtM5oYCd7W+u2Wjt2cKnXzV58sxDHi6NAYFH NU3x1413LAcsv8X/xz6IioxvVu4VrWLe8joYPk1/XktGwkPw5o+XVZjnHXIUSihxsvpi OT7nK85e1EQxztwBeUuooysZa9daKv+7AsKXQsc4Vw3FS00GylE4gtRnnHjtqsOKQ4BY 4Ybw== 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 e25-20020a633719000000b0050aad8e18a5si836868pga.545.2023.05.09.00.09.32; Tue, 09 May 2023 00:09: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; 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 S235107AbjEIG4K (ORCPT <rfc822;jeantsuru.cumc.mandola@gmail.com> + 99 others); Tue, 9 May 2023 02:56:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235109AbjEIGz4 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 9 May 2023 02:55:56 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E81F54ECE; Mon, 8 May 2023 23:55:54 -0700 (PDT) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8BxrOp57llkjN4GAA--.11631S3; Tue, 09 May 2023 14:55:53 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxoOR47llkUDtSAA--.16572S2; Tue, 09 May 2023 14:55:53 +0800 (CST) From: Tiezhu Yang <yangtiezhu@loongson.cn> To: Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Arnaldo Carvalho de Melo <acme@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>, Ian Rogers <irogers@google.com>, Adrian Hunter <adrian.hunter@intel.com> Cc: linux-perf-users@vger.kernel.org, loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn Subject: [PATCH] perf symbol: Add LoongArch case in get_plt_sizes() Date: Tue, 9 May 2023 14:55:52 +0800 Message-Id: <1683615352-10794-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: AQAAf8BxoOR47llkUDtSAA--.16572S2 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBjvdXoW7Jr4DWFWxGr1UGF4Utw47Jwb_yoWkGwb_ta 4fuF40yw1UArWvyrWDCrW5uFWruayrZFs5uFyDWw4xCa1ftF45WF47Zr93uF15Zw1Yvr9x Jwn2q3yfArs8GjkaLaAFLSUrUUUUYb8apTn2vfkv8UJUUUU8wcxFpf9Il3svdxBIdaVrn0 xqx4xG64xvF2IEw4CE5I8CrVC2j2Jv73VFW2AGmfu7bjvjm3AaLaJ3UjIYCTnIWjp_UUUY W7kC6x804xWl14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0rVWrJVCq3w AFIxvE14AKwVWUXVWUAwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK021l84ACjcxK 6xIIjxv20xvE14v26r4j6ryUM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4j6F4UM28EF7 xvwVC2z280aVAFwI0_Cr1j6rxdM28EF7xvwVC2z280aVCY1x0267AKxVWxJr0_GcWln4kS 14v26r1q6r43M2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx 1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1q6rW5McIj6I8E87Iv 67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lc7CjxVAaw2 AFwI0_Jw0_GFyl42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1l4IxYO2xF xVAFwI0_Jw0_GFylx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWw C2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Gr0_ Xr1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJV WUCwCI42IY6I8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIY CTnIWIevJa73UjIFyTuYvjxUstxhDUUUU X-Spam-Status: No, score=1.4 required=5.0 tests=BAYES_00,RCVD_IN_SBL_CSS, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765399527799231857?= X-GMAIL-MSGID: =?utf-8?q?1765399527799231857?= |
Series |
perf symbol: Add LoongArch case in get_plt_sizes()
|
|
Commit Message
Tiezhu Yang
May 9, 2023, 6:55 a.m. UTC
We can see the following definitions in bfd/elfnn-loongarch.c:
#define PLT_HEADER_INSNS 8
#define PLT_HEADER_SIZE (PLT_HEADER_INSNS * 4)
#define PLT_ENTRY_INSNS 4
#define PLT_ENTRY_SIZE (PLT_ENTRY_INSNS * 4)
so plt header size is 32 and plt entry size is 16 on LoongArch,
let us add LoongArch case in get_plt_sizes().
Link: https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=bfd/elfnn-loongarch.c
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
This is based on 6.4-rc1
tools/perf/util/symbol-elf.c | 4 ++++
1 file changed, 4 insertions(+)
Comments
Queued, thanks. Huacai On Tue, May 9, 2023 at 2:56 PM Tiezhu Yang <yangtiezhu@loongson.cn> wrote: > > We can see the following definitions in bfd/elfnn-loongarch.c: > > #define PLT_HEADER_INSNS 8 > #define PLT_HEADER_SIZE (PLT_HEADER_INSNS * 4) > > #define PLT_ENTRY_INSNS 4 > #define PLT_ENTRY_SIZE (PLT_ENTRY_INSNS * 4) > > so plt header size is 32 and plt entry size is 16 on LoongArch, > let us add LoongArch case in get_plt_sizes(). > > Link: https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=bfd/elfnn-loongarch.c > Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> > --- > > This is based on 6.4-rc1 > > tools/perf/util/symbol-elf.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c > index b2ed9cc..5d409c2 100644 > --- a/tools/perf/util/symbol-elf.c > +++ b/tools/perf/util/symbol-elf.c > @@ -411,6 +411,10 @@ static bool get_plt_sizes(struct dso *dso, GElf_Ehdr *ehdr, GElf_Shdr *shdr_plt, > *plt_header_size = 32; > *plt_entry_size = 16; > return true; > + case EM_LOONGARCH: > + *plt_header_size = 32; > + *plt_entry_size = 16; > + return true; > case EM_SPARC: > *plt_header_size = 48; > *plt_entry_size = 12; > -- > 2.1.0 > >
On Thu, May 18, 2023 at 10:11:27AM +0800, Huacai Chen wrote: > Queued, thanks. The patch is fine for me. Should not perf patches are to be merged via Arnaldo's tree? Thanks, Leo > On Tue, May 9, 2023 at 2:56 PM Tiezhu Yang <yangtiezhu@loongson.cn> wrote: > > > > We can see the following definitions in bfd/elfnn-loongarch.c: > > > > #define PLT_HEADER_INSNS 8 > > #define PLT_HEADER_SIZE (PLT_HEADER_INSNS * 4) > > > > #define PLT_ENTRY_INSNS 4 > > #define PLT_ENTRY_SIZE (PLT_ENTRY_INSNS * 4) > > > > so plt header size is 32 and plt entry size is 16 on LoongArch, > > let us add LoongArch case in get_plt_sizes(). > > > > Link: https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=bfd/elfnn-loongarch.c > > Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> > > --- > > > > This is based on 6.4-rc1 > > > > tools/perf/util/symbol-elf.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c > > index b2ed9cc..5d409c2 100644 > > --- a/tools/perf/util/symbol-elf.c > > +++ b/tools/perf/util/symbol-elf.c > > @@ -411,6 +411,10 @@ static bool get_plt_sizes(struct dso *dso, GElf_Ehdr *ehdr, GElf_Shdr *shdr_plt, > > *plt_header_size = 32; > > *plt_entry_size = 16; > > return true; > > + case EM_LOONGARCH: > > + *plt_header_size = 32; > > + *plt_entry_size = 16; > > + return true; > > case EM_SPARC: > > *plt_header_size = 48; > > *plt_entry_size = 12; > > -- > > 2.1.0 > > > >
On Thu, May 18, 2023 at 11:06 AM Leo Yan <leo.yan@linaro.org> wrote: > > On Thu, May 18, 2023 at 10:11:27AM +0800, Huacai Chen wrote: > > Queued, thanks. > > The patch is fine for me. > > Should not perf patches are to be merged via Arnaldo's tree? I think both are OK, if Arnaldo takes this patch, I will drop it. Huacai > > Thanks, > Leo > > > On Tue, May 9, 2023 at 2:56 PM Tiezhu Yang <yangtiezhu@loongson.cn> wrote: > > > > > > We can see the following definitions in bfd/elfnn-loongarch.c: > > > > > > #define PLT_HEADER_INSNS 8 > > > #define PLT_HEADER_SIZE (PLT_HEADER_INSNS * 4) > > > > > > #define PLT_ENTRY_INSNS 4 > > > #define PLT_ENTRY_SIZE (PLT_ENTRY_INSNS * 4) > > > > > > so plt header size is 32 and plt entry size is 16 on LoongArch, > > > let us add LoongArch case in get_plt_sizes(). > > > > > > Link: https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=bfd/elfnn-loongarch.c > > > Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> > > > --- > > > > > > This is based on 6.4-rc1 > > > > > > tools/perf/util/symbol-elf.c | 4 ++++ > > > 1 file changed, 4 insertions(+) > > > > > > diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c > > > index b2ed9cc..5d409c2 100644 > > > --- a/tools/perf/util/symbol-elf.c > > > +++ b/tools/perf/util/symbol-elf.c > > > @@ -411,6 +411,10 @@ static bool get_plt_sizes(struct dso *dso, GElf_Ehdr *ehdr, GElf_Shdr *shdr_plt, > > > *plt_header_size = 32; > > > *plt_entry_size = 16; > > > return true; > > > + case EM_LOONGARCH: > > > + *plt_header_size = 32; > > > + *plt_entry_size = 16; > > > + return true; > > > case EM_SPARC: > > > *plt_header_size = 48; > > > *plt_entry_size = 12; > > > -- > > > 2.1.0 > > > > > >
On Thu, May 18, 2023 at 11:12:26AM +0800, Huacai Chen wrote: > On Thu, May 18, 2023 at 11:06 AM Leo Yan <leo.yan@linaro.org> wrote: > > > > On Thu, May 18, 2023 at 10:11:27AM +0800, Huacai Chen wrote: > > > Queued, thanks. > > > > The patch is fine for me. > > > > Should not perf patches are to be merged via Arnaldo's tree? > > I think both are OK, if Arnaldo takes this patch, I will drop it. A good practice is to firstly inquiry the maintainers. AFAIK, Arnaldo will test perf patches before sending out pull request; if perf patches are scattered out, it might be out of the testing radar. Thanks, Leo
On Thu, May 18, 2023 at 11:21 AM Leo Yan <leo.yan@linaro.org> wrote: > > On Thu, May 18, 2023 at 11:12:26AM +0800, Huacai Chen wrote: > > On Thu, May 18, 2023 at 11:06 AM Leo Yan <leo.yan@linaro.org> wrote: > > > > > > On Thu, May 18, 2023 at 10:11:27AM +0800, Huacai Chen wrote: > > > > Queued, thanks. > > > > > > The patch is fine for me. > > > > > > Should not perf patches are to be merged via Arnaldo's tree? > > > > I think both are OK, if Arnaldo takes this patch, I will drop it. > > A good practice is to firstly inquiry the maintainers. > > AFAIK, Arnaldo will test perf patches before sending out pull request; > if perf patches are scattered out, it might be out of the testing > radar. OK, I know, thank you very much. Huacai > > Thanks, > Leo
On Thu, May 18, 2023 at 11:57:29AM +0800, Huacai Chen wrote: > On Thu, May 18, 2023 at 11:21 AM Leo Yan <leo.yan@linaro.org> wrote: > > > > On Thu, May 18, 2023 at 11:12:26AM +0800, Huacai Chen wrote: > > > On Thu, May 18, 2023 at 11:06 AM Leo Yan <leo.yan@linaro.org> wrote: > > > > > > > > On Thu, May 18, 2023 at 10:11:27AM +0800, Huacai Chen wrote: > > > > > Queued, thanks. > > > > > > > > The patch is fine for me. > > > > > > > > Should not perf patches are to be merged via Arnaldo's tree? > > > > > > I think both are OK, if Arnaldo takes this patch, I will drop it. > > > > A good practice is to firstly inquiry the maintainers. > > > > AFAIK, Arnaldo will test perf patches before sending out pull request; > > if perf patches are scattered out, it might be out of the testing > > radar. > OK, I know, thank you very much. You are welcome! I found the code base for bfd: https://github.com/bminor/binutils-gdb/blob/master/bfd/elfnn-loongarch.c And this patch is consistent with above link, FWIW: Reviewed-by: Leo Yan <leo.yan@linaro.org>
Em Thu, May 18, 2023 at 12:05:53PM +0800, Leo Yan escreveu: > On Thu, May 18, 2023 at 11:57:29AM +0800, Huacai Chen wrote: > > On Thu, May 18, 2023 at 11:21 AM Leo Yan <leo.yan@linaro.org> wrote: > > > > > > On Thu, May 18, 2023 at 11:12:26AM +0800, Huacai Chen wrote: > > > > On Thu, May 18, 2023 at 11:06 AM Leo Yan <leo.yan@linaro.org> wrote: > > > > > > > > > > On Thu, May 18, 2023 at 10:11:27AM +0800, Huacai Chen wrote: > > > > > > Queued, thanks. > > > > > > > > > > The patch is fine for me. > > > > > > > > > > Should not perf patches are to be merged via Arnaldo's tree? > > > > > > > > I think both are OK, if Arnaldo takes this patch, I will drop it. > > > > > > A good practice is to firstly inquiry the maintainers. > > > > > > AFAIK, Arnaldo will test perf patches before sending out pull request; > > > if perf patches are scattered out, it might be out of the testing > > > radar. > > OK, I know, thank you very much. > > You are welcome! > > I found the code base for bfd: > https://github.com/bminor/binutils-gdb/blob/master/bfd/elfnn-loongarch.c > > And this patch is consistent with above link, FWIW: > > Reviewed-by: Leo Yan <leo.yan@linaro.org> Thanks, applied. - Arnaldo
Hi, Arnaldo, On Thu, May 18, 2023 at 8:16 PM Arnaldo Carvalho de Melo <acme@kernel.org> wrote: > > Em Thu, May 18, 2023 at 12:05:53PM +0800, Leo Yan escreveu: > > On Thu, May 18, 2023 at 11:57:29AM +0800, Huacai Chen wrote: > > > On Thu, May 18, 2023 at 11:21 AM Leo Yan <leo.yan@linaro.org> wrote: > > > > > > > > On Thu, May 18, 2023 at 11:12:26AM +0800, Huacai Chen wrote: > > > > > On Thu, May 18, 2023 at 11:06 AM Leo Yan <leo.yan@linaro.org> wrote: > > > > > > > > > > > > On Thu, May 18, 2023 at 10:11:27AM +0800, Huacai Chen wrote: > > > > > > > Queued, thanks. > > > > > > > > > > > > The patch is fine for me. > > > > > > > > > > > > Should not perf patches are to be merged via Arnaldo's tree? > > > > > > > > > > I think both are OK, if Arnaldo takes this patch, I will drop it. > > > > > > > > A good practice is to firstly inquiry the maintainers. > > > > > > > > AFAIK, Arnaldo will test perf patches before sending out pull request; > > > > if perf patches are scattered out, it might be out of the testing > > > > radar. > > > OK, I know, thank you very much. > > > > You are welcome! > > > > I found the code base for bfd: > > https://github.com/bminor/binutils-gdb/blob/master/bfd/elfnn-loongarch.c > > > > And this patch is consistent with above link, FWIW: > > > > Reviewed-by: Leo Yan <leo.yan@linaro.org> > > Thanks, applied. I'm very sorry that this patch breaks cross-build. We need some additional modification. diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 5d409c26a22e..b3dbf6ca99a7 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -35,6 +35,10 @@ #define EM_AARCH64 183 /* ARM 64 bit */ #endif +#ifndef EM_LOONGARCH +#define EM_LOONGARCH 258 +#endif + #ifndef ELF32_ST_VISIBILITY #define ELF32_ST_VISIBILITY(o) ((o) & 0x03) #endif Then, drop this patch to get an updated version, or let me send an incremental patch? Huacai > > - Arnaldo >
On 05/22/2023 11:50 AM, Huacai Chen wrote: > Hi, Arnaldo, > > On Thu, May 18, 2023 at 8:16 PM Arnaldo Carvalho de Melo > <acme@kernel.org> wrote: >> >> Em Thu, May 18, 2023 at 12:05:53PM +0800, Leo Yan escreveu: >>> On Thu, May 18, 2023 at 11:57:29AM +0800, Huacai Chen wrote: >>>> On Thu, May 18, 2023 at 11:21 AM Leo Yan <leo.yan@linaro.org> wrote: >>>>> >>>>> On Thu, May 18, 2023 at 11:12:26AM +0800, Huacai Chen wrote: >>>>>> On Thu, May 18, 2023 at 11:06 AM Leo Yan <leo.yan@linaro.org> wrote: >>>>>>> >>>>>>> On Thu, May 18, 2023 at 10:11:27AM +0800, Huacai Chen wrote: >>>>>>>> Queued, thanks. >>>>>>> >>>>>>> The patch is fine for me. >>>>>>> >>>>>>> Should not perf patches are to be merged via Arnaldo's tree? >>>>>> >>>>>> I think both are OK, if Arnaldo takes this patch, I will drop it. >>>>> >>>>> A good practice is to firstly inquiry the maintainers. >>>>> >>>>> AFAIK, Arnaldo will test perf patches before sending out pull request; >>>>> if perf patches are scattered out, it might be out of the testing >>>>> radar. >>>> OK, I know, thank you very much. >>> >>> You are welcome! >>> >>> I found the code base for bfd: >>> https://github.com/bminor/binutils-gdb/blob/master/bfd/elfnn-loongarch.c >>> >>> And this patch is consistent with above link, FWIW: >>> >>> Reviewed-by: Leo Yan <leo.yan@linaro.org> >> >> Thanks, applied. > I'm very sorry that this patch breaks cross-build. We need some > additional modification. > > diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c > index 5d409c26a22e..b3dbf6ca99a7 100644 > --- a/tools/perf/util/symbol-elf.c > +++ b/tools/perf/util/symbol-elf.c > @@ -35,6 +35,10 @@ > #define EM_AARCH64 183 /* ARM 64 bit */ > #endif > > +#ifndef EM_LOONGARCH > +#define EM_LOONGARCH 258 > +#endif > + > #ifndef ELF32_ST_VISIBILITY > #define ELF32_ST_VISIBILITY(o) ((o) & 0x03) > #endif > > Then, drop this patch to get an updated version, or let me send an > incremental patch? > I tested this patch on native LoongArch and x86 system, I did not hit the build error about undeclared EM_LOONGARCH both on LoongArch and x86, because EM_LOONGARCH is defined in /usr/include/elf.h Here is the x86 system info: [root@fedora yangtiezhu]# cat /etc/fedora-release Fedora release 38 (Thirty Eight) [root@fedora yangtiezhu]# uname -m x86_64 [root@fedora yangtiezhu]# grep -rn -w EM_LOONGARCH /usr/include/ /usr/include/linux/elf-em.h:54:#define EM_LOONGARCH 258 /* LoongArch */ /usr/include/linux/audit.h:442:#define AUDIT_ARCH_LOONGARCH32 (EM_LOONGARCH|__AUDIT_ARCH_LE) /usr/include/linux/audit.h:443:#define AUDIT_ARCH_LOONGARCH64 (EM_LOONGARCH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) /usr/include/elf.h:361:#define EM_LOONGARCH 258 /* LoongArch */ [root@fedora yangtiezhu]# rpm -qf /usr/include/elf.h glibc-headers-x86-2.37-1.fc38.noarch If I am missing something, please let me know. Anyway, it is not a bad thing to add the EM_LOONGARCH definition to avoid the build error on some systems which have no EM_LOONGARCH in the glibc header. Thanks, Tiezhu
On Mon, May 22, 2023 at 3:59 PM Tiezhu Yang <yangtiezhu@loongson.cn> wrote: > > > > On 05/22/2023 11:50 AM, Huacai Chen wrote: > > Hi, Arnaldo, > > > > On Thu, May 18, 2023 at 8:16 PM Arnaldo Carvalho de Melo > > <acme@kernel.org> wrote: > >> > >> Em Thu, May 18, 2023 at 12:05:53PM +0800, Leo Yan escreveu: > >>> On Thu, May 18, 2023 at 11:57:29AM +0800, Huacai Chen wrote: > >>>> On Thu, May 18, 2023 at 11:21 AM Leo Yan <leo.yan@linaro.org> wrote: > >>>>> > >>>>> On Thu, May 18, 2023 at 11:12:26AM +0800, Huacai Chen wrote: > >>>>>> On Thu, May 18, 2023 at 11:06 AM Leo Yan <leo.yan@linaro.org> wrote: > >>>>>>> > >>>>>>> On Thu, May 18, 2023 at 10:11:27AM +0800, Huacai Chen wrote: > >>>>>>>> Queued, thanks. > >>>>>>> > >>>>>>> The patch is fine for me. > >>>>>>> > >>>>>>> Should not perf patches are to be merged via Arnaldo's tree? > >>>>>> > >>>>>> I think both are OK, if Arnaldo takes this patch, I will drop it. > >>>>> > >>>>> A good practice is to firstly inquiry the maintainers. > >>>>> > >>>>> AFAIK, Arnaldo will test perf patches before sending out pull request; > >>>>> if perf patches are scattered out, it might be out of the testing > >>>>> radar. > >>>> OK, I know, thank you very much. > >>> > >>> You are welcome! > >>> > >>> I found the code base for bfd: > >>> https://github.com/bminor/binutils-gdb/blob/master/bfd/elfnn-loongarch.c > >>> > >>> And this patch is consistent with above link, FWIW: > >>> > >>> Reviewed-by: Leo Yan <leo.yan@linaro.org> > >> > >> Thanks, applied. > > I'm very sorry that this patch breaks cross-build. We need some > > additional modification. > > > > diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c > > index 5d409c26a22e..b3dbf6ca99a7 100644 > > --- a/tools/perf/util/symbol-elf.c > > +++ b/tools/perf/util/symbol-elf.c > > @@ -35,6 +35,10 @@ > > #define EM_AARCH64 183 /* ARM 64 bit */ > > #endif > > > > +#ifndef EM_LOONGARCH > > +#define EM_LOONGARCH 258 > > +#endif > > + > > #ifndef ELF32_ST_VISIBILITY > > #define ELF32_ST_VISIBILITY(o) ((o) & 0x03) > > #endif > > > > Then, drop this patch to get an updated version, or let me send an > > incremental patch? > > > > I tested this patch on native LoongArch and x86 system, I did not > hit the build error about undeclared EM_LOONGARCH both on LoongArch > and x86, because EM_LOONGARCH is defined in /usr/include/elf.h > > Here is the x86 system info: > > [root@fedora yangtiezhu]# cat /etc/fedora-release > Fedora release 38 (Thirty Eight) > [root@fedora yangtiezhu]# uname -m > x86_64 > [root@fedora yangtiezhu]# grep -rn -w EM_LOONGARCH /usr/include/ > /usr/include/linux/elf-em.h:54:#define EM_LOONGARCH 258 /* > LoongArch */ > /usr/include/linux/audit.h:442:#define AUDIT_ARCH_LOONGARCH32 > (EM_LOONGARCH|__AUDIT_ARCH_LE) > /usr/include/linux/audit.h:443:#define AUDIT_ARCH_LOONGARCH64 > (EM_LOONGARCH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) > /usr/include/elf.h:361:#define EM_LOONGARCH 258 /* LoongArch */ > [root@fedora yangtiezhu]# rpm -qf /usr/include/elf.h > glibc-headers-x86-2.37-1.fc38.noarch > > If I am missing something, please let me know. Fedora 38 has a very new toolchain, older distribution will meet build errors. Huacai > > Anyway, it is not a bad thing to add the EM_LOONGARCH definition > to avoid the build error on some systems which have no EM_LOONGARCH > in the glibc header. > > Thanks, > Tiezhu > >
On Tue, May 23, 2023 at 09:47:19AM +0800, Huacai Chen wrote: [...] > > > I'm very sorry that this patch breaks cross-build. We need some > > > additional modification. > > > > > > diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c > > > index 5d409c26a22e..b3dbf6ca99a7 100644 > > > --- a/tools/perf/util/symbol-elf.c > > > +++ b/tools/perf/util/symbol-elf.c > > > @@ -35,6 +35,10 @@ > > > #define EM_AARCH64 183 /* ARM 64 bit */ > > > #endif > > > > > > +#ifndef EM_LOONGARCH > > > +#define EM_LOONGARCH 258 > > > +#endif > > > + I confirmed that we must apply this change, otherwise, it will introduce perf building failure on Ubuntu 22.04 (jammy) with my Arm64 machine. Sorry I didn't detect the building failure when reviewed this patch! Thanks, Leo
On 05/23/2023 03:30 PM, Leo Yan wrote: > On Tue, May 23, 2023 at 09:47:19AM +0800, Huacai Chen wrote: > > [...] > >>>> I'm very sorry that this patch breaks cross-build. We need some >>>> additional modification. >>>> >>>> diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c >>>> index 5d409c26a22e..b3dbf6ca99a7 100644 >>>> --- a/tools/perf/util/symbol-elf.c >>>> +++ b/tools/perf/util/symbol-elf.c >>>> @@ -35,6 +35,10 @@ >>>> #define EM_AARCH64 183 /* ARM 64 bit */ >>>> #endif >>>> >>>> +#ifndef EM_LOONGARCH >>>> +#define EM_LOONGARCH 258 >>>> +#endif >>>> + > > I confirmed that we must apply this change, otherwise, it will > introduce perf building failure on Ubuntu 22.04 (jammy) with my Arm64 > machine. > > Sorry I didn't detect the building failure when reviewed this patch! > Sorry for that, EM_LOONGARCH was added in binutils in 2020 [1], and then it was added in glibc in 2022 [2], so it may be not exist on some systems. For now, I do not find the related commit of this patch in any branch of acme/linux.git, so it is better to send v2 to avoid the build error, I will do it as soon as possible. [1] https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=4cf2ad720078 [2] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=2d83247d90c9 Thanks, Tiezhu
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index b2ed9cc..5d409c2 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -411,6 +411,10 @@ static bool get_plt_sizes(struct dso *dso, GElf_Ehdr *ehdr, GElf_Shdr *shdr_plt, *plt_header_size = 32; *plt_entry_size = 16; return true; + case EM_LOONGARCH: + *plt_header_size = 32; + *plt_entry_size = 16; + return true; case EM_SPARC: *plt_header_size = 48; *plt_entry_size = 12;