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

Let custom codegen backends opt out of LTO #68349

Open
bjorn3 opened this issue Jan 18, 2020 · 3 comments
Open

Let custom codegen backends opt out of LTO #68349

bjorn3 opened this issue Jan 18, 2020 · 3 comments
Labels
A-codegen Area: Code generation A-cranelift Things relevant to the [future] cranelift backend A-linkage Area: linking into static, shared libraries and binaries C-feature-request Category: A feature request, i.e: not implemented / a PR. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@bjorn3
Copy link
Member

bjorn3 commented Jan 18, 2020

For example cg_clif doesn't support LTO. Unfortunately enabling LTO makes the linker code always omit object files, so attempting to use -Clto=yes will result in a linker error. It is not practical to just not pass -Clto=yes, as many crates enable it in their Cargo.toml. I would like to be able to make cg_clif tell rustc that LTO should be disabled, even when -Clto=yes is passed. I think there should still be a warning though.

@jonas-schievink jonas-schievink added A-codegen Area: Code generation A-linkage Area: linking into static, shared libraries and binaries T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 18, 2020
@JohnTitor JohnTitor added the C-feature-request Category: A feature request, i.e: not implemented / a PR. label Feb 16, 2020
@bjorn3
Copy link
Member Author

bjorn3 commented Mar 12, 2020

@rustbot modify labels:+A-cranelift

@rustbot rustbot added the A-cranelift Things relevant to the [future] cranelift backend label Mar 12, 2020
@michaelwoerister
Copy link
Member

I think the entirety of LTO should be implemented in the specific backends. It makes no sense to me to have it in the backend interface.

@bjorn3
Copy link
Member Author

bjorn3 commented Mar 23, 2020

The linker code knows that when LTO is enabled, object files should be removed from rlibs before executing the linker. It only keeps the bitcode in that case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation A-cranelift Things relevant to the [future] cranelift backend A-linkage Area: linking into static, shared libraries and binaries C-feature-request Category: A feature request, i.e: not implemented / a PR. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants