run-make-fulldeps/c-link-to-rust-va-list-fn fails on s390x
cuviper opened this issue · 2 comments
./x.py test run-make-fulldeps
fails this test on native s390x-unknown-linux-gnu
:
---- [run-make] run-make-fulldeps/c-link-to-rust-va-list-fn stdout ----
error: make failed
status: exit code: 2
command: "make"
stdout:
------------------------------------------
LD_LIBRARY_PATH="/builddir/build/BUILD/rustc-1.51.0-src/build/s390x-unknown-linux-gnu/test/run-make-fulldeps/c-link-to-rust-va-list-fn/c-link-to-rust-va-list-fn:/builddir/build/BUILD/rustc-1.51.0-src/build/s390x-unknown-linux-gnu/stage2/lib:/builddir/build/BUILD/rustc-1.51.0-src/build/s390x-unknown-linux-gnu/stage0-bootstrap-tools/s390x-unknown-linux-gnu/release/deps:/usr/lib" '/builddir/build/BUILD/rustc-1.51.0-src/build/s390x-unknown-linux-gnu/stage2/bin/rustc' --out-dir /builddir/build/BUILD/rustc-1.51.0-src/build/s390x-unknown-linux-gnu/test/run-make-fulldeps/c-link-to-rust-va-list-fn/c-link-to-rust-va-list-fn -L /builddir/build/BUILD/rustc-1.51.0-src/build/s390x-unknown-linux-gnu/test/run-make-fulldeps/c-link-to-rust-va-list-fn/c-link-to-rust-va-list-fn checkrust.rs
------------------------------------------
stderr:
------------------------------------------
LLVM ERROR: Cannot select: 0x3ff7c04c2e8: f64,ch = vaarg 0x3ff7c00d788, 0x3ff7c04c3b8, SrcValue:ch<0x3ff907d1a40>, TargetConstant:i32<8>
0x3ff7c04c3b8: i64,ch = CopyFromReg 0x3ff7c00d788, Register:i64 %1
0x3ff7c04c0e0: i64 = Register %1
0x3ff7c04be70: i32 = TargetConstant<8>
In function: _ZN4core3ffi10VaListImpl3arg17h292dc5efd67889b3E
make: *** [Makefile:4: all] Error 101
------------------------------------------
(This is not a new failure, but I am cleaning up issues from downstream Red Hat bugzilla.)
We started discussing this in #44930, and looking at the clang implementation here:
We're emitting a void pointer like va_list but it looks like a complex structure is expected. We'll need to change the intrinsic type VaListImpl for the architecture. It would be interesting to see if just changing the structure for s390x fixes this or if we do indeed need to implement a custom va_arg as well.
I tried that minimal step with master...cuviper:c_variadic-s390x, but it still gives the same "Cannot select" error. I don't see any lowering of ISD::VAARG
in llvm/lib/Target/SystemZ
like other targets, only stuff implementing the calling convention. So I guess we do need custom support, or perhaps the clang bits could be moved down into the LLVM lowering?