-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rust musl build segfaults on startup when linked with LLD 12 #86712
Comments
If I actually use |
The segfault is in musl's
|
If I remove the |
I can reproduce this issue, the output will segfault when
The bisect command is export RUSTFLAGS="-Ctarget-feature=+crt-static -Clinker=clang -Clink-arg=-fuse-ld=lld"
cargo bisect-rustc --start 2020-08-07 --end 2020-08-09 -- run The bisect result is:
My environment:
@rustbot label: +A-linkage +O-musl +regression-from-stable-to-stable |
thanks @12101111 for the additional information. Assigning priority as discussed in the Zulip thread of the Prioritization Working Group. @rustbot label -I-prioritize +P-high +T-compiler |
Testing with our build of lld 15 on nightly and this seems to work fine now: $ rustc +nightly --version -v
rustc 1.67.0-nightly (77e57db38 2022-10-30)
binary: rustc
commit-hash: 77e57db384aca99444c3b5f6a9c86bc58a804d89
commit-date: 2022-10-30
host: x86_64-unknown-linux-gnu
release: 1.67.0-nightly
LLVM version: 15.0.4
$ git clone https://github.com/rocallahan/rust-musl-segfault.git
$ cd rust-musl-segfault/
$ RUSTFLAGS="-Ctarget-feature=+crt-static -Clinker=rust-lld" cargo +nightly build --target x86_64-unknown-linux-musl
$ ./target/x86_64-unknown-linux-musl/debug/test_crate
$ echo $?
0 |
Indeed, this seems it was "fixed" (or perhaps hidden) sometime in late August 2021: % ND=nightly-2021-08-21 ; rustup update $ND ; rustup target add --toolchain $ND x86_64-unknown-linux-musl ; RUSTFLAGS="-Ctarget-feature=+crt-static -Clinker=rust-lld" cargo +$ND build --target x86_64-unknown-linux-musl && ./target/x86_64-unknown-linux-musl/debug/test_crate
info: syncing channel updates for 'nightly-2021-08-21-x86_64-unknown-linux-gnu'
nightly-2021-08-21-x86_64-unknown-linux-gnu unchanged - rustc 1.56.0-nightly (a0035916e 2021-08-20)
info: checking for self-updates
info: component 'rust-std' for target 'x86_64-unknown-linux-musl' is up to date
Compiling bitflags v1.2.1
Compiling libc v0.2.97
Compiling nix v0.17.0
Compiling cfg-if v0.1.10
Compiling void v1.0.2
Compiling test_crate v0.1.0 (/media/pnkfelix/Rust/issue_86712/rust-musl-segfault)
warning: unused import: `nix::sys::stat::Mode`
--> src/main.rs:1:5
|
1 | use nix::sys::stat::Mode;
| ^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: `test_crate` (bin "test_crate") generated 1 warning
Finished dev [unoptimized + debuginfo] target(s) in 3.64s
Segmentation fault (core dumped)
15-15-24 issue_86712/rust-musl-segfault (git:main) [ERROR#139] % ND=nightly-2021-08-22 ; rustup update $ND ; rustup target add --toolchain $ND x86_64-unknown-linux-musl ; RUSTFLAGS="-Ctarget-feature=+crt-static -Clinker=rust-lld" cargo +$ND build --target x86_64-unknown-linux-musl && ./target/x86_64-unknown-linux-musl/debug/test_crate
info: syncing channel updates for 'nightly-2021-08-22-x86_64-unknown-linux-gnu'
nightly-2021-08-22-x86_64-unknown-linux-gnu unchanged - rustc 1.56.0-nightly (d3e2578c3 2021-08-21)
info: checking for self-updates
info: component 'rust-std' for target 'x86_64-unknown-linux-musl' is up to date
Compiling libc v0.2.97
Compiling bitflags v1.2.1
Compiling nix v0.17.0
Compiling cfg-if v0.1.10
Compiling void v1.0.2
Compiling test_crate v0.1.0 (/media/pnkfelix/Rust/issue_86712/rust-musl-segfault)
warning: unused import: `nix::sys::stat::Mode`
--> src/main.rs:1:5
|
1 | use nix::sys::stat::Mode;
| ^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: `test_crate` (bin "test_crate") generated 1 warning
Finished dev [unoptimized + debuginfo] target(s) in 3.60s
% |
I'm going to guess this was fixed by the LLVM 13 upgrade that took place with #87570 (on 2021-08-21). |
So I think the only thing that's blocking this ticket being closed is a regression test. Marking accordingly. @rustbot label: E-needs-test |
Steps to reproduce:
Since the code is literally
I expected it to not segfault.
The text was updated successfully, but these errors were encountered: