Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4810856imu; Tue, 15 Jan 2019 06:26:25 -0800 (PST) X-Google-Smtp-Source: ALg8bN4cgey6nwI993LH7aLSjZd3qDEL2lpZT7KedNncvpbU8MiWYSqx5QPSuKEHvSfE3/Lodg6K X-Received: by 2002:a63:8c6:: with SMTP id 189mr4121741pgi.322.1547562385372; Tue, 15 Jan 2019 06:26:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547562385; cv=none; d=google.com; s=arc-20160816; b=CZX80ObQvAjr7MMfRRWzSC/amTh6ZjUw6Q+RshIXqoU50R/2LRf+78YR8KLtLr308B pZBx0BoevG+Vl0ySd9BbwvcVUOmI2MdWURvDWyPPSeblDwSLLfrqiM37sVqsKEaRQkc/ v7bZvsB6mLQz6fx6UCWBBdRX3+tRQzfYk2UPmp+gp8tDaPtrSk1pkIvVi+ABbWuwW1WK ur3RrxiaiWbMa1sjhfiPZb4k1bWKwuBnz3xBFyJO9fv27XGJ9E+DnaVDh6AJ5rJjbQvB voQIDYJlac7d+Bwke5yxNq0Un/dFZqoZkYcW8MbxhEriifIG6Aa1frX/qctRePYSChiC fr5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=2AlSUvYdS/83PQyZXReO1sCvoobWgyi1LTtVw903JhQ=; b=UGojklQc17W5x9LhjMXqKQeiCBEEuE9rn440/WYzAHKltbCH9Q7ll/70mg8+Z8p04A 36rn2YPNd+Jlbp5fi63TvpNFFCOYKR+F0n3d0lXNFQWDwyJEZBW49heg/UC9LMksMA7W TTwA2Mul5SMRjhFIIjL1X3W/i30ZIWt9EXaVyqOAip9lvqp33LLxzmwpwQ39mrUtdr/w YR+3Lf1B4DDi9VSbeDWbRY0KzQ6Jdh9m4GxoLceExsiiST2tBRNOo2NakjfF15osPpAI yvGKVzFp2bgVHWlwDf2vm443S7PxUKTUzc0dWOy7uUURSDj+Qg+NiIlUftQCqjwK7Atc ZE4A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j28si3344194pgm.160.2019.01.15.06.26.09; Tue, 15 Jan 2019 06:26:25 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729906AbfAONx6 (ORCPT + 99 others); Tue, 15 Jan 2019 08:53:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43818 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729204AbfAONx6 (ORCPT ); Tue, 15 Jan 2019 08:53:58 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B144D7F6B0; Tue, 15 Jan 2019 13:53:57 +0000 (UTC) Received: from krava.brq.redhat.com (unknown [10.43.17.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id 55BDB100194B; Tue, 15 Jan 2019 13:53:55 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , Nick Clifton , Masami Hiramatsu Subject: [RFC] perf tools: Filter out hidden symbols from labels Date: Tue, 15 Jan 2019 14:53:54 +0100 Message-Id: <20190115135354.11572-1-jolsa@kernel.org> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 15 Jan 2019 13:53:57 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org hi, sending this as RFC, because I'm not sure this won't break something else ;-) thanks, jirka --- When perf is built with 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 dwarf unwind test on ppc arch, where they are mixed with checked symbols and 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 visibility and filter out such symbols. Link: http://lkml.kernel.org/n/tip-4yuna6qhhg0df3q147cjdyuu@git.kernel.org Signed-off-by: Jiri Olsa --- tools/perf/util/symbol-elf.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 66a84d5846c8..39ef2bde6d6d 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -87,6 +87,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 @@ -111,7 +116,8 @@ 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; } static bool elf_sym__filter(GElf_Sym *sym) -- 2.17.2