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

Docs are missing possible values for LTO #6214

Closed
0xpr03 opened this issue Oct 24, 2018 · 5 comments · Fixed by #7591
Closed

Docs are missing possible values for LTO #6214

0xpr03 opened this issue Oct 24, 2018 · 5 comments · Fixed by #7591
Labels
A-documenting-cargo-itself Area: Cargo's documentation

Comments

@0xpr03
Copy link

0xpr03 commented Oct 24, 2018

Problem

Docs are missing the possible values for lto.
I just got to know via #rust irc about

[profile.release]
lto = "fat"

This value isn't listed or documented in the cargo docs.

Steps

  1. Go to https://doc.rust-lang.org/cargo/reference/config.html#configuration-keys it's not documented

Possible Solution(s)

Document all possible values.

Notes
I was told that lto is enabled by default for release builds, going by the docs that isn't true, is it ?
At least for me it made a difference of ~3 MiB to set lto = "fat"

@ehuss
Copy link
Contributor

ehuss commented Oct 24, 2018

The LTO settings and defaults are documented at https://doc.rust-lang.org/cargo/reference/manifest.html#the-profile-sections
true is the same as "fat LTO". Debug/release default to LTO off (false).

@magicmaaaaan
Copy link

One thing that's not clear is if enabling lto affects codegen-units.

There's a note in the code, but that condition seems to set codegen-units regardless.

@0xpr03
Copy link
Author

0xpr03 commented Oct 24, 2018

I'd also like to have some more clarification about "fat" etc being the same. And a note that you can trim down the size even more by using this.
As I've said @ehuss it's not about the option itself, it's about the value and it's effect.

@ehuss
Copy link
Contributor

ehuss commented Oct 24, 2018

Yea, I think it could definitely mention that true is the same as "fat". As for documenting exactly what LTO does, and what the different modes are, I would think that should live in the rustc book and the cargo docs could just point there. It currently doesn't say too much, deferring to the LLVM docs. There are a variety of codegen options (like s/z optimizations) that are underdocumented, but it's not always clear what should be said. These kinds of things change over time, and the documentation will almost certainly fall out of date.

@ehuss
Copy link
Contributor

ehuss commented Oct 24, 2018

There's also a rustc issue rust-lang/rust#48518 about the codegen units/lto interaction.

@ehuss ehuss added the A-documenting-cargo-itself Area: Cargo's documentation label Nov 18, 2018
@bors bors closed this as completed in b35bb1b Dec 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-documenting-cargo-itself Area: Cargo's documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants