From: Ian Rogers <irogers@google.com>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
James Clark <james.clark@linaro.org>,
Eric Biggers <ebiggers@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Stephen Brennan <stephen.s.brennan@oracle.com>,
Haibo Xu <haibo1.xu@intel.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org
Subject: [PATCH v1 1/5] perf symbol: Reduce scope of elf__needs_adjust_symbols
Date: Sat, 7 Feb 2026 00:24:24 -0800 [thread overview]
Message-ID: <20260207082428.1742209-2-irogers@google.com> (raw)
In-Reply-To: <20260207082428.1742209-1-irogers@google.com>
Function is only used by symsrc__init in symbol-elf.c, make static to
reduce scope. Switch to not passing the argument by value but as a
pointer.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/util/symbol-elf.c | 8 ++++----
tools/perf/util/symbol.h | 1 -
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 76912c62b6a0..d7582dbf379e 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -1054,15 +1054,15 @@ void symsrc__destroy(struct symsrc *ss)
close(ss->fd);
}
-bool elf__needs_adjust_symbols(GElf_Ehdr ehdr)
+static bool elf__needs_adjust_symbols(const GElf_Ehdr *ehdr)
{
/*
* Usually vmlinux is an ELF file with type ET_EXEC for most
* architectures; except Arm64 kernel is linked with option
* '-share', so need to check type ET_DYN.
*/
- return ehdr.e_type == ET_EXEC || ehdr.e_type == ET_REL ||
- ehdr.e_type == ET_DYN;
+ return ehdr->e_type == ET_EXEC || ehdr->e_type == ET_REL ||
+ ehdr->e_type == ET_DYN;
}
static Elf *read_gnu_debugdata(struct dso *dso, Elf *elf, const char *name, int *fd_ret)
@@ -1235,7 +1235,7 @@ int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name,
if (dso__kernel(dso) == DSO_SPACE__USER)
ss->adjust_symbols = true;
else
- ss->adjust_symbols = elf__needs_adjust_symbols(ehdr);
+ ss->adjust_symbols = elf__needs_adjust_symbols(&ehdr);
ss->name = strdup(name);
if (!ss->name) {
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 3fb5d146d9b1..9aa0016937b7 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -217,7 +217,6 @@ int setup_intlist(struct intlist **list, const char *list_str,
const char *list_name);
#ifdef HAVE_LIBELF_SUPPORT
-bool elf__needs_adjust_symbols(GElf_Ehdr ehdr);
void arch__sym_update(struct symbol *s, GElf_Sym *sym);
#endif
--
2.53.0.239.g8d8fc8a987-goog
next prev parent reply other threads:[~2026-02-07 8:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-07 8:24 [PATCH v1 0/5] perf tool: Minor code clean ups Ian Rogers
2026-02-07 8:24 ` Ian Rogers [this message]
2026-02-07 8:24 ` [PATCH v1 2/5] perf dump-insn: Remove dump-insn.c Ian Rogers
2026-02-07 8:24 ` [PATCH v1 3/5] perf tool: Constify the command and option arrays Ian Rogers
2026-02-07 8:24 ` [PATCH v1 4/5] perf bpf_map: Remove unused code Ian Rogers
2026-02-07 8:24 ` [PATCH v1 5/5] perf record: Remove unused cpu-set-sched.h Ian Rogers
2026-03-12 20:40 ` [PATCH v1 0/5] perf tool: Minor code clean ups Ian Rogers
2026-03-13 21:26 ` Namhyung Kim
2026-03-14 17:42 ` Namhyung Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260207082428.1742209-2-irogers@google.com \
--to=irogers@google.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=ebiggers@kernel.org \
--cc=haibo1.xu@intel.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=palmer@dabbelt.com \
--cc=peterz@infradead.org \
--cc=stephen.s.brennan@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox