Repository navigation
Conversation
The C ABI on Windows also only allows a single return register. Using two return registers is an LLVM ABI extension, which other backends don't support, thus preventing them from using an LLVM compiled standard library on x86_64 Windows.
|
Some changes occurred in src/tools/compiletest cc @jieyouxu |
|
r? @TaKO8Ki rustbot has assigned @TaKO8Ki. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Alternative to bytecodealliance/wasmtime#14361 which also fixes this for the GCC backend (I expect it to have the same problem, though I can't check as godbolt doesn't have Windows support for cg_gcc) |
|
cc @folkertdev |
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
Unlike previous changes like this, this looks like it's going to impact a pretty common case (scalar pair return). I think it would be better to extend other backends to support this psABI variant. |
|
For Cranelift that is doable. For GCC, as I understand it, only ABIs that are representable in C can be implemented by frontends as common IR of GCC (GIMPLE) uses C types for both function signatures and local variables and has the backend implement the entire lowering from a C function signature to the calling convention for the target. And there is no way to write C code that would use two return registers on x86_64 Windows. Notice how GCC doesn't distinguish at all between by-val and by-ref returns in GIMPLE: https://rust.godbolt.org/z/fKjc4oqTr (the cg_gcc produced GIMPLE is a bit confusing as it calls the tuple type "struct", so you get "struct struct" as type) |
|
Is compatibility with an LLVM sysroot even a goal for the GCC backend? |
|
We don't ship a separate standard library for GCC, so ABI compat would be necessary for the rustup distributed version of cg_gcc to work. But I don't know if it is a goal beyond that. cc @antoyo @GuillaumeGomez |
libgccjit can represent ABIs that are not representable in C: for instance, I'll land the sret fix in the coming weeks which required surfacing to libgccjit ABI stuff from the GCC IR. But it does indeed seem that GCC cannot currently represent this ABI on Windows.
Yes, we would like to be compatible with the LLVM ABI, but I don't think we should block any ABI change on GCC support. |
The C ABI on Windows also only allows a single return register. Using two return registers is an LLVM ABI extension, which other backends don't support, thus preventing them from using an LLVM compiled standard library on x86_64 Windows.
Fixes rust-lang/rustc_codegen_cranelift#1703