From patchwork Tue Jun 27 06:32:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 113257 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7994760vqr; Mon, 26 Jun 2023 23:52:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ67YCK3hP22SrIOjItiF0qaPTPVKSaq7klnL/nzzZDmYv5NHem6yJsbE/xe3oGsMSUTJfg6 X-Received: by 2002:a17:907:970f:b0:990:27e2:7f81 with SMTP id jg15-20020a170907970f00b0099027e27f81mr5748151ejc.31.1687848759962; Mon, 26 Jun 2023 23:52:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687848759; cv=none; d=google.com; s=arc-20160816; b=r3DWihIu3DbjzoxvRk/R8LqXaHadjxFxoQlke/E2cvIOKkMC9U0bjlB/JhVT+7HVoo BO3l6pNn2nfpyXmC/clgUhU7Jtm4I4TRjEzahm0vTFI8ZhXlnDniaqvMDTSf95o0ZJTx LC7OqnBqy68S/dkavurG7cV6JCtdDBhCmaVfGTG0JgToFgm63faYMZgzM9/eLOhuNi/z u0rOhBriGsT82UkGgWXUfHqlAoei8merB7Q2s2Gb1O/5mvI/oSUz3B0XD9+whSQrIZFg rXFhqGSDpa9ZDBAYv6ILK3m/aSzOOQs4T7tiuI4Txw+jT5RmkKRyTHwgQwDTlxwiu4is eWqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=ehmbUEpgbaPxTlOJARi3abmL78zdkNcEfVy/qADnbcM=; fh=/TViaxNXj9Ubl1KVZseJCqJutBKG0dvzf3DPkf/1G64=; b=gct1/4ly2S2FpJJXVQ/qoG8wYO4Wp/nkmisSEEFTjjhWzOcYs5tIWyJyr7AO1nAEFR tIJ3pXcqZjmGpHZ47FgNjX6+aisabLBDfcOxQzCfdjEEhUylfS8ZZHlmTu/YXZIgLx/k EeKb8wOuXz6efgvyJAbma8mp0AuxRBO/W/dknANGOU9L84Vaoy0j+iVme8kB6Tl1UCMS DhAc5w8SsyNeKZHFx6R5JkIauigfPHbjKbuGF9jcTs7Oo8E5MlhmwBli3B7vc2V+0CaW rriFkYFLAVNgcZKqBr8SQ7DgmHYoHZUu3y3upMm9wv37NtkelSf3tAxCDqlttYQmjHch TMHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=AToRD3yk; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f21-20020a170906561500b00989623654bbsi3916075ejq.363.2023.06.26.23.52.15; Mon, 26 Jun 2023 23:52:39 -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=@gmail.com header.s=20221208 header.b=AToRD3yk; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230268AbjF0GdE (ORCPT + 99 others); Tue, 27 Jun 2023 02:33:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229742AbjF0GdB (ORCPT ); Tue, 27 Jun 2023 02:33:01 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6612E5A; Mon, 26 Jun 2023 23:33:00 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-668704a5b5bso3833160b3a.0; Mon, 26 Jun 2023 23:33:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687847580; x=1690439580; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:from:to:cc:subject:date:message-id:reply-to; bh=ehmbUEpgbaPxTlOJARi3abmL78zdkNcEfVy/qADnbcM=; b=AToRD3ykPoY/AN8fvJ/dx+eeMxKOReHuGXxTSshorr42HPQAI8EZr/j6cnARnBZeEG jdqcI6BeazSy8KnVxwdKKr/AmGORy1wc/BkPoIqMR0fE7I6aNUXAnhGJ9CS5jzj6eBLi pXjxSMHi4RBBZAv+BPXAE/delZ/R1cdfazYcUMw0PjlK17A5aon+9nfZObsWb3LsiLbo 5NkFziYZlOOtrmgjIyZElABW10i3uHuhvff4gw7hL7nkH1jOSBiB6Vbi0bK6CoDMYhmT nH7zJ4DBa6Iba44XxWeFcm7C1Y74kmwLRDuu3q2tPtZNqoa8JsQdVjqLAMpaLeym2Z5A LMYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687847580; x=1690439580; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ehmbUEpgbaPxTlOJARi3abmL78zdkNcEfVy/qADnbcM=; b=Hiv85xlfedM15IQtqggUWVOPwjjk2TV3M0tOVfjFlLn5Mx3IWQZ8uXBmIp9PhXv2AH VZecFPmc5Qoou6vmsJ1T+e9rDoHNaz54/q+yrhIauzcSkLn31kEgE6GrNzOW3fiQSr04 fR6pzacvMq+Lr4i93UUA+/4+TDqWVtoE5t8KWK5xCt8FzHcLocxzW2Ens8vo4abxb5hs mejHoBMWeJir4OzKmNmcouHSkV2nK/FHJ5nSSCT2lNuCd/yx2AG/unQJpe8rR2vYQoAf osqhdH3S4bvWXNpvssUlVTg3DLYlL18xEASG475xQy/qZ1pFF3Xqj7L8++GtZeq+S0pK Fw1w== X-Gm-Message-State: AC+VfDzujk99UXTaD/R9qjqb6bXW8iZbdTldJuAxP7y3z1n4IliYM8iK 9tgPj9jZmAMhTPwffggmIWc= X-Received: by 2002:a05:6a20:748d:b0:126:92de:b893 with SMTP id p13-20020a056a20748d00b0012692deb893mr9777862pzd.31.1687847580168; Mon, 26 Jun 2023 23:33:00 -0700 (PDT) Received: from moohyul.svl.corp.google.com ([2620:15c:2a3:200:1663:6fac:d111:59cf]) by smtp.gmail.com with ESMTPSA id d25-20020aa78159000000b0064378c52398sm4709694pfn.25.2023.06.26.23.32.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 23:32:59 -0700 (PDT) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ian Rogers , Adrian Hunter , Peter Zijlstra , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org Subject: [PATCH] perf test: Fix a compile error on pe-file-parsing.c Date: Mon, 26 Jun 2023 23:32:57 -0700 Message-ID: <20230627063257.549005-1-namhyung@kernel.org> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog MIME-Version: 1.0 X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769837701287273472?= X-GMAIL-MSGID: =?utf-8?q?1769837701287273472?= The dso__find_symbol_by_name() should be have idx pointer argument. Found during the build-test. $ make build-test ... CC /tmp/tmp.6JwPK1xbWG/tests/pe-file-parsing.o tests/pe-file-parsing.c: In function ‘run_dir’: tests/pe-file-parsing.c:64:15: error: too few arguments to function ‘dso__find_symbol_by_name’ 64 | sym = dso__find_symbol_by_name(dso, "main"); | ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from tests/pe-file-parsing.c:16: /usr/local/google/home/namhyung/project/linux/tools/perf/util/symbol.h:135:16: note: declared here 135 | struct symbol *dso__find_symbol_by_name(struct dso *dso, const char *name, size_t *idx); | ^~~~~~~~~~~~~~~~~~~~~~~~ Fixes: 259dce914e93 ("perf symbol: Remove symbol_name_rb_node") Signed-off-by: Namhyung Kim Acked-by: Ian Rogers --- tools/perf/Makefile.config | 13 ++++++++++--- tools/perf/tests/pe-file-parsing.c | 3 ++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 78411252b72a..0609c19caabd 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -315,6 +315,9 @@ FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS) FEATURE_CHECK_LDFLAGS-libaio = -lrt +FEATURE_CHECK_LDFLAGS-disassembler-four-args = -lbfd -lopcodes -ldl +FEATURE_CHECK_LDFLAGS-disassembler-init-styled = -lbfd -lopcodes -ldl + CORE_CFLAGS += -fno-omit-frame-pointer CORE_CFLAGS += -ggdb3 CORE_CFLAGS += -funwind-tables @@ -344,8 +347,8 @@ ifneq ($(TCMALLOC),) endif ifeq ($(FEATURES_DUMP),) -# We will display at the end of this Makefile.config, using $(call feature_display_entries), -# as we may retry some feature detection here. +# We will display at the end of this Makefile.config, using $(call feature_display_entries) +# As we may retry some feature detection here, see the disassembler-four-args case, for instance FEATURE_DISPLAY_DEFERRED := 1 include $(srctree)/tools/build/Makefile.feature else @@ -907,9 +910,13 @@ ifdef BUILD_NONDISTRO ifeq ($(feature-libbfd-liberty), 1) EXTLIBS += -lbfd -lopcodes -liberty + FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -ldl + FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -ldl else ifeq ($(feature-libbfd-liberty-z), 1) EXTLIBS += -lbfd -lopcodes -liberty -lz + FEATURE_CHECK_LDFLAGS-disassembler-four-args += -liberty -lz -ldl + FEATURE_CHECK_LDFLAGS-disassembler-init-styled += -liberty -lz -ldl endif endif $(call feature_check,disassembler-four-args) @@ -1333,6 +1340,6 @@ endif # re-generate FEATURE-DUMP as we may have called feature_check, found out # extra libraries to add to LDFLAGS of some other test and then redo those -# tests. +# tests, see the block about libbfd, disassembler-four-args, for instance. $(shell rm -f $(FEATURE_DUMP_FILENAME)) $(foreach feat,$(FEATURE_TESTS),$(shell echo "$(call feature_assign,$(feat))" >> $(FEATURE_DUMP_FILENAME))) diff --git a/tools/perf/tests/pe-file-parsing.c b/tools/perf/tests/pe-file-parsing.c index c09a9fae1689..fff58b220c07 100644 --- a/tools/perf/tests/pe-file-parsing.c +++ b/tools/perf/tests/pe-file-parsing.c @@ -34,6 +34,7 @@ static int run_dir(const char *d) struct dso *dso; struct symbol *sym; int ret; + size_t idx; scnprintf(filename, PATH_MAX, "%s/pe-file.exe", d); ret = filename__read_build_id(filename, &bid); @@ -61,7 +62,7 @@ static int run_dir(const char *d) TEST_ASSERT_VAL("Failed to load symbols", ret == 0); dso__sort_by_name(dso); - sym = dso__find_symbol_by_name(dso, "main"); + sym = dso__find_symbol_by_name(dso, "main", &idx); TEST_ASSERT_VAL("Failed to find main", sym); dso__delete(dso);