riscv-collab / riscv-gnu-toolchain

GNU toolchain for RISC-V, including GCC
Other
3.56k stars 1.17k forks source link

Use compiler toolchain in web with webAssembly #1585

Closed Jotaceee closed 1 month ago

Jotaceee commented 1 month ago

Hey, I just wanna adapt this toolchain to use the elf-as and elf-ld in web and i want to compile it with WebAssembly.

Is it possible?

Or there is another way to use it in a custom web?

It is as personal project to integrate this kind of tools in web.

Regards,

TommyMurphyTM1234 commented 1 month ago

Hey, I just wanna adapt this toolchain to use the elf-as and elf-ld

What exactly do you mean by elf-as and elf-ld?

The readme explains how to build the toolchains in this repo and what the prerequisites are.

WebAssembly isn't mentioned there.

I don't really understand what your aim is here exactly.

There may be other efforts/projects relating to the intersection of RISC-V and WebAssembly that may be a better place to start and maybe ask. E.g.

Jotaceee commented 1 month ago

Yes i understand, but i want to know if there is the possible to use the toolchain on a web. Not just local. And referred to elf-as and elf-ld, I refer to use only the binaries riscv64-unknown-elf-as and riscv64-unknown-elf-ld.

TommyMurphyTM1234 commented 1 month ago

i want to know if there is the possible to use the toolchain on a web.

What exactly do you mean by this?

The toolchain is just a set of binaries. What you do with it and how/where you run it is up to you.

For what it's worth, there is already a web based form of the riscv-gnu-toolchain toolchains in the form of Compiler Explorer:

Jotaceee commented 1 month ago

/ What exactly do you mean by this?

I mean that use the toolchain on web like the links you send me. Because i've designed a application to run elf files in a simulator of riscv.

TommyMurphyTM1234 commented 1 month ago

/ What exactly do you mean by this?

I mean that use the toolchain on web like the links you send me. Because i've designed a application to run elf files in a simulator of riscv.

So use Compiler Explorer? Or replicate the way that they do it?

TommyMurphyTM1234 commented 1 month ago

I presume that if you want to "port" the riscv-gnu-toolchain tools to run on WebAssembly (i.e. its custom stack based virtual machine) then you'd need to start here:

You might want to check what prior work may have been done on porting existing GCC toolchains and/or other GNU/open source tools to WASM and use that as a guide.

This is obviously way outside the scope of this repository so I am closing this issue.