View all comments
This is a very strange one. Since 289fe36 (I bisected; cc @tgross35), my program that calls libc's gettid segfaults when built for x86_64-unknown-linux-musl. However, I can only reproduce this when the call to gettid is in a library crate, and only when it has a certain name, and only when not using -C target-feature=-crt-static, only when using LTO.
Code
dep.rs
unsafe extern "C" {
safe fn gettid() -> i32;
}
pub fn print_tid() {
println!("{}", gettid());
}
main.rs
fn main() {
vmm::print_tid();
}
Reproduction commands
rustc --crate-name vmm --edition=2024 dep.rs --crate-type lib -C opt-level=3 -C linker-plugin-lto --target x86_64-unknown-linux-musl -C linker=/nix/store/nz3n5wy8zadq73kkql2xn485l7xdmv46-x86_64-unknown-linux-musl-gcc-wrapper-15.2.0/bin/x86_64-unknown-linux-musl-cc
rustc --edition=2024 main.rs --crate-type bin -C opt-level=3 -C lto --target x86_64-unknown-linux-musl -C linker=/nix/store/nz3n5wy8zadq73kkql2xn485l7xdmv46-x86_64-unknown-linux-musl-gcc-wrapper-15.2.0/bin/x86_64-unknown-linux-musl-cc --extern vmm=libvmm.rlib
./main
Happy to provide LLVM IR or anything else that helps!
@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged
View all comments
This is a very strange one. Since 289fe36 (I bisected; cc @tgross35), my program that calls libc's
gettidsegfaults when built for x86_64-unknown-linux-musl. However, I can only reproduce this when the call togettidis in a library crate, and only when it has a certain name, and only when not using-C target-feature=-crt-static, only when using LTO.Code
dep.rs
main.rs
Reproduction commands
Happy to provide LLVM IR or anything else that helps!
@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged