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

Johannes Krottmayer krotti83@proton.me
Tue Feb 17 09:25:48 GMT 2026


Hello Jan!

Thanks for the quick answer!

On 2/16/26 9:02 AM, Jan Beulich wrote:
> 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 ...

Okay, but I think it's maybe better to disable this option in further 
releases and don't let LD crash if another user tries the same
like me.

>> 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.

Yes, I agree.

> Jan

Kind regards,

Johannes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: publickey - krotti83@proton.me - 0x1A5D6E0E.asc
Type: application/pgp-keys
Size: 888 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20260217/54ad83bd/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 322 bytes
Desc: OpenPGP digital signature
URL: <https://sourceware.org/pipermail/binutils/attachments/20260217/54ad83bd/attachment.sig>


More information about the Binutils mailing list