Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp605265imj; Sat, 9 Feb 2019 04:24:58 -0800 (PST) X-Google-Smtp-Source: AHgI3IbBmLlh+t2JwNpwbI0oOVNbj2F4q5sZSN0fvz+Yh+Dd5gBdwI5EWsd0KQnAePGgivKOVMD9 X-Received: by 2002:a63:5e43:: with SMTP id s64mr25323705pgb.101.1549715098253; Sat, 09 Feb 2019 04:24:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549715098; cv=none; d=google.com; s=arc-20160816; b=drBgMIfABM/Mjhl5wE/LeEK3EJMgKOcuaZGM8Ba+9U1+j7vpsQKEnMHMuJTNNV6Fw2 wdhXeQsLk7OUZ+Mo7ltAJeUJSn4qJdf3bfaWH3dsRmOPRmYFb1mGo0M5cDGfqGHx1lQr t+FSl9m+Iu0C5oInLHQ5rOdVze6TZgQVCmmb9ueOFu+xoF/x3cPnbQ38ItWCwCViM5Ks tZx5mTTr9N7bjS5ZkprEt8DLrxV82m+mK7Y+SRU80BUfP1Mmo3cd67ToOboNvWeTUJr2 8WFlRGFavVqyLM4ZWenQmGk8aeRGiFn0ZRSz47L7XsuauEP2s74xdlmbpddnhYuNk3hu 4atA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date; bh=4An0dYV62M4uFQic9Jj/xgfglhADubZ0u5v7zFqJUbU=; b=XA84+28negjZ+3OVyyvq6ntQN2+5l3giHwJoQ229Ah2Ce2gUs6b5d40ryI4h/LtNV7 8LJW8UwLiCnYbq5Gy3Mm7S7V2/QjVXIEly1nh8iUdrxCNSy5AKvJtwlCWY0EiykNBTLb Faxjlo0rzGA0QeBwbW94YaxfYuE9x5aJMgSINYdhwJ0kOBYsIKhZNPo8Xg8WhkhuXdfu YIPeyPjtCKAAbAUUtqCYhP+zBbVvE0FwOyNF23MC5PIvsIx0J/RsAM23uiDR0iphCFmc 39tcHpjq4tKr67tPet/CxtfOrHEM8oLk2tUOBFfYruh8qKQtK+7QyZLcYRO3dIC1TE5t KdmQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y24si2404677pgf.555.2019.02.09.04.24.42; Sat, 09 Feb 2019 04:24:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726931AbfBIMXK (ORCPT + 99 others); Sat, 9 Feb 2019 07:23:10 -0500 Received: from terminus.zytor.com ([198.137.202.136]:53641 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726703AbfBIMXK (ORCPT ); Sat, 9 Feb 2019 07:23:10 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x19CMveF2624622 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 9 Feb 2019 04:22:57 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x19CMtSg2624619; Sat, 9 Feb 2019 04:22:55 -0800 Date: Sat, 9 Feb 2019 04:22:55 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Jiri Olsa Message-ID: Cc: alexander.shishkin@linux.intel.com, mhiramat@kernel.org, jolsa@redhat.com, mingo@kernel.org, peterz@infradead.org, linux-kernel@vger.kernel.org, nickc@redhat.com, tglx@linutronix.de, namhyung@kernel.org, acme@redhat.com, jolsa@kernel.org, hpa@zytor.com, mpetlan@redhat.com Reply-To: alexander.shishkin@linux.intel.com, mhiramat@kernel.org, nickc@redhat.com, linux-kernel@vger.kernel.org, peterz@infradead.org, mingo@kernel.org, jolsa@redhat.com, hpa@zytor.com, acme@redhat.com, jolsa@kernel.org, namhyung@kernel.org, tglx@linutronix.de, mpetlan@redhat.com In-Reply-To: <20190128133526.GD15461@krava> References: <20190128133526.GD15461@krava> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf symbols: Filter out hidden symbols from labels Git-Commit-ID: 59a17706915fe5ea6f711e1f92d4fb706bce07fe X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, T_DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 59a17706915fe5ea6f711e1f92d4fb706bce07fe Gitweb: https://git.kernel.org/tip/59a17706915fe5ea6f711e1f92d4fb706bce07fe Author: Jiri Olsa AuthorDate: Mon, 28 Jan 2019 14:35:26 +0100 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 4 Feb 2019 15:50:38 -0300 perf symbols: Filter out hidden symbols from labels When perf is built with the annobin plugin (RHEL8 build) extra symbols are added to its binary: # nm perf | grep annobin | head -10 0000000000241100 t .annobin_annotate.c 0000000000326490 t .annobin_annotate.c 0000000000249255 t .annobin_annotate.c_end 00000000003283a8 t .annobin_annotate.c_end 00000000001bce18 t .annobin_annotate.c_end.hot 00000000001bce18 t .annobin_annotate.c_end.hot 00000000001bc3e2 t .annobin_annotate.c_end.unlikely 00000000001bc400 t .annobin_annotate.c_end.unlikely 00000000001bce18 t .annobin_annotate.c.hot 00000000001bce18 t .annobin_annotate.c.hot ... Those symbols have no use for report or annotation and should be skipped. Moreover they interfere with the DWARF unwind test on the PPC arch, where they are mixed with checked symbols and then the test fails: # perf test dwarf -v 59: Test dwarf unwind : --- start --- test child forked, pid 8515 unwind: .annobin_dwarf_unwind.c:ip = 0x10dba40dc (0x2740dc) ... got: .annobin_dwarf_unwind.c 0x10dba40dc, expecting test__arch_unwind_sample unwind: failed with 'no error' The annobin symbols are defined as NOTYPE/LOCAL/HIDDEN: # readelf -s ./perf | grep annobin | head -1 40: 00000000001bce4f 0 NOTYPE LOCAL HIDDEN 13 .annobin_init.c They can still pass the check for the label symbol. Adding check for HIDDEN and INTERNAL (as suggested by Nick below) visibility and filter out such symbols. > Just to be awkward, if you are going to ignore STV_HIDDEN > symbols then you should probably also ignore STV_INTERNAL ones > as well... Annobin does not generate them, but you never know, > one day some other tool might create some. Signed-off-by: Jiri Olsa Cc: Alexander Shishkin Cc: Masami Hiramatsu Cc: Michael Petlan Cc: Namhyung Kim Cc: Nick Clifton Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20190128133526.GD15461@krava Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/symbol-elf.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 695a73940329..dca7dfae69ad 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -101,6 +101,11 @@ static inline uint8_t elf_sym__type(const GElf_Sym *sym) return GELF_ST_TYPE(sym->st_info); } +static inline uint8_t elf_sym__visibility(const GElf_Sym *sym) +{ + return GELF_ST_VISIBILITY(sym->st_other); +} + #ifndef STT_GNU_IFUNC #define STT_GNU_IFUNC 10 #endif @@ -125,7 +130,9 @@ static inline int elf_sym__is_label(const GElf_Sym *sym) return elf_sym__type(sym) == STT_NOTYPE && sym->st_name != 0 && sym->st_shndx != SHN_UNDEF && - sym->st_shndx != SHN_ABS; + sym->st_shndx != SHN_ABS && + elf_sym__visibility(sym) != STV_HIDDEN && + elf_sym__visibility(sym) != STV_INTERNAL; } static bool elf_sym__filter(GElf_Sym *sym)