Skip to content

Commit cc39efb

Browse files
committed
add fix for RISC-V unknown vs pc system type
1 parent ac4be2f commit cc39efb

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

eb_hooks.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,19 @@ def post_prepare_hook_gcc_prefixed_ld_rpath_wrapper(self, *args, **kwargs):
329329
config_guess = obtain_config_guess()
330330
system_type, _ = run_cmd(config_guess, log_all=True)
331331
cmd_prefix = '%s-' % system_type.strip()
332+
if cmd_prefix.startswith('riscv64-unknown-'):
333+
# The 2025.06 compatibility layer for RISC-V is built with CHOST=riscv64-pc-linux-gnu,
334+
# while config.guess returns riscv64-unknown-linux-gnu.
335+
# If we can't find an ld with the original cmd_prefix, but can find one with the -pc- prefix,
336+
# we simply override the original cmd_prefix.
337+
eprefix = get_eessi_envvar('EPREFIX')
338+
cmd_prefix_riscv_pc = cmd_prefix.replace('-unknown-', '-pc-')
339+
if (
340+
not os.path.exists(os.path.join(eprefix, 'usr', 'bin', cmd_prefix + 'ld')) and
341+
os.path.exists(os.path.join(eprefix, 'usr', 'bin', cmd_prefix_riscv_pc + 'ld'))
342+
):
343+
self.log.info(f"Using {cmd_prefix_riscv_pc} instead of {cmd_prefix} as command prefix.")
344+
cmd_prefix = cmd_prefix_riscv_pc
332345
for cmd in ('ld', 'ld.gold', 'ld.bfd'):
333346
wrapper = which(cmd)
334347
if wrapper is None:

0 commit comments

Comments
 (0)