I've added support of a new experimental arch + a new target to rustc, and now I'm trying to build some trivial no_std code. I run "cargo build" with build-std to cross-compile libcore and compiler-builtins. Everything compiles, and I see meaningful LLVM bitcode of my own code and of libcore as well if run with --emit=llvm-ir
But then "cargo build" is failing at linking with messages like this:
error: linking with 'rust-lld' failed: exit status: 1
rust-lld: error: /home/***/debug/deps/libcore-0123456789abcdef.rlib: archive member 'core-0123456789abcdef.core.01234567-cgu.0.rcgu.o' is neither ET_REL nor LLVM bitcode.
The rlib itself is large - about 35MB, but when I look inside (by running 'ar -x libcore-0123456789abcdef.rlib'), I see that the only non-empty file is lib.rmeta, and all the fifty core-01234567890abcdef.*.rcgu.o files have zero size.
When I check libcore built for a built-in target, all the rcgu.o files are non-empty. So it is apparently some bug related to my arch or target or both, but I have no idea how to debug it further.
Any suggestion is appreciated!