From patchwork Thu Oct 17 00:13:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13839141 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1884DD2F7D8 for ; Thu, 17 Oct 2024 00:41:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:From:Subject :References:Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=VU9D23fFMOa9LXkPnFVSmMuH/zksDMncppJ/JVZzd4k=; b=o+WSZIGUxyiIMW/RQJeLWu8ClL oSSEJh7FlyzFf0w7X7QDwHgMotYw59dXf3hXP+6He75Y4MVK3qOZJTJWxAj1Iu0dnKjN8LCfZRbW5 cdswnrAya8+Do6INzZo2CMxNEulyZxfxqe7aicQaq+2E1Fb3wWTg0Zh5lHgTcyziJrpNTnjd0MH1s CijCFRO/eB2xv9vpvB+PaFifezEn1rkTL9mloc7+dRP3I9lXRyYYiCF2Es/JVl+o1X8uDt8zXPi/Y Kd/K3ZlocfkTIhEM3bH8e6E9P58WEmRGfJ9K7/BlCODGJIs+tEC8Jb2LJFrGVtiL6kxpQAaL0qJT7 H8yVd39A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1EZy-0000000DNIB-1oSZ; Thu, 17 Oct 2024 00:41:26 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1E9n-0000000DIHG-2FO5 for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 00:14:24 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-e2b9f71917bso188052276.0 for ; Wed, 16 Oct 2024 17:14:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124062; x=1729728862; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=VU9D23fFMOa9LXkPnFVSmMuH/zksDMncppJ/JVZzd4k=; b=PPzEaX/GWzmKByzueoTIx8xNgVB8ueYhTL5Xn+0UBKqXvs6DTV3AK0df49xKDI6H9J 7VWbZrE/4vARXytmF2OBjJES5UWEyf/zKsrsn9np+/dBj0+ZOWQ64tZkx7CTLmOU96pF UqQUlwCHByFqyfOe5acdj+YaV6P/9q7a6sO9CWhHSlCYVzB8sEw+eCjQGz4MDqSUGI/4 y+6a2cHKsfx2qgMQsj72JykcZiMCX248ZpUISE56oizuSQajM+BWYyadJ0PchybNTxW/ 7QX2K75cgHTn1cJTRuB/OggS9ZekGrf+jl4k3rSd1EC6LLoY6Rl3vcv3UbcccZT4cDk0 cVZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124062; x=1729728862; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VU9D23fFMOa9LXkPnFVSmMuH/zksDMncppJ/JVZzd4k=; b=tORN4InY7q2UUdPPrd3P9nl6Z4zxU8eN4oFRVooIkH6tmrNtOqCnwjyr9g2L75iejS HSHzgk5qm5DxbvlFQPQacZWr8Zk0OOrmkbTdXYNLHytMwVZOkQtgOVXF5Iad9SQKenhg 0Qw8xqpRl4a7cm7gIa6TkNOm0vv4620CpQ4H5C2s5KdRmaCKXqcSDdEF79igtV0CLA9a kObmtxqpBvLmciZCbJ3sPd1MSbkEqDPxP73TK3HWWbURW7vxUJvLzxwBUDLB7/3e5qPb 6xtTwRMIsVB38ZWMYU6RRTbRFW5rGl2KhsxV0hdyogihrHGW4lnYgLb54XF1YJyqzEuw TaeQ== X-Forwarded-Encrypted: i=1; AJvYcCVaZHTZJz46ze5FMYkJ++X0DKwv7bmKbPz8EjNpr5MyfMIwl7SxaktA6oFU5PW5qrPVlYAOm0kl6JrdkgUT/6CS@lists.infradead.org X-Gm-Message-State: AOJu0Yy181IUveHknW8hD6WudY5lutXlqqcRd/qYVdF/IUqqbu+7uHQP 8ZCAt2HWQXF2kUwWN83jrBWF2TVj2JGRZemhzWkGQFw6KuK4qu+yTkeXxb1NoI8tG7VzDmQfOt5 edvVMOQ== X-Google-Smtp-Source: AGHT+IFAHdFpfyYHAxh33deC15C0o4iPWMQpiNWeQk6y+OhOBawQMGHjEN4HBQ/OuO3SGFQn1AE+qnHXoGYY X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a05:6902:d47:b0:e29:7587:66d6 with SMTP id 3f1490d57ef6-e2b9ce7583cmr2127276.4.1729124062376; Wed, 16 Oct 2024 17:14:22 -0700 (PDT) Date: Wed, 16 Oct 2024 17:13:51 -0700 In-Reply-To: <20241017001354.56973-1-irogers@google.com> Message-Id: <20241017001354.56973-9-irogers@google.com> Mime-Version: 1.0 References: <20241017001354.56973-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 08/11] perf probe: Move elfutils support check to libdw check From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241016_171423_603647_4F3DB29A X-CRM114-Status: GOOD ( 18.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The test _ELFUTILS_PREREQ(0, 142) is false for elfutils before 2009-06-13, but that is 15 years ago and very unlikely. Add a test to test-libdw.c and assume the libdw version is at least 0.142 to simplify the build logic. Signed-off-by: Ian Rogers --- tools/build/feature/test-libdw.c | 10 +++++++++- tools/perf/util/probe-finder.c | 2 -- tools/perf/util/probe-finder.h | 2 -- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/build/feature/test-libdw.c b/tools/build/feature/test-libdw.c index 71c6f8e3b0ee..2fb59479ab77 100644 --- a/tools/build/feature/test-libdw.c +++ b/tools/build/feature/test-libdw.c @@ -41,8 +41,16 @@ int test_libdw_getcfi(void) return dwarf_getcfi(dwarf) == NULL; } +int test_elfutils(void) +{ + Dwarf_CFI *cfi = NULL; + + dwarf_cfi_end(cfi); + return 0; +} + int main(void) { return test_libdw() + test_libdw_unwind() + test_libdw_getlocations() + - test_libdw_getcfi(); + test_libdw_getcfi() + test_elfutils(); } diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index d6b902899940..b6775d3bdeac 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c @@ -1379,9 +1379,7 @@ int debuginfo__find_trace_events(struct debuginfo *dbg, if (ret >= 0 && tf.pf.skip_empty_arg) ret = fill_empty_trace_arg(pev, tf.tevs, tf.ntevs); -#if _ELFUTILS_PREREQ(0, 142) dwarf_cfi_end(tf.pf.cfi_eh); -#endif if (ret < 0 || tf.ntevs == 0) { for (i = 0; i < tf.ntevs; i++) diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h index 724db829b49e..5ced3b058fd8 100644 --- a/tools/perf/util/probe-finder.h +++ b/tools/perf/util/probe-finder.h @@ -63,12 +63,10 @@ struct probe_finder { struct intlist *lcache; /* Line cache for lazy match */ /* For variable searching */ -#if _ELFUTILS_PREREQ(0, 142) /* Call Frame Information from .eh_frame. Owned by this struct. */ Dwarf_CFI *cfi_eh; /* Call Frame Information from .debug_frame. Not owned. */ Dwarf_CFI *cfi_dbg; -#endif Dwarf_Op *fb_ops; /* Frame base attribute */ unsigned int machine; /* Target machine arch */ struct perf_probe_arg *pvar; /* Current target variable */