8000 Trying to make a PE/COFF image for RISC-V fails · Issue #755 · gimli-rs/object · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Trying to make a PE/COFF image for RISC-V fails #755

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
erin-desu opened this issue Feb 13, 2025 · 2 comments
AF89
Open

Trying to make a PE/COFF image for RISC-V fails #755

erin-desu opened this issue Feb 13, 2025 · 2 comments

Comments

@erin-desu
Copy link

I am trying to make an UEFI application for RISC-V, but the rustc seems to ICE. @repnop tracked the issue down here, where it errors out when RISC-V architecture set for COFF images with unimplemented architecture Riscv64 with sub-architecture None.

As RISC-V is a completely valid and sound UEFI target which requires PE/COFF, this is rather unpleasant.

@bjorn3
Copy link
Contributor
bjorn3 commented Feb 13, 2025

Unfortunately Microsoft hasn't yet defined any COFF relocations for riscv. As such it is not possible to produce riscv COFF object files. LLVM can't write them either. It just so happens that rustc gave an error first while creating an object file for the crate metadata. AFAIK you have to link an ELF instead and then transform this ELF into a PE executable. For example by prepending a stub written in assembly like https://github.com/torvalds/linux/blob/master/arch/riscv/kernel/efi-header.S

@philipc
Copy link
Contributor
philipc commented Feb 13, 2025

Yes, you need to create an ELF first and transform it. I have previously add some RISC-V support to the elftoefi example in this crate, but I only tested it on a simple file and it may not be complete.

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

No branches or pull requests

3 participants
0