Open
Description
I tried this code:
[profile.release]
lto = true
use std::process::Command;
fn main() {
Command::new("ls").spawn();
}
Compiled with :
RUSTFLAGS="-C target-feature=+crt-static" cargo run --release
I expected to see this happen: Spawn & get output of child ls
process
Instead, this happened: Program crashes with :
thread panicked while processing panic. aborting.
illegal hardware instruction (core dumped)
Disabling LTO or static linking removes the issue without any code changes.
Meta
rustc --version --verbose
:
rustc --version --verbose
rustc 1.59.0 (9d1b2106e 2022-02-23)
binary: rustc
commit-hash: 9d1b2106e23b1abd32fce1f17267604a5102f57a
commit-date: 2022-02-23
host: x86_64-unknown-linux-gnu
release: 1.59.0
LLVM version: 13.0.0
Backtrace
#0 0x000000000043957f in std::panicking::rust_panic_with_hook ()
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/ptr/[mod.rs:188](http://mod.rs:188/)
#1 0x0000000000439046 in std::panicking::begin_panic_handler::{closure#0} () at library/std/src/[panicking.rs:500](http://panicking.rs:500/)
#2 0x0000000000438fe6 in std::sys_common::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::{closure#0}, !> () at library/std/src/sys_common/[backtrace.rs:139](http://backtrace.rs:139/)
#3 0x0000000000438fa2 in std::panicking::begin_panic_handler () at library/std/src/[panicking.rs:498](http://panicking.rs:498/)
#4 0x0000000000401230 in core::panicking::panic_fmt () at library/core/src/[panicking.rs:116](http://panicking.rs:116/)
#5 0x00000000004395d4 in std::sys::unix::rwlock::RWLock::read () at library/std/src/sys/unix/[rwlock.rs:49](http://rwlock.rs:49/)
#6 std::sys_common::rwlock::StaticRWLock::read () at library/std/src/sys_common/[rwlock.rs:23](http://rwlock.rs:23/)
#7 std::panicking::rust_panic_with_hook () at library/std/src/[panicking.rs:595](http://panicking.rs:595/)
#8 0x0000000000439046 in std::panicking::begin_panic_handler::{closure#0} () at library/std/src/[panicking.rs:500](http://panicking.rs:500/)
#9 0x0000000000438fe6 in std::sys_common::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::{closure#0}, !> () at library/std/src/sys_common/[backtrace.rs:139](http://backtrace.rs:139/)
#10 0x0000000000438fa2 in std::panicking::begin_panic_handler () at library/std/src/[panicking.rs:498](http://panicking.rs:498/)
#11 0x0000000000401230 in core::panicking::panic_fmt () at library/core/src/[panicking.rs:116](http://panicking.rs:116/)
--Type <RET> for more, q to quit, c to continue without paging--
#12 0x00000000004395d4 in std::sys::unix::rwlock::RWLock::read () at library/std/src/sys/unix/[rwlock.rs:49](http://rwlock.rs:49/)
#13 std::sys_common::rwlock::StaticRWLock::read () at library/std/src/sys_common/[rwlock.rs:23](http://rwlock.rs:23/)
#14 std::panicking::rust_panic_with_hook () at library/std/src/[panicking.rs:595](http://panicking.rs:595/)
#15 0x0000000000439046 in std::panicking::begin_panic_handler::{closure#0} () at library/std/src/[panicking.rs:500](http://panicking.rs:500/)
#16 0x0000000000438fe6 in std::sys_common::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::{closure#0}, !> () at library/std/src/sys_common/[backtrace.rs:139](http://backtrace.rs:139/)
#17 0x0000000000438fa2 in std::panicking::begin_panic_handler () at library/std/src/[panicking.rs:498](http://panicking.rs:498/)
#18 0x0000000000401230 in core::panicking::panic_fmt () at library/core/src/[panicking.rs:116](http://panicking.rs:116/)
#19 0x0000000000436687 in std::sys::unix::rwlock::RWLock::read () at library/std/src/sys/unix/[rwlock.rs:49](http://rwlock.rs:49/)
#20 std::sys_common::rwlock::StaticRWLock::read () at library/std/src/sys_common/[rwlock.rs:23](http://rwlock.rs:23/)
#21 std::sys::unix::os::env_read_lock () at library/std/src/sys/unix/[os.rs:490](http://os.rs:490/)
#22 std::sys::unix::process::process_common::Command::posix_spawn () at library/std/src/sys/unix/process/process_[unix.rs:529](http://unix.rs:529/)
#23 std::sys::unix::process::process_common::Command::spawn () at library/std/src/sys/unix/process/process_[unix.rs:55](http://unix.rs:55/)
#24 std::process::Command::spawn () at library/std/src/[process.rs:868](http://process.rs:868/)
#25 0x000000000043af8c in tester::main ()
--Type <RET> for more, q to quit, c to continue without paging--
#26 0x0000000000439da3 in std::sys_common::backtrace::__rust_begin_short_backtrace ()
#27 0x000000000043a29c in main ()