[PATCH 0/3] perf build: Fix cross-arch build failures and GCC 14 warnings

Li Guan guanli.oerv at isrc.iscas.ac.cn
Wed May 13 08:48:48 PDT 2026


This patch series addresses a set of build and linking failures encountered
when cross-compiling the perf tool for non-x86 architectures (specifically
RISC-V and ARM64), while also ensuring compatibility with stricter GCC 14
compiler checks.

The series resolves three distinct issues:

1. GCC 14 Compatibility: Fixes a -Werror=discarded-qualifiers build failure
   in the RISC-V specific code by explicitly casting strrchr() return
   values to (char *).
2. Hardware Tracing Isolation: Decouples arch-specific auxtrace objects
   (e.g., intel-pt, arm-spe) from the generic build process, preventing
   "No such file or directory" and undefined reference linker errors on
   architectures that lack these features.
3. Instruction Decoding Stubs: Provides global __weak stubs for dump_insn()
   and arch_is_uncond_branch() in builtin-script.c, resolving undefined
   reference linker errors on architectures (like RISC-V and ARM64) that do
   not yet implement hardware-specific instruction decoding.

These changes have been successfully verified via full builds across
x86_64, s390x, aarch64, and riscv64 architectures.

Li Guan (3):
  perf build: Fix cross-arch build failures by isolating auxtrace
    objects
  perf riscv: Fix discarded const qualifier error in _get_field()
  perf script: Provide weak stubs for instruction decoding

 tools/perf/Makefile.config          | 21 +++++++++
 tools/perf/arch/riscv/util/header.c |  4 +-
 tools/perf/builtin-script.c         | 22 +++++++++
 tools/perf/util/Build               | 20 ++++-----
 tools/perf/util/auxtrace.c          | 70 +++++++++++++++++++++++++++++
 tools/perf/util/auxtrace.h          |  6 +++
 6 files changed, 131 insertions(+), 12 deletions(-)

-- 
2.54.0




More information about the linux-riscv mailing list