Open lowercase-g opened 1 month ago
If you want to add a GCC flag, you can do it as such:
./y.sh cargo rustc --bin project-name -- -Cllvm-args=-mips64r5
where -Cllvm-args
contains the arguments for GCC.
However, this seems to be an error on the Rust side, so, we would need to fix it there, presumably by first adding a way to add targets not supported by LLVM.
If you want to test before this is supported on the Rust side, please follow this doc, which says you will need to select an arch
supported by the Rust compiler (pick one that is close and it might work).
If you want to add a GCC flag, you can do it as such:
./y.sh cargo rustc --bin project-name -- -Cllvm-args=-mips64r5
where
-Cllvm-args
contains the arguments for GCC.However, this seems to be an error on the Rust side, so, we would need to fix it there, presumably by first adding a way to add targets not supported by LLVM.
If you want to test before this is supported on the Rust side, please follow this doc, which says you will need to select an
arch
supported by the Rust compiler (pick one that is close and it might work).
What are the current roadblocks to getting rustc_codegen_gcc
to support targets not supported by LLVM? Is it just the need to use the same target JSON spec as normal rustc or does it go deeper than that?
It needs to have a new parameter in the list of supported platforms. Like codegens: ["gcc", "llvm"]
but for each target. That way, we could add any target we'd like to for GCC without breaking things for LLVM backend.
What are the current roadblocks to getting
rustc_codegen_gcc
to support targets not supported by LLVM? Is it just the need to use the same target JSON spec as normal rustc or does it go deeper than that?
What do you mean by "support targets not supported by LLVM" in rustc_codegen_gcc?
Do you mean some official support from Rust or easy installation via rustup?
As it stands, we can already target unsupported architectures like SuperH for instance, but the setup is not that easy.
While rustc_codegen_gcc can generate code for unsupported targets, this doesn't mean it will work 100% and this means using workarounds like the one I suggested above like using the wrong arch
in the target spec.
Also, there's a chicken-and-egg problem because it seems like you cannot add a target to libc
before it's added to rustc
, but the latter won't accept adding all targets for maintenance burden. See these for more details:
target.json in question:
which, after some wrangling, can build
core
, but notcompiler_builtins
:https://gcc.gnu.org/onlinedocs/gcc/MIPS-Options.html documents a
from-abi
value that could fix this hopefully. No idea how to go about gettingrustc_codegen_gcc
to emit that though.