-
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
Tracking issue for -Z strip=val
option
#72110
Comments
rustc-book: Document `-Z strip=val` option cc rust-lang#72110
rustc-book: Document `-Z strip=val` option cc rust-lang#72110
rustc-book: Document `-Z strip=val` option cc rust-lang#72110
Is there a way to make the compiler emit separate debug symbol files (besides the default on Windows)? |
This flag doesn't seem to work with the Darwin linker (ld64). MacOS is defined to use the gcc linker flavor, but although it uses clang, the underlying ld64 doesn't support gcc options. Is there an intent to support that? |
That's pretty much all I know about MacOS linker and MacOS in general, so no plans to fix it from me. |
Disable strip_works test on macos. This feature doesn't work on macOS, because it uses ld64 with clang. See rust-lang/rust#72110 (comment).
MacOS linker supports |
…henkov Use shorthand linker strip arguments in order to support MacOS Per discussion from rust-lang#72110 (comment) onward, the current `-Z strip` options aren't supported by the MacOS linker, but I think only because it doesn't support the longhand arguments `--strip-debug` and `--strip-all`. This PR switches to using the shorthand arguments `-s` and `-S` instead, which (I believe) are supported by all GCC linkers.
It turns out that, whilst the MacOS linker accepts the The MacOS linker no longer provides any ability to strip its output. Instead, Apple provide a |
This option needs to accept Including this option would make a lot of sense and simplify usage of it (but would not remove the old functionality either) |
What's the blocker on this? I've been using this option for months without noticing any problem, is someone actively looking into it or this just sitting here? |
@morr0ne for what I can tell, this option doesn't work on MacOS yet, as expressed in the comment above:
|
@AlexApps99 that just landed in cargo's main branch:
|
When do we expect this to be released onto stable rust? |
It seems even with cargo-features = ["strip"]
[package]
name = "hello"
version = "0.1.0"
edition = "2018"
[profile.release]
strip = "symbols" And then:
Also, without modifying the generated
So hopefully cargo can produce binaries as small as what |
Just realized this is because cargo uses |
It's not using |
Not on macOS? calavera@df0fc6d |
Also checked that on Ubuntu, cargo produces the same sizes of binaries as |
@zizhengtai That does seem inconsistent. I think we want to use the same behavior as |
Submitted #88137 to try to address this. |
Could someone on @rust-lang/compiler familiar with macOS review #88137 , please? I think that may be the last blocker to stabilizing strip support in rust and then in cargo. |
#88137 is currently waiting on bors (thanks @michaelwoerister!); once that goes in, I'd like to propose stabilizing this option (as |
I think #81024 is a potential blocker, or at least, I would want to be convinced otherwise. |
@Mark-Simulacrum I would like to see better support for split debug, but I don't see how an issue with split debug affects the stabilization of the strip option. I don't see any mention of the strip option in the linked issue. |
Ah, I think I entirely misread somehow and thought this was about splitting as well. Yes, I agree that just stabilizing strip seems not really connected - #81024 is not a blocker then :) Sorry! |
Stabilization PR at #90058 |
#90058 has been merged! |
@joshtriplett Is there an estimation of when a new release containing this feature will be released? |
Seems to be coming in 1.58 (coming to beta next week, to release in mid-January). |
@guytbk there's a PR to add this option to cargo too: rust-lang/cargo#10088 |
Just updated rust to latest stable 1.58, but What happened? |
As mentioned in the notes support was stabilized in rustc but not in Cargo. Cargo support will be coming in the next release. |
Option
-Z strip=val
controls stripping of debuginfo and similar auxiliary data from binariesduring linking.
Supported values for this option are:
none
- debuginfo and symbols (if they exist) are copied to the produced binary or separate filesdepending on the target (e.g.
.pdb
files in case of MSVC).debuginfo
- debuginfo sections and debuginfo symbols from the symbol table sectionare stripped at link time and are not copied to the produced binary or separate files.
symbols
- same asdebuginfo
, but the rest of the symbol table section is stripped as wellif the linker supports it.
History:
-Z strip=val
option #72111.The text was updated successfully, but these errors were encountered: