thepowersgang / mrustc

Alternative rust compiler (re-implementation)
MIT License
2.18k stars 109 forks source link

[Question] Does mrustc makes programs in Rust more portable across host/platforms that LLVM doesn't cover? #303

Closed alpominth closed 1 year ago

alpominth commented 1 year ago

GCC supports many targets when doing cross-compiling, I believe even more than LLVM.

Let's suppose I want to redistribute a binary of my program and one of the targets I want is not covered by LLVM.

Could I just compile my project with mrustc, compile the generated C code and redistribute?

Or will there be problems with compilation or something like this?

thepowersgang commented 1 year ago

Thanks for waiting (I've been distracted with playing Zelda) Compilation should work, once a target definition TOML file is added, but the standard library (including libcore) may need patching.

You're welcome to try, although be aware that mrustc's code generation isn't the best.

alpominth commented 1 year ago

but the standard library (including libcore) may need patching.

Do you mean that libstd needs to be ported to a specific platform that LLVM doen't has support for but GCC does?

bjorn3 commented 1 year ago

Yes, libstd generally needs modifications to support new targets. By the way have you seen https://github.com/rust-lang/rustc_codegen_gcc/? This is a GCC backend for the official rust compiler.

alpominth commented 1 year ago

No Man, I didn't know that project, starred and I'm watching it.

I was thinking on choosing Go as my breadwinner programming language, but now I'm sure that Rust is the right language. I know that GCC-GO exists, but it doesn't have support for generics.

Thank you very much for sharing this information.

Have a so so nice day!