You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the 2025.10 version of the toolchain, the linker (riscv64-unknown-linux-gnu-ld/riscv64-unknown-elf-ld) crashes with a segmentation fault when attempting to link empty files or files that do not conform to the expected linking format, see Nuclei-Software/nuclei-linux-sdk#26 (comment).
Examples of when this issue occurs:
This may occur during the perf compilation process when linking object files that are empty or do not contain proper section information
Root Cause
The issue stems from the zcmt parsing logic in the linker. The current implementation:
Reads the section information from the file being linked
Determines whether zcmt is enabled based on the section information Does NOT handle the edge case where the file contains no section information This lack of null pointer checking leads to a segmentation fault when the linker attempts to access missing section information, resulting in the core dump.
Workaround / Solutions
If the archive or object file input during the linking process is not empty, this issue will not occur. If you do encounter this problem in specific scenarios, you need to apply a workaround or modify your linking process as described below. Currently, we have found that this situation arises when building the Linux perf tool.
Temporary Workaround
To workaround it, just replace riscv64-unknown-linux-gnu-ld/riscv64-unknown-elf-ld and riscv64-unknown-linux-gnu-ld.bfd/riscv64-unknown-elf-ld.bfd in gcc/bin folder using the ld tools of 2025.02 version.
Note
Please note that if you replace the ld from version 2025.02, then some new features from linker in 2025.10 will not be available.
If your project involves linking empty files or files that do not conform to the expected format, and you are not using the newly added extension features, you can directly replace the ld-related files.
Permanent Fix
This issue is scheduled to be fixed in an upcoming toolchain release. Users can either:
Use the ld in 2025.02 version as a workaround, other tools such as gcc keep as 2025.10
Wait for the new version of the toolchain with the fix to be released
Description
When using the 2025.10 version of the toolchain, the linker (riscv64-unknown-linux-gnu-ld/riscv64-unknown-elf-ld) crashes with a segmentation fault when attempting to link empty files or files that do not conform to the expected linking format, see Nuclei-Software/nuclei-linux-sdk#26 (comment).
Current Behavior
Command that triggers the crash
Examples of when this issue occurs:
This may occur during the perf compilation process when linking object files that are empty or do not contain proper section information
Root Cause
The issue stems from the
zcmtparsing logic in the linker. The current implementation:riscv-mcu/riscv-binutils-gdb@f76b0c5#diff-b5dac993e9ea7e46299d5eb9b310fe729620e12c6616e47fc641cd12c71b5818R183-R190
Reads the section information from the file being linked
Determines whether
zcmtis enabled based on the section informationDoes NOT handle the edge case where the file contains no section information
This lack of null pointer checking leads to a segmentation fault when the linker attempts to access missing section information, resulting in the core dump.
Workaround / Solutions
If the archive or object file input during the linking process is not empty, this issue will not occur. If you do encounter this problem in specific scenarios, you need to apply a workaround or modify your linking process as described below. Currently, we have found that this situation arises when building the Linux perf tool.
Temporary Workaround
To workaround it, just replace
riscv64-unknown-linux-gnu-ld/riscv64-unknown-elf-ldandriscv64-unknown-linux-gnu-ld.bfd/riscv64-unknown-elf-ld.bfdingcc/binfolder using the ld tools of 2025.02 version.Note
Permanent Fix
This issue is scheduled to be fixed in an upcoming toolchain release. Users can either:
Use the ld in 2025.02 version as a workaround, other tools such as gcc keep as 2025.10
Wait for the new version of the toolchain with the fix to be released
Environment
Toolchain version: 2025.10
Architecture: RISC-V
Component affected: Linker (ld)
Feature related: zcmt parsing logic