Skip to content

[PW_SID:1094308] perf build: Fix cross-arch build failures and GCC 14 warnings#1926

Open
linux-riscv-bot wants to merge 4 commits into
workflow__riscv__fixesfrom
pw1094308
Open

[PW_SID:1094308] perf build: Fix cross-arch build failures and GCC 14 warnings#1926
linux-riscv-bot wants to merge 4 commits into
workflow__riscv__fixesfrom
pw1094308

Conversation

@linux-riscv-bot
Copy link
Copy Markdown

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

Linux RISC-V bot and others added 4 commits May 10, 2026 02:08
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>
@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[1/3] perf build: Fix cross-arch build failures by isolating auxtrace objects"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 140.98 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[1/3] perf build: Fix cross-arch build failures by isolating auxtrace objects"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1016.34 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[1/3] perf build: Fix cross-arch build failures by isolating auxtrace objects"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1376.77 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[1/3] perf build: Fix cross-arch build failures by isolating auxtrace objects"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 25.98 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[1/3] perf build: Fix cross-arch build failures by isolating auxtrace objects"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 27.09 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[1/3] perf build: Fix cross-arch build failures by isolating auxtrace objects"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.47 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[1/3] perf build: Fix cross-arch build failures by isolating auxtrace objects"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 86.75 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[1/3] perf build: Fix cross-arch build failures by isolating auxtrace objects"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[1/3] perf build: Fix cross-arch build failures by isolating auxtrace objects"
kdoc
Desc: Detects for kdoc errors
Duration: 0.92 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[1/3] perf build: Fix cross-arch build failures by isolating auxtrace objects"
module-param
Desc: Detect module_param changes
Duration: 0.28 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[1/3] perf build: Fix cross-arch build failures by isolating auxtrace objects"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[1/3] perf build: Fix cross-arch build failures by isolating auxtrace objects"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.31 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[2/3] perf riscv: Fix discarded const qualifier error in _get_field()"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 140.47 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[2/3] perf riscv: Fix discarded const qualifier error in _get_field()"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1018.42 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[2/3] perf riscv: Fix discarded const qualifier error in _get_field()"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1378.92 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[2/3] perf riscv: Fix discarded const qualifier error in _get_field()"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 25.39 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[2/3] perf riscv: Fix discarded const qualifier error in _get_field()"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 27.17 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[2/3] perf riscv: Fix discarded const qualifier error in _get_field()"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.79 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[2/3] perf riscv: Fix discarded const qualifier error in _get_field()"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 85.55 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[2/3] perf riscv: Fix discarded const qualifier error in _get_field()"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.28 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[2/3] perf riscv: Fix discarded const qualifier error in _get_field()"
kdoc
Desc: Detects for kdoc errors
Duration: 0.86 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[2/3] perf riscv: Fix discarded const qualifier error in _get_field()"
module-param
Desc: Detect module_param changes
Duration: 0.27 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[2/3] perf riscv: Fix discarded const qualifier error in _get_field()"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[2/3] perf riscv: Fix discarded const qualifier error in _get_field()"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.32 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[3/3] perf script: Provide weak stubs for instruction decoding"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 140.54 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[3/3] perf script: Provide weak stubs for instruction decoding"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1014.37 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[3/3] perf script: Provide weak stubs for instruction decoding"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1376.16 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[3/3] perf script: Provide weak stubs for instruction decoding"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 26.06 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[3/3] perf script: Provide weak stubs for instruction decoding"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 27.37 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[3/3] perf script: Provide weak stubs for instruction decoding"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.80 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[3/3] perf script: Provide weak stubs for instruction decoding"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 85.87 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[3/3] perf script: Provide weak stubs for instruction decoding"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 3.48 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[3/3] perf script: Provide weak stubs for instruction decoding"
kdoc
Desc: Detects for kdoc errors
Duration: 0.85 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[3/3] perf script: Provide weak stubs for instruction decoding"
module-param
Desc: Detect module_param changes
Duration: 0.27 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[3/3] perf script: Provide weak stubs for instruction decoding"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[3/3] perf script: Provide weak stubs for instruction decoding"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.31 seconds
Result: PASS

@linux-riscv-bot linux-riscv-bot force-pushed the workflow__riscv__fixes branch from 2d4fcdd to cd9d421 Compare May 14, 2026 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants