Skip to content
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

Function sections should be enabled by default in the static compiler #12140

Closed
Tobba opened this issue Feb 9, 2014 · 4 comments
Closed

Function sections should be enabled by default in the static compiler #12140

Tobba opened this issue Feb 9, 2014 · 4 comments

Comments

@Tobba
Copy link
Contributor

Tobba commented Feb 9, 2014

This would greatly reduce the size of staticaly linked binaries if ld is invoked with -gc-sections

@alexcrichton
Copy link
Member

In the past I found that this significantly slowed down the linker, and this is what -Zlto was added for. Things may have changed though!

The --gc-sections flag can have other unforseen side effects, and I'm not sure if we'd want to officially support being able to run it. I remember it stripping out metadata, but there are indeed ways to get around that, so perhaps I didn't dig enough.

@alexcrichton
Copy link
Member

The good news is that this is just a flag that we pass through to LLVM somewhere and it'll just magically do it all for us, so with the new -C flag this will be easy to add.

@thestinger
Copy link
Contributor

I don't think this should be enabled by default. It makes the remaining code larger and slower, and the same positive effects can be gained by doing link-time optimization. Making binaries smaller will require altering the design of the standard library, as using link-time optimization strips out even more than --gc-sections with function sections but doesn't result in binaries anywhere near the size you can get with C or C++.

@alexcrichton
Copy link
Member

I compiled rust with make RUSTFLAGS='-C llvm-args=-ffunction-sections' to do some analysis (on linux). I found that all libraries saw about a 20% size increase, and link times for hello world doubled from ~100ms to ~200ms.

With this in mind I don't think that we're going to want to turn this on by default. I'm going to close this in favor of #12455

bors added a commit to rust-lang-ci/rust that referenced this issue Jul 25, 2022
Complete type param/associated type in trait generic arg per arg index

- Fix rust-lang#12140
- Also fix tidy check does not work for marks in multiline
flip1995 pushed a commit to flip1995/rust that referenced this issue Jan 25, 2024
…_is_some, r=llogiq

Improve help message for `search_is_some` lint

Fixes rust-lang#11681.

Like mentioned in the issue, we tend to use the formulation "consider using", which we didn't in this case. I think it clears both the confusion and also makes help message more coherent overall.

r? `@llogiq`

changelog: Improve help message for `search_is_some` lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants