From nobody Tue Dec 2 01:36:03 2025 Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.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 2CE02207A09 for ; Sun, 23 Nov 2025 02:32:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763865160; cv=none; b=GDEQcUrtYQszieL+8Q4Sq5ji+1j7AEMLZfne9+Q+T+vHNgkcpzIWx0FP7X9+fMPv4Mvif0uHP1AhrooQSWN8vUA3ibZ/aIYDdxn4Xdtu79F5aB74o1rE8657IPdqOzEqqoXEaf83HWZXOG3hWTTkDREP5+ZQ7Y9cjjlAAfP0eDA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763865160; c=relaxed/simple; bh=7PuQ+2QfZxjWPqMiWzFq8W4TadqStCpGBbZ5HXyMZoo=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=G6spaqdWlriYYWGWh9DLK8U6RIR/yjLHaBKJXR4QFq3EFTO5sBeSiONWzpfzn76y8IL54DXRUP/noEIM2cszZeBmb1hf3SbpW14i5Um+3yZ4NW4I13WnejRbNb08oGW7ZkOZvpq8Wr14lkNe0WalsWvZodzGtdCv6QExTe8lVK0= 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=auI7rHlj; arc=none smtp.client-ip=209.85.215.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="auI7rHlj" Received: by mail-pg1-f202.google.com with SMTP id 41be03b00d2f7-b9b9e8b0812so6182573a12.0 for ; Sat, 22 Nov 2025 18:32:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1763865158; x=1764469958; 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=O3SPglcuk3Z0Bx6JNwPMJEe2HFAseXrWXU/S0ehemlo=; b=auI7rHlj9Ia0YI223PoAV9SeqRbbXD4GhubKScfpPGfe97CKB+iESLzoCaFWV4gzV/ k58ocy/VMDHTF9aruYIyA+o5L/0kjOuvCEGH1u1/JEFhNGUP0etIVNi50jC8jzKl++UI gUjtC/0f/TllrnwDxNbqw97niCD2/9r+9Jze4Qg+LkFt4TkMqcopempnR/IRrxsD493E sHZA4h5OPd7epJvcgPrSPZ0S8xq/ScENFtxQAIUcKMB5YdLg0SR/R1mbBqMHU1/AujjS I9cnyipF1NqSwGYYkgBjRIxaNiOQEdyx6XQnptk3IT8CbacCoLtX9Dl+jly7lcm6kpfG nzBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763865158; x=1764469958; 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=O3SPglcuk3Z0Bx6JNwPMJEe2HFAseXrWXU/S0ehemlo=; b=prziMjKlCxcIYcMjVFZDKqkojdbsoG8HDQ6OQ3fL+VhUr85bLvfNzk6Btyws5FEr4c OXKoft0nNMtpGy5+2zdUumfWRCUjo9l6xkhFZSo0NI4Jz/gaNP0/qqZil81qVp4O6KeH cxG6qSiS/tpr4wnQwQX/dqfwnFOPBMGuwQX8SqpKgOL45k6AC995ob51PM/iMGj1LWfN gE+u7FS8A+Pps5psEz2igRDHQwNx8ZJxQ1ioL0cuP3VIbimWSRMGsQhjmSdHBOX32q+v yTS4ug1Aom4Yu+PZXaDuZwPd7LmLYC2dZIUWhnBpmvUltHWdsrYvT413Iun5mfWG4o76 3Ugw== X-Forwarded-Encrypted: i=1; AJvYcCX26idVjOjd0wzzC48kNBL6bSI9Q4o4RuDKMC+2HRKTzAgeqaH5QBujpwzTYialE9YuovnyHX6oeGDH8s0=@vger.kernel.org X-Gm-Message-State: AOJu0Yww/wvZ28VKyroaDc5WnRNlw6OzwIyNjnvsCPpe3mCDoT4+NkX8 b12qOFHp62ZO41+T94oKxeWSrf7RsaffwBLB2WonU0qL2fj3yGdBZ4LbWdkyV5gHS/Nwc0+Irkv bq3HKyKmRmw== X-Google-Smtp-Source: AGHT+IHpnscFt0RbrixTCI6wfRaiIvfhemxe2TZOMx4yN/HHuYTJZo/qUbwepJRnIOjTYXKPTGPuVzfgMBsW X-Received: from dlnn37.prod.google.com ([2002:a05:7022:61a5:b0:11a:2020:acaf]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7023:c085:b0:119:e56c:18b3 with SMTP id a92af1059eb24-11c9d8480b1mr3697387c88.27.1763865158103; Sat, 22 Nov 2025 18:32:38 -0800 (PST) Date: Sat, 22 Nov 2025 18:32:21 -0800 In-Reply-To: <20251123023225.8069-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: <20251123023225.8069-1-irogers@google.com> X-Mailer: git-send-email 2.52.0.rc2.455.g230fcf2819-goog Message-ID: <20251123023225.8069-6-irogers@google.com> Subject: [PATCH v1 5/9] 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 , Aditya Bodkhe , 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 8b31d1d05f90..2459656b01ac 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 e300f171d1bd..5b5149516f1a 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 cc26b7bf302b..638015651547 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 42d8e3fd1d01..d37d5a97bc6f 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.rc2.455.g230fcf2819-goog