PE targetting compiler for RISCV

228 views
Skip to first unread message

valerij zaporogeci

unread,
May 26, 2021, 4:33:24 PM5/26/21
to RISC-V SW Dev
Hello. Is there a C/C++ compiler for RISCV (clang, I suspect, most probably), capable of generating executables in the PE format? I need this for both - my "hobby" OS and its UEFI Loader, so just converting from ELF isn't an option. Thank you.

Bobby Eshleman

unread,
May 26, 2021, 7:59:33 PM5/26/21
to valerij zaporogeci, RISC-V SW Dev
Hey there,

Out of curiosity, why does needing to compile both an OS and a loader mean that converting from ELF isn't option?  The Xen project goes this route and loads like an OS with no problems, but I could be missing something...

Short of the tooling you're looking for, perhaps going the route of vmlinuz, hand building the PE header, would be sufficient?

-Bobby

On Wed, May 26, 2021, 1:34 PM valerij zaporogeci <vlrz...@gmail.com> wrote:
Hello. Is there a C/C++ compiler for RISCV (clang, I suspect, most probably), capable of generating executables in the PE format? I need this for both - my "hobby" OS and its UEFI Loader, so just converting from ELF isn't an option. Thank you.

--
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+un...@groups.riscv.org.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/9809a583-3320-4013-9350-a5c751fc29b9n%40groups.riscv.org.

valerij zaporogeci

unread,
May 26, 2021, 8:24:44 PM5/26/21
to Bobby Eshleman, RISC-V SW Dev
Because how one they could use the PE import/export facilities? For
generating a non-PIC DLLs, importing functions (and possibly exporting
too)? Without that GOT/PLT horror, just the comfortable PE base
address and relocations. UEFI OS Loader may not need import/export,
but a modular kernel and its components surely would need it.

Don't you happen to know the answer for my original question? I, of
course, tried fiddling around with the clang's triples, before going
to ask this question, nobody seems to be able to answer, in multiple
places, and even though it seems to recognize "win32", "windows",
"efi" subcomponents, still generates ELF.

2021-05-27 2:59 GMT+03:00, Bobby Eshleman <bobby.e...@gmail.com>:
> Hey there,
>
> Out of curiosity, why does needing to compile both an OS and a loader mean
> that converting from ELF isn't option? The Xen project goes this route and
> loads like an OS with no problems, but I could be missing something...
>
> Short of the tooling you're looking for, perhaps going the route of
> vmlinuz, hand building the PE header, would be sufficient?
>
> -Bobby
>
> On Wed, May 26, 2021, 1:34 PM valerij zaporogeci <vlrz...@gmail.com>
> wrote:
>
>> Hello. Is there a C/C++ compiler for RISCV (clang, I suspect, most
>> probably), capable of generating executables in the PE format? I need
>> this
>> for both - my "hobby" OS and its UEFI Loader,* so just converting from
>> ELF isn't an option*. Thank you.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "RISC-V SW Dev" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to sw-dev+un...@groups.riscv.org.
>> To view this discussion on the web visit
>> https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/9809a583-3320-4013-9350-a5c751fc29b9n%40groups.riscv.org
>> <https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/9809a583-3320-4013-9350-a5c751fc29b9n%40groups.riscv.org?utm_medium=email&utm_source=footer>
>> .
>>
>

Jim Wilson

unread,
May 26, 2021, 9:40:35 PM5/26/21
to valerij zaporogeci, Bobby Eshleman, RISC-V SW Dev
On Wed, May 26, 2021 at 5:24 PM valerij zaporogeci <vlrz...@gmail.com> wrote:
Don't you happen to know the answer for my original question? I, of
course, tried fiddling around with the clang's triples, before going
to ask this question, nobody seems to be able to answer, in multiple
places, and even though it seems to recognize "win32", "windows",
"efi" subcomponents, still generates ELF.

I only know of one RISC-V PE effort, and that is the EDK2 work.
They use an ELF gcc, and presumably convert the ELF to PE.

Jim

valerij zaporogeci

unread,
May 26, 2021, 9:48:23 PM5/26/21
to Jim Wilson, Bobby Eshleman, RISC-V SW Dev
That's pity, I hoped, I just missed something, because it looked like
everything is already there - clang does support RISCV and PE, RISCV
has been added to the UEFI/PE specs, machine types and base relocation
types were defined, but nope. Thank you for the answer.
Reply all
Reply to author
Forward
0 new messages