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

LTO template? #371

Closed
XiangpengHao opened this issue Oct 28, 2020 · 3 comments
Closed

LTO template? #371

XiangpengHao opened this issue Oct 28, 2020 · 3 comments
Labels
linking Issues that manifest as link failures

Comments

@XiangpengHao
Copy link
Contributor

It's natural for us to consider supporting cross-language LTO (linking time optimization) out of the box, LTO is extremely helpful when you have a bunch of small functions in hotpath.

Right now, it's not easy becuase rust-lang/rust#60059, rust-lang/rust#56371

Firefox enabled LTO last year with nontrivial efforts http://blog.llvm.org/2019/09/closing-gap-cross-language-lto-between.html

@XiangpengHao
Copy link
Contributor Author

After some struggling, I made a minimal viable LTO setup with CMake here: https://github.com/XiangpengHao/cxx-cmake-example

This requires the system LLVM version to match with the rust LLVM version, for rust-1.49 it should be LLVM11.

@adetaylor
Copy link
Collaborator

Thanks a ton for doing this. I'm exactly your target audience: someone who really wants to use cross-language LTO with cxx but hadn't spared the time to figure out exactly the steps required. Cheers!

@dtolnay dtolnay added the linking Issues that manifest as link failures label Dec 13, 2020
@dtolnay
Copy link
Owner

dtolnay commented Oct 30, 2022

This is now linked from https://cxx.rs/build/cmake.html.

@dtolnay dtolnay closed this as completed Oct 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linking Issues that manifest as link failures
Projects
None yet
Development

No branches or pull requests

3 participants