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

Don't force rustc to do codegen for LTO builds #8192

Merged
merged 1 commit into from
May 4, 2020

Commits on May 4, 2020

  1. Don't force rustc to do codegen for LTO builds

    This commit updates Cargo's implementation of LTO builds to do less work
    and hopefully be faster when doing a cold build. Additionaly this should
    save space on disk! The general idea is that the compiler does not need
    object files if it's only going to perform LTO with some artifacts. In
    this case all rustc needs to do is load bitcode from dependencies. This
    means that if you're doing an LTO build generating object code for
    intermediate dependencies is just wasted time!
    
    Here Cargo is updated with more intrusive knowledge about LTO. Cargo
    will now analyze the dependency graph to figure out which crates are
    being compiled with LTO, and then it will figure out which dependencies
    only need to have bitcode in them. Pure-bitcode artifacts are emitted
    with the `-Clinker-plugin-lto` flag. Some artifacts are still used in
    multiple scenarios (such as those shared between build scripts and final
    artifacts), so those are not compiled with `-Clinker-plugin-lto` since
    the linker is not guaranteed to know how to perform LTO.
    
    This functionality was recently implemented in rust-lang/rust#71528
    where rustc is now capable of reading bitcode from `-Clinker-plugin-lto`
    rlibs. Previously rustc would only read its own format of bitcode, but
    this has now been extended! This support is now on nightly, hence this
    PR.
    alexcrichton committed May 4, 2020
    Configuration menu
    Copy the full SHA
    e221925 View commit details
    Browse the repository at this point in the history