Allow stripping debuginfo from LLVM's shared library #114259
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As seen in #114175, there's still some small amount of debuginfo in LLVM's shared library on linux, even when not requesting it (much like in
librustc_driver.so
), coming fromlibstdc++
.This PR adds a
llvm.strip-debuginfo
config to strip it away, when all of the following hold:llvm.link-shared
is truellvm.release-debuginfo
is false#114175 did the same thing unconditionally in
opt-dist
, prior to BOLTing LLVM. But this should be validated and used in conjunction with these other config options above, and whichopt-dist
doesn't know about. Therefore, it makes more sense as a dedicated option, to be used in bootstrap when building LLVM (and enabled in CI on e.g. thedist-x86_64-linux
builder).From the other PR,
libLLVM-16-rust-1.73.0-nightly.so
prior to #114141:And from this PR,
libLLVM-16-rust-1.73.0-nightly.so
after #114141:(Draft while I do some try builds to ensure this is working as expected on CI, and until I ask e.g. cuviper whether it's a good idea 😓. Or if we could avoid emitting that debuginfo in the first place, if at all possible).
(After we validate whether it's interesting, I could add similar mechanism for
librustc_driver.so
, which also has some debuginfo fromlibstdc++
, as well ascompiler_builtins
: I tested locally that removing that would reduce its size by about 10%.)(I also don't know if it should be added to
src/bootstrap/configure.py
, I don't think so. And may also need itscheck_ci_llvm!
to be removed, where CI needsdownload-ci-llvm
...)