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

Store LLVM bitcode in object files, not compressed #71528

Merged
merged 1 commit into from
Apr 30, 2020

Commits on Apr 29, 2020

  1. Store LLVM bitcode in object files, not compressed

    This commit is an attempted resurrection of rust-lang#70458 where LLVM bitcode
    emitted by rustc into rlibs is stored into object file sections rather
    than in a separate file. The main rationale for doing this is that when
    rustc emits bitcode it will no longer use a custom compression scheme
    which makes it both easier to interoperate with existing tools and also
    cuts down on compile time since this compression isn't happening.
    
    The blocker for this in rust-lang#70458 turned out to be that native linkers
    didn't handle the new sections well, causing the sections to either
    trigger bugs in the linker or actually end up in the final linked
    artifact. This commit attempts to address these issues by ensuring that
    native linkers ignore the new sections by inserting custom flags with
    module-level inline assembly.
    
    Note that this does not currently change the API of the compiler at all.
    The pre-existing `-C bitcode-in-rlib` flag is co-opted to indicate
    whether the bitcode should be present in the object file or not.
    
    Finally, note that an important consequence of this commit, which is also
    one of its primary purposes, is to enable rustc's `-Clto` bitcode
    loading to load rlibs produced with `-Clinker-plugin-lto`. The goal here
    is that when you're building with LTO Cargo will tell rustc to skip
    codegen of all intermediate crates and only generate LLVM IR. Today
    rustc will generate both object code and LLVM IR, but the object code is
    later simply thrown away, wastefully.
    alexcrichton committed Apr 29, 2020
    Configuration menu
    Copy the full SHA
    ef89cc8 View commit details
    Browse the repository at this point in the history