Closed
Description
STR:
cargo new foo
cd foo
echo exit 42 > linker
chmod +x linker
RUSTFLAGS="-Clinker=$PWD/linker" cargo +nightly build
Actual result:
error: could not exec the linker `/tmp/foo/linker`
|
= note: Exec format error (os error 8)
With 1.63:
error: linking with `/tmp/foo/linker` failed: exit status: 42
This is a regression from #95026. What's going on is that before that merge, the linker was executed via posix_spawnp@GLIBC_2.2.5
, and after, it's executed via posix_spawnp@GLIBC_2.15
. The difference between the two is that the former retries executing through the shell when the execution first failed with ENOEXEC. This applies to anything the compiler or cargo would execute via std::process::Command
. The change in posix_spawnp
behavior in glibc comes from https://sourceware.org/bugzilla/show_bug.cgi?id=13134. It's probably for the better, but it should probably be highlighted in the release notes.