tools/perf/arch/powerpc/util: Fix is_compat_mode build break in ppc64
PATCH 1/1 tools/perf/arch/powerpc/util: 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".
--- tools/perf/arch/powerpc/util/header.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/arch/powerpc/util/header.c +2 -2
@@ -14,8 +14,8 @@static bool is_compat_mode (void ) { -u64 base_platform =getauxval (AT_BASE_PLATFORM ); -u64 platform =getauxval (AT_PLATFORM ); +unsigned long base_platform =getauxval (AT_BASE_PLATFORM ); +unsigned long platform =getauxval (AT_PLATFORM );if (!strcmp ((char *)platform, (char *)base_platform))return false;
Signature · 1 line
2.43.5
Quoted 20 lines · Likhitha Korrapati
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))|
Quoted 7 lines
Commit saved the
getauxval(AT_BASE_PLATFORM)andgetauxval(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 <[email protected]>
Hi Likhitha,
Thanks for the fix.
Thanks
Athira
Quoted 22 lines
---
tools/perf/arch/powerpc/util/header.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)tools/perf/arch/powerpc/util/header.c +2
-2@@ -14,8 +14,8 @@static bool is_compat_mode (void ) { -u64 base_platform =getauxval (AT_BASE_PLATFORM ); -u64 platform =getauxval (AT_PLATFORM ); +unsigned long base_platform =getauxval (AT_BASE_PLATFORM ); +unsigned long platform =getauxval (AT_PLATFORM );if (!strcmp ((char *)platform, (char *)base_platform))return false;Signature · 1 line
2.43.5
Quoted 32 lines · Likhitha Korrapati
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)andgetauxval(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 <[email protected]>--- tools/perf/arch/powerpc/util/header.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/perf/arch/powerpc/util/header.c +0
-0
tools/perf/arch/powerpc/util/header.c line 21
Quoted 10 lines
tools/perf/arch/powerpc/util/header.c +2
-2@@ -14,8 +14,8 @@static bool is_compat_mode (void ) { -u64 base_platform =getauxval (AT_BASE_PLATFORM ); -u64 platform =getauxval (AT_PLATFORM ); +unsigned long base_platform =getauxval (AT_BASE_PLATFORM ); +unsigned long platform =getauxval (AT_PLATFORM );if (!strcmp ((char *)platform, (char *)base_platform))return false;
Applied this patch on the powerpc kernel and it fixes the issue.
Without this patch:
INSTALL libsubcmd_headers
INSTALL libsymbol_headers
INSTALL libperf_headers
INSTALL libapi_headers
CC /output/arch/powerpc/util/header.o
CC /output/arch/powerpc/util/perf_regs.o
CC /output/arch/powerpc/util/mem-events.o
CC /output/arch/powerpc/util/pmu.o
CC /output/arch/powerpc/util/sym-handling.o
CC /output/arch/powerpc/util/evsel.o
CC /output/arch/powerpc/util/event.oarch/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))
| ^
cc1: all warnings being treated as errors
make[6]: *** [/linux/tools/build/Makefile.build:85: /output/arch/powerpc/util/header.o] Error 1 make[6]: *** Waiting for unfinished jobs....
make[5]: *** [/linux/tools/build/Makefile.build:138: util] Error 2
make[4]: *** [/linux/tools/build/Makefile.build:138: powerpc] Error 2
make[3]: *** [/linux/tools/build/Makefile.build:138: arch] Error 2
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [Makefile.perf:781: /output/perf-util-in.o] Error 2
make[1]: *** [Makefile.perf:280: sub-make] Error 2
make: *** [Makefile:76: all] Error 2
make: Leaving directory '/linux/tools/perf'
With this patch:
PERF_VERSION = 6.14.rc4.gbdfd7b9150f1 INSTALL libapi_headers
GEN perf-archive
GEN perf-iostat
INSTALL libperf_headers
CC /output/arch/powerpc/util/header.o LD /output/arch/powerpc/util/perf-util-in.o LD /output/arch/powerpc/perf-util-in.o LD /output/arch/perf-util-in.o
CC /output/util/header.o
LD /output/util/perf-util-in.o
LD /output/perf-util-in.o
AR /output/libperf-util.a
LINK /output/perf
make: Leaving directory '/linux/tools/perf' ## tools/perf build completed rc = 0
## Build completed OK
Please add below tag:
Regards,
Venkat.
Quoted 14 lines · Likhitha Korrapati
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))
Quoted 3 lines
|[...]
Applied to perf-tools-next, thanks!
Best regards,
Namhyung