Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf tools: Fix is_compat_mode build break in ppc64

Commit 54f9aa1092457 ("tools/perf/powerpc/util: Add support to
handle compatible mode PVR for perf json events") introduced
to select proper JSON events in case of compat mode using
auxiliary vector. But this caused a compilation error in ppc64
Big Endian.

arch/powerpc/util/header.c: In function 'is_compat_mode':
arch/powerpc/util/header.c:20:21: error: cast to pointer from
integer of different size [-Werror=int-to-pointer-cast]
20 | if (!strcmp((char *)platform, (char *)base_platform))
| ^
arch/powerpc/util/header.c:20:39: error: cast to pointer from
integer of different size [-Werror=int-to-pointer-cast]
20 | if (!strcmp((char *)platform, (char *)base_platform))
|

Commit saved the getauxval(AT_BASE_PLATFORM) and getauxval(AT_PLATFORM)
return values in u64 which causes the compilation error.

Patch fixes this issue by changing u64 to "unsigned long".

Fixes: 54f9aa1092457 ("tools/perf/powerpc/util: Add support to handle compatible mode PVR for perf json events")
Signed-off-by: Likhitha Korrapati <likhitha@linux.ibm.com>
Reviewed-by: Athira Rajeev <atrajeev@linux.ibm.com>
Link: https://lore.kernel.org/r/20250321100726.699956-1-likhitha@linux.ibm.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

authored by

Likhitha Korrapati and committed by
Namhyung Kim
7e442be7 9480cc14

+2 -2
+2 -2
tools/perf/arch/powerpc/util/header.c
··· 14 14 15 15 static bool is_compat_mode(void) 16 16 { 17 - u64 base_platform = getauxval(AT_BASE_PLATFORM); 18 - u64 platform = getauxval(AT_PLATFORM); 17 + unsigned long base_platform = getauxval(AT_BASE_PLATFORM); 18 + unsigned long platform = getauxval(AT_PLATFORM); 19 19 20 20 if (!strcmp((char *)platform, (char *)base_platform)) 21 21 return false;