Some problem while trying to port rustc to a custom llvm target

I have a custom architecture with its own LLVM backend. I am currently trying to port rustc to it. However, I am currently getting this error while trying to corss-compile the libcore crate

error[E0378]: implementing the `DispatchFromDyn` trait requires multiple coercions   --> /home/codetector/projects/github.com/transfer-learning/rust/src/libcore/ptr/unique.rs:151:1
    |
151 | impl<T: ?Sized, U: ?Sized> DispatchFromDyn<Unique<U>> for Unique<T> where T: Unsize<U> {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: the trait `DispatchFromDyn` may only be implemented for a coercion between structures with a single field being coerced
    = note: currently, 2 fields need coercions: `pointer` (`*const T` to `*const U`), `_marker` (`marker::PhantomData<T>` to `marker::PhantomData<U>`)

Can anyone provide some help about what could be causing this?

How did you try to cross-compile? What commands did you use?

I am trying to cross compile with xargo on an empty project (basically just _start and panic handler) with no_std. It is trying to cross compile the core crate. Using the same flags I can crosscompile for other platform so I assume it’s something wrong with me not adding compiler support correctly

This kind of error is unexpected when cross-compiling for an unknown target. I would rather expect it when changing libcore or rustc.

Yeah, so I had to add a target definition into rustc_target. But this is why I am confused as of why am I getting this error. Because with the same compiler, I can cross compile for msp430. In case it helps, I have attached my fork of rust repo that has the changes made to support this custom target. Thanks for your help again.

This is the commit where I added support for my target

Are the rustc and libcore from the same stable Rust version or the same git commit?

yes, they are in-tree. So yes, they are from the same commit

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.