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 7 pull requests #95911

Closed
wants to merge 23 commits into from
Closed

Commits on Apr 2, 2022

  1. Add a test for issue 47384

    nbdd0121 committed Apr 2, 2022
    Configuration menu
    Copy the full SHA
    a867b8d View commit details
    Browse the repository at this point in the history
  2. Add SymbolExportInfo

    This is currently a wrapper to `SymbolExportLevel` but it allows
    later addition of extra information.
    nbdd0121 committed Apr 2, 2022
    Configuration menu
    Copy the full SHA
    aa8413c View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    08b7029 View commit details
    Browse the repository at this point in the history

Commits on Apr 4, 2022

  1. Configuration menu
    Copy the full SHA
    c34473b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c1fa773 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e0ed0f4 View commit details
    Browse the repository at this point in the history

Commits on Apr 5, 2022

  1. Configuration menu
    Copy the full SHA
    fefc69a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3730fe3 View commit details
    Browse the repository at this point in the history

Commits on Apr 9, 2022

  1. Configuration menu
    Copy the full SHA
    77f610e View commit details
    Browse the repository at this point in the history
  2. Switch to the 'normal' basic block for writing asm outputs if needed.

    We may sometimes emit an `invoke` instead of a `call` for inline
    assembly during the MIR -> LLVM IR lowering. But we failed to update
    the IR builder's current basic block before writing the results to the
    outputs. This would result in invalid IR because the basic block would
    end in a `store` instruction, which isn't a valid terminator.
    luqmana committed Apr 9, 2022
    Configuration menu
    Copy the full SHA
    bf3ef0d View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    0b2f360 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    460054c View commit details
    Browse the repository at this point in the history

Commits on Apr 10, 2022

  1. Configuration menu
    Copy the full SHA
    98cd818 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    80152ed View commit details
    Browse the repository at this point in the history
  3. Allow usage of sudo while not accessing root

    gimbles committed Apr 10, 2022
    Configuration menu
    Copy the full SHA
    386ca6a View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    dfe13db View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#94468 - Amanieu:global_asm_sym, r=nagisa

    Implement sym operands for global_asm!
    
    Tracking issue: rust-lang#93333
    
    This PR is pretty much a complete rewrite of `sym` operand support for inline assembly so that the same implementation can be shared by `asm!` and `global_asm!`. The main changes are:
    - At the AST level, `sym` is represented as a special `InlineAsmSym` AST node containing a path instead of an `Expr`.
    - At the HIR level, `sym` is split into `SymStatic` and `SymFn` depending on whether the path resolves to a static during AST lowering (defaults to `SynFn` if `get_early_res` fails).
      - `SymFn` is just an `AnonConst`. It runs through typeck and we just collect the resulting type at the end. An error is emitted if the type is not a `FnDef`.
      - `SymStatic` directly holds a path and the `DefId` of the `static` that it is pointing to.
    - The representation at the MIR level is mostly unchanged. There is a minor change to THIR where `SymFn` is a constant instead of an expression.
    - At the codegen level we need to apply the target's symbol mangling to the result of `tcx.symbol_name()` depending on the target. This is done by calling the LLVM name mangler, which handles all of the details.
      - On Mach-O, all symbols have a leading underscore.
      - On x86 Windows, different mangling is used for cdecl, stdcall, fastcall and vectorcall.
      - No mangling is needed on other platforms.
    
    r? ``@nagisa``
    cc ``@eddyb``
    Dylan-DPC committed Apr 10, 2022
    Configuration menu
    Copy the full SHA
    0ca05f1 View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#95604 - nbdd0121:used2, r=petrochenkov

    Generate synthetic object file to ensure all exported and used symbols participate in the linking
    
    Fix rust-lang#50007 and rust-lang#47384
    
    This is the synthetic object file approach that I described in rust-lang#95363 (comment), allowing all exported and used symbols to be linked while still allowing them to be GCed.
    
    Related rust-lang#93791, rust-lang#95363
    
    r? `@petrochenkov`
    cc `@carbotaniuman`
    Dylan-DPC committed Apr 10, 2022
    Configuration menu
    Copy the full SHA
    406e171 View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#95671 - gimbles:master, r=Mark-Simulacrum

    feat: Allow usage of sudo [while not accessing root] in x.py
    
    # Fixes
    This PR should fix rust-lang#93344
    # Info
    Allows usage of sudo (while not accessing root) in x.py
    Dylan-DPC committed Apr 10, 2022
    Configuration menu
    Copy the full SHA
    b51979a View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#95758 - compiler-errors:issue-54771, r=este…

    …bank
    
    Only suggest removing semicolon when expression is compatible with `impl Trait`
    
    rust-lang#54771 (comment)
    > It still needs checking that the last statement's expr can actually conform to the trait, but the naïve behavior is there.
    
    Only suggest removing a semicolon when the type behind the semicolon actually implements the trait in an RPIT `-> impl Trait`. Also upgrade the label that suggests removing the semicolon to a suggestion (should it be verbose?).
    
    cc rust-lang#54771
    Dylan-DPC committed Apr 10, 2022
    Configuration menu
    Copy the full SHA
    d1d8fa4 View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#95861 - ChrisDenton:windows7-support, r=Dyl…

    …an-DPC
    
    Note that CI tests Windows 10
    
    Currently being [discussed on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Windows.207).
    
    r? `@joshtriplett`
    Dylan-DPC committed Apr 10, 2022
    Configuration menu
    Copy the full SHA
    83fe17a View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#95864 - luqmana:inline-asm-unwind-store-mis…

    …compile, r=Amanieu
    
    Fix miscompilation of inline assembly with outputs in cases where we emit an invoke instead of call instruction.
    
    We ran into this bug where rustc would segfault while trying to compile certain uses of inline assembly.
    
    Here is a simple repro that demonstrates the issue:
    ```rust
    #![feature(asm_unwind)]
    
    fn main() {
        let _x = String::from("string here just cause we need something with a non-trivial drop");
        let foo: u64;
        unsafe {
            std::arch::asm!(
                "mov {}, 1",
                out(reg) foo,
                options(may_unwind)
            );
        }
        println!("{}", foo);
    }
    ```
    ([playground link](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=7d6641e83370d2536a07234aca2498ff))
    
    But crucially `feature(asm_unwind)` is not actually needed and this can be triggered on stable as a result of the way async functions/generators are handled in the compiler. e.g.:
    
    ```rust
    extern crate futures; // 0.3.21
    
    async fn bar() {
        let foo: u64;
        unsafe {
            std::arch::asm!(
                "mov {}, 1",
                out(reg) foo,
            );
        }
        println!("{}", foo);
    }
    
    fn main() {
        futures::executor::block_on(bar());
    }
    ```
    ([playground link](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=1c7781c34dd4a3e80ae4bd936a0c82fc))
    
    An example of the incorrect LLVM generated:
    ```llvm
    bb1:                                              ; preds = %start
      %1 = invoke i64 asm sideeffect alignstack inteldialect unwind "mov ${0:q}, 1", "=&r,~{dirflag},~{fpsr},~{flags},~{memory}"()
              to label %bb2 unwind label %cleanup, !srcloc !9
      store i64 %1, i64* %foo, align 8
    
    bb2:
    [...snip...]
    ```
    
    The store should not be placed after the asm invoke but rather should be in the normal control flow basic block (`bb2` in this case).
    
    [Here](https://gist.github.com/luqmana/be1af5b64d2cda5a533e3e23a7830b44) is a writeup of the investigation that lead to finding this.
    Dylan-DPC committed Apr 10, 2022
    Configuration menu
    Copy the full SHA
    6d93832 View commit details
    Browse the repository at this point in the history
  11. Rollup merge of rust-lang#95881 - TaKO8Ki:use-to-string-instead-of-fo…

    …rmat, r=compiler-errors
    
    Use `to_string` instead of `format!`
    Dylan-DPC committed Apr 10, 2022
    Configuration menu
    Copy the full SHA
    82f9f57 View commit details
    Browse the repository at this point in the history