https://sourceware.org/bugzilla/show_bug.cgi?id=31571
Bug ID: 31571 Summary: strip mangles 64-bit mach-o binaries Product: binutils Version: unspecified Status: UNCONFIRMED Severity: critical Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: workingjubilee at gmail dot com Target Milestone: --- Created attachment 15441 --> https://sourceware.org/bugzilla/attachment.cgi?id=15441&action=edit a mach-o header diff showing 0xFEEDFACF changed to 0xFEEDFACE Hi! Thanks for strip, it's a really great utility! Rust recently switched to using strip by default in release builds since it allows us to ship full debuginfo for our precompiled stdlib on Linux but then strip the binary after linking in the code. And of course on Linux, this means we're usually using the GNU binutils strip! It works pretty well for most Linux distros, so far. There's only one problem: It doesn't seem to work at all on macOS, and rather than merely failing to do anything, it appears to actively mangle the binary. The resulting binaries will be SIGKILLed almost immediately after startup. This issue may be constrained to aarch64 macOS. x86-64 macOS may be unaffected. I have no reports that suggest otherwise, all of them have been on aarch64 macOS. This has been an ongoing issue for some time, however, so I can't be sure. Triggering it is as simple as booting up an aarch64-darwin system, putting the GNU binutils strip first in your $PATH, installing Rust (for this, https://rustup.rs/ is convenient), and then: cargo new --bin helloworld cd helloworld cargo run --release You will see something like: Compiling helloworld v0.1.0 (/some/path/blah/blah) Finished `release` profile [optimized] target(s) in 0.14s Running `target/release/foo` Killed: 9 This is because as-of rust 1.77, it will attempt to automatically strip the binary and then run it. But it actually causes this with any compiler toolchain as far as I can tell, including simple C binaries compiled with gcc or clang. Part of the issue appears to be mangling the header. The green diff on the right is what happens after a binary is mangled by strip. Usually on macOS, this is not a problem, as people appear to usually have llvm-strip in their PATH, but if they get binutils from Nix, Homebrew, or another route, it seems to usually be GNU binutils. -- You are receiving this mail because: You are on the CC list for the bug.