Skip to contentSkip to conversation

tools headers: Update the copy of x86's mem{cpy,set}_64.S used in 'perf bench'

PATCH New Arnaldo Carvalho de Melo 1 participant 1 message Jun 12, 2025 perf events

lore
Share & tools
lore

Arnaldo Carvalho de Melo

author maintainer
#0 lore raw

PATCH 1/1 tools headers: Update the copy of x86's mem{cpy,set}_64.S used in 'perf bench'

tldr; Just FYI, I'm carrying this on the perf tools tree.

Full explanation:

There used to be no copies, with tools/ code using kernel headers directly. From time to time tools/perf/ broke due to legitimate kernel hacking. At some point Linus complained about such direct usage. Then we adopted the current model.

See further details at:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/include/uapi/README

Also add SYM_PIC_ALIAS() to tools/perf/util/include/linux/linkage.h.

This is to get the changes from:

419cbaf6a56a6e4b ("x86/boot: Add a bunch of PIC aliases")

That addresses these perf tools build warning:

Warning: Kernel ABI header differences:

    diff -u tools/arch/x86/lib/memcpy_64.S arch/x86/lib/memcpy_64.S
    diff -u tools/arch/x86/lib/memset_64.S arch/x86/lib/memset_64.S
Cc Adrian Hunter <[email protected]>
Cc Ard Biesheuvel <[email protected]>
Cc Ian Rogers <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc James Clark <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Kan Liang <[email protected]>
Cc Namhyung Kim <[email protected]>
---
 tools/arch/x86/lib/memcpy_64.S          | 1 +
 tools/arch/x86/lib/memset_64.S          | 1 +
 tools/perf/util/include/linux/linkage.h | 4 ++++
 3 files changed, 6 insertions(+)
tools/arch/x86/lib/memcpy_64.S +1 -0
index 59cf6f9065aa84d8..ccc3d923fc1e0fd4 100644
@@ -40,6 +40,7 @@ SYM_FUNC_END(__memcpy)
 EXPORT_SYMBOL(__memcpy)
 
 SYM_FUNC_ALIAS_MEMFUNC(memcpy, __memcpy)
+SYM_PIC_ALIAS(memcpy)
 EXPORT_SYMBOL(memcpy)
 
 SYM_FUNC_START_LOCAL(memcpy_orig)
tools/arch/x86/lib/memset_64.S +1 -0
index d66b710d628f8865..fb5a03cf5ab7e5e4 100644
@@ -42,6 +42,7 @@ SYM_FUNC_END(__memset)
 EXPORT_SYMBOL(__memset)
 
 SYM_FUNC_ALIAS_MEMFUNC(memset, __memset)
+SYM_PIC_ALIAS(memset)
 EXPORT_SYMBOL(memset)
 
 SYM_FUNC_START_LOCAL(memset_orig)
tools/perf/util/include/linux/linkage.h +4 -0
index 178b00205fe6a7b2..89979ca23c3f1cfb 100644
@@ -132,4 +132,8 @@
         SYM_TYPED_START(name, SYM_L_GLOBAL, SYM_A_ALIGN)
 #endif
 
+#ifndef SYM_PIC_ALIAS
+#define SYM_PIC_ALIAS(sym)	SYM_ALIAS(__pi_ ## sym, sym, SYM_T_FUNC, SYM_L_GLOBAL)
+#endif
+
 #endif	/* PERF_LINUX_LINKAGE_H_ */
Signature · 1 line
2.49.0