From nobody Tue Dec 2 01:06:34 2025 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8BEBD277C86 for ; Mon, 1 Dec 2025 20:55:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764622544; cv=none; b=PX5WQgsz8E0g2q6H0rErJLxFG7LvdA5H63ZzU8UQHnfmKvyd2n5icbgkuZvoQwoxj0qPrM4OXpSOszDXeU/hbd/v9hUxdwNoOn66NdmkYtEBF5uQyMFK/l/KUUoIL7pZAixGWvKkzfFOoWUemWs4kT8sn36iTQOWFNsrUb8Z+Qw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764622544; c=relaxed/simple; bh=/HQYxPyULLvORGSXVTG3Vsicqzs81N227w3aDCmJViU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=Ure2d3Xwnlz0K9UZX3AttV5jSI8g2kC4DY8Oov9citj+wtE282PdK719QchjR2Uvfq8OIYBnIAdZ+Mf25fjViNC7QvCSJBOyb1Nq5f9YgxJf7UeQL8Oyr8CZB1JEaZBWU9nvftf7sBpZ8HngiZ5ZB+Ej9b1rNxLNc45zOB77q9o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=0R8R8Wjt; arc=none smtp.client-ip=209.85.214.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="0R8R8Wjt" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-2958a134514so62139765ad.2 for ; Mon, 01 Dec 2025 12:55:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1764622542; x=1765227342; darn=vger.kernel.org; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=nqxG4c4Ejh1cwsCwJj6cVtGyxfElTSuoVo6DlnxDj58=; b=0R8R8WjtsORCzY+mx/L8snPNBZubAOhcZA7Xlco9CWtz9piW33s+gUqltKxh5fbpy8 uqbVv4EwZtjx+bROroI339a4zCNQbWn6NZMbc81i1PK62XB4dRPsRyXgN3l/g4Bjcrdp AHVFs1TVutz8YNERrKzRmdFPCBdbnVZ2/tVqmEERrItJqr+VnVniiBYGY40wdSac6Gub EnKcgi7uZk+QKoZcCXX2XGSVR8XOOqq0roqKrAal47yqXXvXkx7/ybXPVVJlMrPwEKiR ZqMUcbbvGl6Fg2qRhss+84rbRpeBNQlPGTQ+48uFJ9TG43nt7Ln4Cp9nLg3zeZ59c2QR okRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764622542; x=1765227342; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nqxG4c4Ejh1cwsCwJj6cVtGyxfElTSuoVo6DlnxDj58=; b=I9b737rvNY9fwoMvUPtl2ehvRqu01lJL7T+aMx8ohQQFX+3C+egsIEvXEtzToFkeGe ZtqctKJfV+ehBACOLNTcLunml66byIMyAwwkkRRStLB9glAg6kBZHKSLn05KYv1PUGWY x0K1jySpLpSxovYOS/vIjCbhCm9KgZvArON1N1kXTaSD+8VAr+lZI6WCWfgP+sEUia8O uDvpwqRORX+2E50hrRyCwe9KvZDF8YF3+WGrmNU11goKP4vmQZzX2RqgaJcqUrSUJihn XrSh9TebYEBWGC0h0Sacw9M/CyE/7d2+IZvZr31zTZl4LqqwrM5BKNZkTGhNJo0/KDbE 3SlA== X-Forwarded-Encrypted: i=1; AJvYcCVPjdSuRGY6yz3O28oUUgpKmP0rKvxw5+JS2s5EYObbqP0r45oGtZW9OO3OO3NvotV3yoE/p1LoRhdSvl0=@vger.kernel.org X-Gm-Message-State: AOJu0YwZ8QWfJReKgmxx/OH7WLU7SMHo1DzM3Cs7lnVTDLC7ttKu5QNw xQsTE/Zm/io8LpiZlXvQljUu/tAxe/KMzcuK9w/t1R2OQkUSYHvSU6Yom3zVE0AEgYf3Yc+Ac0t fKQRRhykRIA== X-Google-Smtp-Source: AGHT+IHxPPg1nZrMrBc6g6s28MBG/8AEGZ8L7TvRjMLuUaeyN2ppmycAcDPmZoMx3Y71gdUm1zTzeLbZv/AJ X-Received: from dlbqy10.prod.google.com ([2002:a05:7022:ef0a:b0:119:78ff:fe16]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:4186:b0:119:e55a:9bf8 with SMTP id a92af1059eb24-11cb3ef2761mr19885364c88.20.1764622541626; Mon, 01 Dec 2025 12:55:41 -0800 (PST) Date: Mon, 1 Dec 2025 12:55:04 -0800 In-Reply-To: <20251201205509.195451-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251201205509.195451-1-irogers@google.com> X-Mailer: git-send-email 2.52.0.158.g65b55ccf14-goog Message-ID: <20251201205509.195451-6-irogers@google.com> Subject: [PATCH v2 05/10] perf symbol: Move dso__load_bfd_symbols out of symbol.h From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Suzuki K Poulose , Mike Leach , James Clark , John Garry , Will Deacon , Leo Yan , Athira Rajeev , tanze , Stephen Brennan , Andi Kleen , Chun-Tse Shao , Thomas Falcon , Dapeng Mi , "Dr. David Alan Gilbert" , Christophe Leroy , "=?UTF-8?q?Krzysztof=20=C5=81opatowski?=" , "Masami Hiramatsu (Google)" , Alexandre Ghiti , Haibo Xu , Sergei Trofimovich , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Move into libbfd.h where the code is and to make it clear that symbol.h and symbol.c are generic code. Add libbfd.h to symbol.c includes and organize the includes. Signed-off-by: Ian Rogers --- tools/perf/tests/pe-file-parsing.c | 5 ++-- tools/perf/util/libbfd.h | 7 ++++++ tools/perf/util/symbol.c | 38 +++++++++++++++++------------- tools/perf/util/symbol.h | 4 ---- 4 files changed, 31 insertions(+), 23 deletions(-) diff --git a/tools/perf/tests/pe-file-parsing.c b/tools/perf/tests/pe-file-= parsing.c index 30c7da79e109..e97c7662664e 100644 --- a/tools/perf/tests/pe-file-parsing.c +++ b/tools/perf/tests/pe-file-parsing.c @@ -11,10 +11,11 @@ #include #include =20 -#include "debug.h" #include "util/build-id.h" -#include "util/symbol.h" +#include "util/debug.h" #include "util/dso.h" +#include "util/libbfd.h" +#include "util/symbol.h" =20 #include "tests.h" =20 diff --git a/tools/perf/util/libbfd.h b/tools/perf/util/libbfd.h index 953886f3d62f..086c5f12cc34 100644 --- a/tools/perf/util/libbfd.h +++ b/tools/perf/util/libbfd.h @@ -21,6 +21,7 @@ int libbfd__addr2line(const char *dso_name, u64 addr, =20 =20 void dso__free_a2l_libbfd(struct dso *dso); +int dso__load_bfd_symbols(struct dso *dso, const char *debugfile); =20 int symbol__disassemble_libbfd(const char *filename, struct symbol *sym, struct annotate_args *args); @@ -51,6 +52,12 @@ static inline void dso__free_a2l_libbfd(struct dso *dso = __always_unused) { } =20 +static inline int dso__load_bfd_symbols(struct dso *dso __always_unused, + const char *debugfile __always_unused) +{ + return -1; +} + static inline int symbol__disassemble_libbfd(const char *filename __always= _unused, struct symbol *sym __always_unused, struct annotate_args *args __always_unused) diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index d8fc5ea77f84..f8c6a37464ca 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -1,47 +1,51 @@ // SPDX-License-Identifier: GPL-2.0 #include #include -#include +#include +#include #include +#include #include -#include -#include -#include -#include -#include -#include -#include #include -#include +#include +#include #include -#include + #include "annotate.h" #include "build-id.h" #include "cap.h" #include "cpumap.h" #include "debug.h" +#include "debug.h" #include "demangle-cxx.h" #include "demangle-java.h" #include "demangle-ocaml.h" #include "demangle-rust-v0.h" #include "dso.h" -#include "util.h" // lsdir() -#include "debug.h" #include "event.h" +#include "header.h" +#include "intlist.h" +#include "libbfd.h" #include "machine.h" #include "map.h" -#include "symbol.h" #include "map_symbol.h" #include "mem-events.h" #include "mem-info.h" -#include "symsrc.h" -#include "strlist.h" -#include "intlist.h" #include "namespaces.h" -#include "header.h" #include "path.h" +#include "perf-libelf.h" +#include "strlist.h" +#include "symbol.h" +#include "symsrc.h" +#include "util.h" // lsdir() + +#include #include +#include #include +#include +#include +#include #include =20 #include diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index 2b2bbb5914b9..e265e1f028be 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h @@ -153,10 +153,6 @@ int symbol__config_symfs(const struct option *opt __ma= ybe_unused, =20 struct symsrc; =20 -#ifdef HAVE_LIBBFD_SUPPORT -int dso__load_bfd_symbols(struct dso *dso, const char *debugfile); -#endif - int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss, struct symsrc *runtime_ss, int kmodule); int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss); --=20 2.52.0.158.g65b55ccf14-goog