-
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
Rustc strips all symbols on MacOS when strip = "debuginfo" is specified, but not when strip = "symbols" is specified #135028
Comments
What made it extra annoying to debug this issue is that the |
This is a regression from stable to nightly, tracked down to #131405. |
@rustbot label +T-bootstrap cc @davidtwco @jieyouxu since #131405 |
The regression is actually a T-compiler concern, because we used the wrong flags for rust-objcopy in cg_ssa. |
Pass objcopy args for stripping on OSX When `-Cstrip` was changed in rust-lang#131405 to use the bundled rust-objcopy instead of /usr/bin/strip on OSX, strip-like arguments were preserved. But strip and objcopy are, while being the same binary, different, they have different defaults depending on which binary they are. Notably, strip strips everything by default, and objcopy doesn't strip anything by default. Additionally, `-S` actually means `--strip-all`, so debuginfo stripped everything and symbols didn't strip anything. We now correctly pass `--strip-debug` and `--strip-all`. fixes rust-lang#135028 try-jobs: aarch64-apple
Pass objcopy args for stripping on OSX When `-Cstrip` was changed in rust-lang#131405 to use the bundled rust-objcopy instead of /usr/bin/strip on OSX, strip-like arguments were preserved. But strip and objcopy are, while being the same binary, different, they have different defaults depending on which binary they are. Notably, strip strips everything by default, and objcopy doesn't strip anything by default. Additionally, `-S` actually means `--strip-all`, so debuginfo stripped everything and symbols didn't strip anything. We now correctly pass `--strip-debug` and `--strip-all`. fixes rust-lang#135028 try-jobs: aarch64-apple try-jobs: dist-aarch64-apple
Pass objcopy args for stripping on OSX When `-Cstrip` was changed in rust-lang#131405 to use the bundled rust-objcopy instead of /usr/bin/strip on OSX, strip-like arguments were preserved. But strip and objcopy are, while being the same binary, different, they have different defaults depending on which binary they are. Notably, strip strips everything by default, and objcopy doesn't strip anything by default. Additionally, `-S` actually means `--strip-all`, so debuginfo stripped everything and symbols didn't strip anything. We now correctly pass `--strip-debug` and `--strip-all`. fixes rust-lang#135028 try-job: aarch64-apple try-job: dist-aarch64-apple
Pass objcopy args for stripping on OSX When `-Cstrip` was changed in rust-lang#131405 to use the bundled rust-objcopy instead of /usr/bin/strip on OSX, strip-like arguments were preserved. But strip and objcopy are, while being the same binary, different, they have different defaults depending on which binary they are. Notably, strip strips everything by default, and objcopy doesn't strip anything by default. Additionally, `-S` actually means `--strip-all`, so debuginfo stripped everything and symbols didn't strip anything. We now correctly pass `--strip-debug` and `--strip-all`. fixes rust-lang#135028 try-job: aarch64-apple try-job: dist-aarch64-apple
Pass objcopy args for stripping on OSX When `-Cstrip` was changed in rust-lang#131405 to use the bundled rust-objcopy instead of /usr/bin/strip on OSX, strip-like arguments were preserved. But strip and objcopy are, while being the same binary, different, they have different defaults depending on which binary they are. Notably, strip strips everything by default, and objcopy doesn't strip anything by default. Additionally, `-S` actually means `--strip-all`, so debuginfo stripped everything and symbols didn't strip anything. We now correctly pass `--strip-debug` and `--strip-all`. fixes rust-lang#135028 try-job: aarch64-apple try-job: dist-aarch64-apple
Re-opening for the backport. |
Consider this basic example:
When compiled with
cargo build
and the followingCargo.toml
:we see the following profile with
samply record
:That is, all symbols are still there. However, when we instead build with
we see the following profile:
I believe this is a bug, as the documentation for
strip
specifies thatsymbols
is supposed to be a more aggressive stripping thandebuginfo
, which is supposed to leave backtrace information mostly intact. We see the opposite behavior.The following lines of code are suspect:
rust/compiler/rustc_codegen_ssa/src/back/link.rs
Lines 1103 to 1118 in bf6f8a4
-S
onrust-objcopy
is documented as such:It does not seem appropriate to be used in the
Debuginfo
branch, but omitted in theSymbols
branch.The text was updated successfully, but these errors were encountered: