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

Use object crate for .rustc metadata generation #91604

Merged
merged 1 commit into from
Dec 8, 2021

Commits on Dec 7, 2021

  1. Use object crate for .rustc metadata generation

    We already use the object crate for generating uncompressed .rmeta
    metadata object files. This switches the generation of compressed
    .rustc object files to use the object crate as well. These have
    slightly different requirements in that .rmeta should be completely
    excluded from any final compilation artifacts, while .rustc should
    be part of shared objects, but not loaded into memory.
    
    The primary motivation for this change is rust-lang#90326: In LLVM 14, the
    current way of setting section flags (and in particular, preventing
    the setting of SHF_ALLOC) will no longer work. There are other ways
    we could work around this, but switching to the object crate seems
    like the most elegant, as we already use it for .rmeta, and as it
    makes this independent of the codegen backend. In particular, we
    don't need separate handling in codegen_llvm and codegen_gcc.
    codegen_cranelift should be able to reuse the implementation as
    well, though I have omitted that here, as it is not based on
    codegen_ssa.
    
    This change mostly extracts the existing code for .rmeta handling
    to allow using it for .rustc as well, and adjust the codegen
    infrastructure to handle the metadata object file separately: We
    no longer create a backend-specific module for it, and directly
    produce the compiled module instead.
    
    This does not fix rust-lang#90326 by itself yet, as .llvmbc will need to be
    handled separately.
    nikic committed Dec 7, 2021
    Configuration menu
    Copy the full SHA
    9488cac View commit details
    Browse the repository at this point in the history