]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
perf symbol: Reduce scope of elf__needs_adjust_symbols
authorIan Rogers <irogers@google.com>
Sat, 7 Feb 2026 08:24:24 +0000 (00:24 -0800)
committerNamhyung Kim <namhyung@kernel.org>
Fri, 13 Mar 2026 21:26:27 +0000 (14:26 -0700)
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>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/util/symbol-elf.c
tools/perf/util/symbol.h

index 76912c62b6a070d1dc9e7b379d86452c90943a40..d7582dbf379ed053f085d5ed23ce33c15c3e2541 100644 (file)
@@ -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) {
index 4f1dbd1ebd99506a4412001f7e8d1a416a2f232c..c67814d6d6d6f64a2d9773c8ac2c98a91ff198b5 100644 (file)
@@ -235,7 +235,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