From patchwork Tue May 23 09:57:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiezhu Yang X-Patchwork-Id: 97952 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2032974vqo; Tue, 23 May 2023 03:27:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5hgJ5DCGxlNIaC+YKYAmq38Q1cG4EvV241GsNOC06+HBoYe/SzMkGEPv85plftqyp1nY5x X-Received: by 2002:a05:6a20:4282:b0:10c:1a3d:6b9c with SMTP id o2-20020a056a20428200b0010c1a3d6b9cmr4579337pzj.21.1684837642807; Tue, 23 May 2023 03:27:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684837642; cv=none; d=google.com; s=arc-20160816; b=vrtDtyyFIKInlsW3/NuxitxVlcAJuLKS1Mv7QAe/ZvvT9Z8FEkQud/LlJa8mPmfxoQ psX0xjq5ygHbd0F+Po2i07TTcSFW/36e43vK5DTGzhXzrPGqOa6Pf8Xs6jmVhKfwH77s HFPTJ35h3WB2dKc/Sh/yJoqHlB7SYX/nE9c8giD+mBlkpu+C1pNVTFYteAwGZCSqRGU9 kJ6Fqw45RtFuChM0xjVkXroIMLIAMr4TJreOmYurQdXIe5euKsPHxg3p3WU1t37w3oAL BFd2XluxEOzknf8cw9TB3V7WarvuAETydVhxWPdgWPEDkIv6OPJarXrjapaxbR1Bmm4p A5Yw== 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=Pg3NQ+HwTaA7CpwAGkME3DveXd75Q+rp65WwBtT0ihQ=; b=xSWIgy4mzNdcf98gcgMrxfh5VZCerOg84Rt5Flfns/fkyYVli3wgvYt8C3GxlIoDxp urPAYRZmdAM5tdZURkdNiKcF5KFM3HmGj63ZI7s+JtVgB+XgsgNs8luzOTc5OiKK8CKU MhvAx8/eiDVUGyNLdIwWMFH0E6DLuOllWPakH0KUZ/vBMv4RE5hjZp9XxjrETZYFogns OH2aTL9Llkxlc+JAZzGTdjKVgReXq1DOZGrbdi2FlPhGTH21hfut2qI2aT7cpQTu/wcL ObTuqOV9usJSqBFec2CIciI8s4bocl6bL2AngSCc9VcxH56SXG703cxGwqYCL6X+5rxg Yb3A== 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 s12-20020a63b40c000000b004fbe5ede659si4649573pgf.317.2023.05.23.03.27.08; Tue, 23 May 2023 03:27:22 -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 S236398AbjEWJ6E (ORCPT + 99 others); Tue, 23 May 2023 05:58:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236267AbjEWJ56 (ORCPT ); Tue, 23 May 2023 05:57:58 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 822EC94; Tue, 23 May 2023 02:57:55 -0700 (PDT) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8CxqPEijmxkHwYAAA--.94S3; Tue, 23 May 2023 17:57:54 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Dx_7MhjmxkvhxwAA--.56731S2; Tue, 23 May 2023 17:57:54 +0800 (CST) From: Tiezhu Yang To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter Cc: Leo Yan , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, loongson-kernel@lists.loongnix.cn Subject: [PATCH v2] perf symbol: Add LoongArch case in get_plt_sizes() Date: Tue, 23 May 2023 17:57:53 +0800 Message-Id: <1684835873-15956-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: AQAAf8Dx_7MhjmxkvhxwAA--.56731S2 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBjvJXoW7WF4fJFy7Cr4fKw4UWFy8Zrb_yoW8Gry5pw nxuFW8K3WDtFnxG3WrJF4rXF4fWFsavFy2gFy3XrWv9Fs7uw10grWxAFyY9FWUXFykXa40 vr1qk3yxuF10qr7anT9S1TB71UUUUbJqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU bSkYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_Jrv_JF1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW5JVW7JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVWxJVW8Jr1l84 ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AKxVW8Jr0_Cr1U M2kKe7AKxVWUtVW8ZwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07AIYIkI8VC2zV CFFI0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUtVWrXwAv7VC2 z280aVAFwI0_Gr0_Cr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JMxkF7I 0En4kS14v26r1q6r43MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMxCI bckI1I0E14v26r1q6r43MI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_Jr I_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v2 6r4j6ryUMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj4 0_Jr0_JF4lIxAIcVC2z280aVAFwI0_Gr0_Cr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8 JrUvcSsGvfC2KfnxnUUI43ZEXa7IU0L0ePUUUUU== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765399527799231857?= X-GMAIL-MSGID: =?utf-8?q?1766680316583456522?= 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 Acked-by: Huacai Chen --- v2: Add EM_LOONGARCH definition to avoid build error tools/perf/util/symbol-elf.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index b2ed9cc..b3dbf6c 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 @@ -411,6 +415,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;