[PW_SID:1094308] perf build: Fix cross-arch build failures and GCC 14 warnings#1926
[PW_SID:1094308] perf build: Fix cross-arch build failures and GCC 14 warnings#1926linux-riscv-bot wants to merge 4 commits into
Conversation
Currently, tools/perf/util/Build hardcodes architecture-specific hardware tracing objects (e.g., intel-pt.o, arm-spe.o, cs-etm-base.o) into the generic perf-util-y list. When compiling on architectures that lack these features (such as RISC-V), the compiler skips generating these objects, causing the linker to fail with "No such file or directory" or undefined references. Fix this by decoupling the architecture-specific hardware tracing drivers from the generic build process: 1. In Makefile.config, explicitly export CONFIG_PERF_XYZ feature flags only for their corresponding target architectures. 2. In util/Build, conditionally link these hardware tracing objects based on the newly exported feature flags. 3. In util/auxtrace.c, provide __weak stub functions returning -ENOSYS for the arch-specific processing routines. This ensures successful linking and graceful degradation when specific drivers are omitted. Signed-off-by: Li Guan <guanli.oerv@isrc.iscas.ac.cn> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
When building perf for the RISC-V architecture (e.g., with GCC 14), the
build fails due to strict type checking on pointer assignments. The
compiler flags the return value of strrchr() being assigned to a
non-const pointer while processing a const string, triggering
-Werror=discarded-qualifiers:
arch/riscv/util/header.c:24:15: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
24 | line2 = strrchr(line, ' ');
| ^
arch/riscv/util/header.c:29:12: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
29 | nl = strrchr(line, '\n');
| ^
Resolve this by adding an explicit (char *) cast to the strrchr()
return values, which satisfies the compiler's qualifier checks
without altering the runtime behavior.
Signed-off-by: Li Guan <guanli.oerv@isrc.iscas.ac.cn>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
When cross-compiling perf for architectures that do not yet implement hardware-specific instruction decoding (such as RISC-V and ARM64), the linker fails with undefined references to `dump_insn` and `arch_is_uncond_branch` in builtin-script.c. Provide global __weak stubs for these functions to ensure successful linking across all architectures. Architectures that support these features will automatically override these weak symbols. Signed-off-by: Li Guan <guanli.oerv@isrc.iscas.ac.cn> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "[1/3] perf build: Fix cross-arch build failures by isolating auxtrace objects" |
|
Patch 1: "[1/3] perf build: Fix cross-arch build failures by isolating auxtrace objects" |
|
Patch 1: "[1/3] perf build: Fix cross-arch build failures by isolating auxtrace objects" |
|
Patch 1: "[1/3] perf build: Fix cross-arch build failures by isolating auxtrace objects" |
|
Patch 1: "[1/3] perf build: Fix cross-arch build failures by isolating auxtrace objects" |
|
Patch 1: "[1/3] perf build: Fix cross-arch build failures by isolating auxtrace objects" |
|
Patch 1: "[1/3] perf build: Fix cross-arch build failures by isolating auxtrace objects" |
|
Patch 1: "[1/3] perf build: Fix cross-arch build failures by isolating auxtrace objects" |
|
Patch 1: "[1/3] perf build: Fix cross-arch build failures by isolating auxtrace objects" |
|
Patch 1: "[1/3] perf build: Fix cross-arch build failures by isolating auxtrace objects" |
|
Patch 1: "[1/3] perf build: Fix cross-arch build failures by isolating auxtrace objects" |
|
Patch 1: "[1/3] perf build: Fix cross-arch build failures by isolating auxtrace objects" |
|
Patch 2: "[2/3] perf riscv: Fix discarded const qualifier error in _get_field()" |
|
Patch 2: "[2/3] perf riscv: Fix discarded const qualifier error in _get_field()" |
|
Patch 2: "[2/3] perf riscv: Fix discarded const qualifier error in _get_field()" |
|
Patch 2: "[2/3] perf riscv: Fix discarded const qualifier error in _get_field()" |
|
Patch 2: "[2/3] perf riscv: Fix discarded const qualifier error in _get_field()" |
|
Patch 2: "[2/3] perf riscv: Fix discarded const qualifier error in _get_field()" |
|
Patch 2: "[2/3] perf riscv: Fix discarded const qualifier error in _get_field()" |
|
Patch 2: "[2/3] perf riscv: Fix discarded const qualifier error in _get_field()" |
|
Patch 2: "[2/3] perf riscv: Fix discarded const qualifier error in _get_field()" |
|
Patch 2: "[2/3] perf riscv: Fix discarded const qualifier error in _get_field()" |
|
Patch 2: "[2/3] perf riscv: Fix discarded const qualifier error in _get_field()" |
|
Patch 2: "[2/3] perf riscv: Fix discarded const qualifier error in _get_field()" |
|
Patch 3: "[3/3] perf script: Provide weak stubs for instruction decoding" |
|
Patch 3: "[3/3] perf script: Provide weak stubs for instruction decoding" |
|
Patch 3: "[3/3] perf script: Provide weak stubs for instruction decoding" |
|
Patch 3: "[3/3] perf script: Provide weak stubs for instruction decoding" |
|
Patch 3: "[3/3] perf script: Provide weak stubs for instruction decoding" |
|
Patch 3: "[3/3] perf script: Provide weak stubs for instruction decoding" |
|
Patch 3: "[3/3] perf script: Provide weak stubs for instruction decoding" |
|
Patch 3: "[3/3] perf script: Provide weak stubs for instruction decoding" |
|
Patch 3: "[3/3] perf script: Provide weak stubs for instruction decoding" |
|
Patch 3: "[3/3] perf script: Provide weak stubs for instruction decoding" |
|
Patch 3: "[3/3] perf script: Provide weak stubs for instruction decoding" |
|
Patch 3: "[3/3] perf script: Provide weak stubs for instruction decoding" |
2d4fcdd to
cd9d421
Compare
PR for series 1094308 applied to workflow__riscv__fixes
Name: perf build: Fix cross-arch build failures and GCC 14 warnings
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1094308
Version: 1