riscv64:ld: option --oformat pei-riscv64-little raises segmentation fault (SIGSEGV)

Jan Beulich jbeulich@suse.com
Mon Feb 16 08:02:27 GMT 2026


On 16.02.2026 08:50, Johannes Krottmayer wrote:
> I have tried to create a PE image for an EFI environment targeting
> RISCV64. But when I try to pass the option --oformat pei-riscv64-little
> to LD, LD crashes with a segmentation fault.

It is my understanding that PE support for RISC-V (and also other targets,
like Arm64) doesn't go as far as allowing ...

> LD version:
> $ riscv64-unknown-linux-gnu-ld --version
> GNU ld (GNU Binutils) 2.46
> [...]
> $
> 
> The source from the issue according GDB:
> bfd/elfnn-riscv.c:
> 
> void
> riscv_elfNN_set_options (struct bfd_link_info *link_info,
> 			 struct riscv_elf_params *params)
> {
>    riscv_elf_hash_table (link_info)->params = params; // <-- Crashes here
> }

... linking from ELF input objects. It's there solely to allow objcopy from
ELF to PE. Quite a bit of work was necessary to make linking work on x86.

Jan


More information about the Binutils mailing list