lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251123023225.8069-3-irogers@google.com>
Date: Sat, 22 Nov 2025 18:32:18 -0800
From: Ian Rogers <irogers@...gle.com>
To: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>, 
	Arnaldo Carvalho de Melo <acme@...nel.org>, Namhyung Kim <namhyung@...nel.org>, 
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>, 
	Ian Rogers <irogers@...gle.com>, Adrian Hunter <adrian.hunter@...el.com>, 
	Suzuki K Poulose <suzuki.poulose@....com>, Mike Leach <mike.leach@...aro.org>, 
	James Clark <james.clark@...aro.org>, John Garry <john.g.garry@...cle.com>, 
	Will Deacon <will@...nel.org>, Leo Yan <leo.yan@...ux.dev>, 
	Athira Rajeev <atrajeev@...ux.ibm.com>, tanze <tanze@...inos.cn>, 
	Aditya Bodkhe <aditya.b1@...ux.ibm.com>, Stephen Brennan <stephen.s.brennan@...cle.com>, 
	Andi Kleen <ak@...ux.intel.com>, Chun-Tse Shao <ctshao@...gle.com>, 
	Thomas Falcon <thomas.falcon@...el.com>, Dapeng Mi <dapeng1.mi@...ux.intel.com>, 
	"Dr. David Alan Gilbert" <linux@...blig.org>, Christophe Leroy <christophe.leroy@...roup.eu>, 
	"Krzysztof Ɓopatowski" <krzysztof.m.lopatowski@...il.com>, 
	"Masami Hiramatsu (Google)" <mhiramat@...nel.org>, Alexandre Ghiti <alexghiti@...osinc.com>, 
	Haibo Xu <haibo1.xu@...el.com>, Sergei Trofimovich <slyich@...il.com>, linux-kernel@...r.kernel.org, 
	linux-perf-users@...r.kernel.org
Subject: [PATCH v1 2/9] perf symbol: Reduce scope of arch__sym_update

Rather than being a weak arch function, use the e_machine from the ELF
header to determine whether to update or not. This should make the
function work cross-platform, it also reduces the function's scope.

Signed-off-by: Ian Rogers <irogers@...gle.com>
---
 tools/perf/arch/powerpc/util/sym-handling.c | 7 -------
 tools/perf/util/symbol-elf.c                | 9 ++++++---
 tools/perf/util/symbol.h                    | 4 ----
 3 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/tools/perf/arch/powerpc/util/sym-handling.c b/tools/perf/arch/powerpc/util/sym-handling.c
index 947bfad7aa59..afefa9bd0c93 100644
--- a/tools/perf/arch/powerpc/util/sym-handling.c
+++ b/tools/perf/arch/powerpc/util/sym-handling.c
@@ -66,13 +66,6 @@ const char *arch__normalize_symbol_name(const char *name)
 
 #if defined(_CALL_ELF) && _CALL_ELF == 2
 
-#ifdef HAVE_LIBELF_SUPPORT
-void arch__sym_update(struct symbol *s, GElf_Sym *sym)
-{
-	s->arch_sym = sym->st_other;
-}
-#endif
-
 #define PPC64LE_LEP_OFFSET	8
 
 void arch__fix_tev_from_maps(struct perf_probe_event *pev,
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 5cd4844f9bb4..629b272e0a13 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -1337,8 +1337,11 @@ static u64 ref_reloc(struct kmap *kmap)
 	return 0;
 }
 
-void __weak arch__sym_update(struct symbol *s __maybe_unused,
-		GElf_Sym *sym __maybe_unused) { }
+static void arch__sym_update(int e_machine, const GElf_Sym *sym, struct symbol *s)
+{
+	if (e_machine == EM_PPC64 || e_machine == EM_PPC)
+		s->arch_sym = sym->st_other;
+}
 
 static int dso__process_kernel_symbol(struct dso *dso, struct map *map,
 				      GElf_Sym *sym, GElf_Shdr *shdr,
@@ -1717,7 +1720,7 @@ dso__load_sym_internal(struct dso *dso, struct map *map, struct symsrc *syms_ss,
 		if (!f)
 			goto out_elf_end;
 
-		arch__sym_update(f, &sym);
+		arch__sym_update(ehdr.e_machine, &sym, f);
 
 		__symbols__insert(dso__symbols(curr_dso), f, dso__kernel(dso));
 		nr++;
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index d91dc89386e2..78fb2ba69f65 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -216,10 +216,6 @@ int setup_list(struct strlist **list, const char *list_str,
 int setup_intlist(struct intlist **list, const char *list_str,
 		  const char *list_name);
 
-#ifdef HAVE_LIBELF_SUPPORT
-void arch__sym_update(struct symbol *s, GElf_Sym *sym);
-#endif
-
 const char *arch__normalize_symbol_name(const char *name);
 #define SYMBOL_A 0
 #define SYMBOL_B 1
-- 
2.52.0.rc2.455.g230fcf2819-goog


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ