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

Rollup of 6 pull requests #125463

Merged
merged 23 commits into from
May 24, 2024
Merged

Rollup of 6 pull requests #125463

merged 23 commits into from
May 24, 2024

Commits on May 21, 2024

  1. Configuration menu
    Copy the full SHA
    fde4a22 View commit details
    Browse the repository at this point in the history
  2. add helper to target bin path

    lqd committed May 21, 2024
    Configuration menu
    Copy the full SHA
    6867d64 View commit details
    Browse the repository at this point in the history

Commits on May 22, 2024

  1. rustc_codegen_llvm: add support for writing summary bitcode

    Typical uses of ThinLTO don't have any use for this as a standalone
    file, but distributed ThinLTO uses this to make the linker phase more
    efficient. With clang you'd do something like `clang -flto=thin
    -fthin-link-bitcode=foo.indexing.o -c foo.c` and then get both foo.o
    (full of bitcode) and foo.indexing.o (just the summary or index part of
    the bitcode). That's then usable by a two-stage linking process that's
    more friendly to distributed build systems like bazel, which is why I'm
    working on this area.
    
    I talked some to @teresajohnson about naming in this area, as things
    seem to be a little confused between various blog posts and build
    systems. "bitcode index" and "bitcode summary" tend to be a little too
    ambiguous, and she tends to use "thin link bitcode" and "minimized
    bitcode" (which matches the descriptions in LLVM). Since the clang
    option is thin-link-bitcode, I went with that to try and not add a new
    spelling in the world.
    
    Per @dtolnay, you can work around the lack of this by using `lld
    --thinlto-index-only` to do the indexing on regular .o files of
    bitcode, but that is a bit wasteful on actions when we already have all
    the information in rustc and could just write out the matching minimized
    bitcode. I didn't test that at all in our infrastructure, because by the
    time I learned that I already had this patch largely written.
    durin42 committed May 22, 2024
    Configuration menu
    Copy the full SHA
    aa91871 View commit details
    Browse the repository at this point in the history
  2. cleanup: remove leftover extra block

    This was needed in an older version of this patch, but never got edited
    out when it became obsolete.
    durin42 committed May 22, 2024
    Configuration menu
    Copy the full SHA
    03d5556 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    1c7859e View commit details
    Browse the repository at this point in the history

Commits on May 23, 2024

  1. Configuration menu
    Copy the full SHA
    de64462 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c398b2c View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    324b66c View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    a59589b View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    2868985 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    45ad60d View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    fab28f2 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    d64a8bd View commit details
    Browse the repository at this point in the history
  9. thinlto: only build summary file if needed

    If we don't do this, some versions of LLVM (at least 17, experimentally)
    will double-emit some error messages, which is how I noticed this. Given
    that it seems to be costing some extra work, let's only request the
    summary bitcode production if we'll actually bother writing it down,
    otherwise skip it.
    durin42 committed May 23, 2024
    Configuration menu
    Copy the full SHA
    de8200c View commit details
    Browse the repository at this point in the history
  10. cleanup: standardize on summary over index in names

    I did this in the user-facing logic, but I noticed while fixing a minor
    defect that I had missed it in a few places in the internal details.
    durin42 committed May 23, 2024
    Configuration menu
    Copy the full SHA
    3ea4941 View commit details
    Browse the repository at this point in the history
  11. cleanup: run rustfmt

    durin42 committed May 23, 2024
    Configuration menu
    Copy the full SHA
    a0581b5 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    cfe3f77 View commit details
    Browse the repository at this point in the history
  13. Rollup merge of rust-lang#125263 - lqd:lld-fallback, r=petrochenkov

    rust-lld: fallback to rustc's sysroot if there's no path to the linker in the target sysroot
    
    As seen in rust-lang#125246, some sysroots don't expect to contain `rust-lld` and want to keep it that way, so we fallback to the default rustc sysroot if there is no path to the linker in any of the sysroot tools search paths. This is how we locate codegen-backends' dylibs already.
    
    People also have requested an error if none of these search paths contain the self-contained linker directory, so there's also an error in that case.
    
    r? `@petrochenkov` cc `@ehuss` `@RalfJung`
    
    I'm not sure where we check for `rust-lld`'s existence on the targets where we use it by default, and if we just ignore it when missing or emit a warning (as I assume we don't emit an error), so I just checked for the existence of `gcc-ld`, where `cc` will look for the lld-wrapper binaries.
    
    <sub>*Feel free to point out better ways to do this, it's the middle of the night here.*</sub>
    
    Fixes rust-lang#125246
    GuillaumeGomez committed May 23, 2024
    Configuration menu
    Copy the full SHA
    d6a1f1d View commit details
    Browse the repository at this point in the history
  14. Rollup merge of rust-lang#125345 - durin42:thin-link-bitcode, r=bjorn3

    rustc_codegen_llvm: add support for writing summary bitcode
    
    Typical uses of ThinLTO don't have any use for this as a standalone file, but distributed ThinLTO uses this to make the linker phase more efficient. With clang you'd do something like `clang -flto=thin -fthin-link-bitcode=foo.indexing.o -c foo.c` and then get both foo.o (full of bitcode) and foo.indexing.o (just the summary or index part of the bitcode). That's then usable by a two-stage linking process that's more friendly to distributed build systems like bazel, which is why I'm working on this area.
    
    I talked some to `@teresajohnson` about naming in this area, as things seem to be a little confused between various blog posts and build systems. "bitcode index" and "bitcode summary" tend to be a little too ambiguous, and she tends to use "thin link bitcode" and "minimized bitcode" (which matches the descriptions in LLVM). Since the clang option is thin-link-bitcode, I went with that to try and not add a new spelling in the world.
    
    Per `@dtolnay,` you can work around the lack of this by using `lld --thinlto-index-only` to do the indexing on regular .o files of bitcode, but that is a bit wasteful on actions when we already have all the information in rustc and could just write out the matching minimized bitcode. I didn't test that at all in our infrastructure, because by the time I learned that I already had this patch largely written.
    GuillaumeGomez committed May 23, 2024
    Configuration menu
    Copy the full SHA
    4ee97fc View commit details
    Browse the repository at this point in the history
  15. Rollup merge of rust-lang#125362 - joboet:tait_hack, r=Nilstrieb

    Actually use TAIT instead of emulating it
    
    `core`'s `impl_fn_for_zst` macro is just a hacky way of emulating TAIT. TAIT has become stable enough to be used [in other places](https://github.com/rust-lang/rust/blob/e8fbd991287f637f95016a71ddc13438415bbe59/library/std/src/backtrace.rs#L431) inside the standard library, so let's use it in `core` as well.
    GuillaumeGomez committed May 23, 2024
    Configuration menu
    Copy the full SHA
    1e4bde1 View commit details
    Browse the repository at this point in the history
  16. Rollup merge of rust-lang#125412 - Urgau:check-cfg-less-build-rs, r=w…

    …esleywiser
    
    Don't suggest adding the unexpected cfgs to the build-script it-self
    
    This PR adds a check to avoid suggesting to add the unexpected cfgs inside the build-script when building the build-script it-self, as it won't have any effect, since build-scripts applies to their descended target.
    
    Fixes rust-lang#125368
    GuillaumeGomez committed May 23, 2024
    Configuration menu
    Copy the full SHA
    56427d3 View commit details
    Browse the repository at this point in the history
  17. Rollup merge of rust-lang#125445 - GuillaumeGomez:rustdoc-migrate-sho…

    …rt-out-dir, r=jieyouxu
    
    Migrate `run-make/rustdoc-with-short-out-dir-option` to `rmake.rs`
    
    Part of rust-lang#121876.
    
    r? `@jieyouxu`
    GuillaumeGomez committed May 23, 2024
    Configuration menu
    Copy the full SHA
    0de052a View commit details
    Browse the repository at this point in the history
  18. Rollup merge of rust-lang#125452 - Urgau:check-cfg-libraries-cleanup,…

    … r=bjorn3
    
    Cleanup check-cfg handling in core and std
    
    Follow-up to rust-lang#125296 where we:
     - expect any feature cfg in std, due to `#[path]` imports
     - move some check-cfg args inside the `build.rs` as per Cargo recommendation
     - and replace the fake Cargo feature `"restricted-std"` by the custom cfg `restricted_std`
    
    Fixes rust-lang#125296 (comment)
    r? `@bjorn3` (maybe, feel free to re-roll)
    GuillaumeGomez committed May 23, 2024
    Configuration menu
    Copy the full SHA
    a8a71d0 View commit details
    Browse the repository at this point in the history