Open xobs opened 1 year ago
I managed to link the project using riscv32-esp-elf-gcc
and it worked just fine, so this seems like a regression with rust-lld
.
WG-prioritization assigning priority (Zulip discussion)
@xobs can you provide an example of a crate failing to build? Could be interesting to bisect where this started. We usually use https://github.com/rust-lang/cargo-bisect-rustc for bisecting (if anyone has some time to help).
@rustbot label -I-prioritize +P-low e-needs-mcve e-needs-bisection
This issue is what caused me to submit https://github.com/rust-lang/rust/pull/104101 to get our libstd upstream. Until now it's been out-of-tree.
I did put up an example of the crash at https://github.com/xobs/gam-crash. This crate is buildable provided you have support for riscv32imac-unknown-xous-elf
. This patchset is available in https://github.com/rust-lang/rust/pull/104101
Note that this crate can be linked with ld
.
I've verified that gam-crash
fails on both Windows and Linux. Furthermore, removing debug=true
OR codegen-units=1
from Cargo.toml
makes it no longer fail.
I'm following these steps:
cargo +nightly build --release --target riscv32imac-unknown-xous-elf
Given that the difference between 1.65.0 and 1.64.0 wasn't too great -- the only changes were to the arguments to read_buf()
and the addition of _sigpipe
to init()
, it may not be too difficult to to the bisect even with our wonky build system. I'll need to learn how to use cargo-bisect-rustc
though.
Using nothing but the choices of chewing gums, the finest of balling wire, and the crudest of scripts https://gist.github.com/xobs/2ae7231284a58df6600b2c0d758ed5f0 I narrowed it down to e2b52ff73edc8b0b7c74bc28760d618187731fe8 as the source of the crash.
Which makes sense, because the crash is in rust-lld
and goes away when I replace it with ld
. I'm sure it'd work just fine if I transplanted rust-lld
from 1.64.0 into 1.65.0.
What's the next step?
thanks @xobs for the help! I'll mention #99464 cc: @nikic for more context
Version it worked on
It most recently worked on: Rust 1.64.0
Version with regression
rustc --version --verbose
:Description
Building crates for the
riscv32imac-unknown-xous-elf
target sometimes results in a link error. This began with Rust 1.65.0. For example:Background
We build a custom libstd for the
riscv32imac-unknown-xous-elf
target, which is a Tier-3 target. This repository is at https://github.com/betrusted-io/rust. We are working on preparing patches for upstream that do not add any external dependencies, but this work is taking time. As a result, we generally forward-port our patchset every six weeks once the stable build is released.When building packages for the Betrusted platform, our build system compiles around 27 packages. Many of these packages succeed, but with Rust 1.65.0 we have three packages fail.
This target does not have a linker script, and instead relies on the default one provided by
rust-lld
.