Skip to content

Make MSVC linker independence assertions inspect the driver and arguments #571

Closed

Description

@LunaStev

Evidence

The Windows GNU amd64 build at PR #569 head 834368d33f2595dfb8db1ef48dc2cd9e6850dade reports 62 passing / 2 failing codegen tests. One failure is explicit_msvc_targets_emit_coff_and_link_without_mingw at tests/codegen_regressions.rs:6143.

Failing job

The emitted MSVC plan selects lld-link.exe with /MACHINE:X64, /ENTRY:entry, and /NODEFAULTLIB. The executable is installed beneath msys64\mingw64\opt\llvm-21\bin. The test rejects the entire rendered plan with !plan.contains("mingw"), so the host installation directory alone fails the assertion. This does not establish that GNU target libraries or a GNU linker driver were selected.

Scope and acceptance

  • Inspect the selected program basename and actual link arguments instead of rejecting a substring anywhere in the rendered plan.
  • Accept a genuine lld-link.exe installed beneath a directory containing mingw.
  • Continue rejecting GNU linker drivers, GNU CRT/default-library arguments, and unintended target dependencies. Do not remove the independence check.
  • Cover positive and negative plan samples, then rerun this regression on Windows GNU amd64.
  • No new parser/JSON dependency is needed.

The same CI plan also contains a separate leaked -Wl,-e,entry argument from CLI entry handling; that production issue needs its own fix. Do not treat a corrected assertion as proof that all MSVC arguments are valid.

The other failing test is the existing mixed-path assertion tracked by #504. Related: #498, #292, #569.

Activity

  1. added
    good first issue
    ci
    bug
    build
    cross-platform
    on Sep 10, 2026
  2. LunaStev commented on Sep 11, 2026

    @LunaStev
    MemberAuthor

    Reconfirmed in PR #574 head ed149e7553c06efc30b5167920cc301563d6afb3: Windows GNU amd64 CI reports 66 passed / 1 failed in codegen_regressions.

    The sole failing regression remains explicit_msvc_targets_emit_coff_and_link_without_mingw, at tests/codegen_regressions.rs:6333. The actual driver is:

    D:\a\_temp\msys64\mingw64\opt\llvm-21\bin\lld-link.exe
    

    The plan uses MSVC options including /ENTRY:entry and /NODEFAULTLIB, but the assertion rejects the parent directory's mingw64 substring. The separate leaked GNU entry argument from #572 is absent in this run. explicit_entry_uses_the_selected_linker_dialect_once and msvc_link_companions_keep_final_names_and_survive_failed_replacement both pass.

    The existing small fix remains appropriate: inspect the parsed driver basename and individual linker arguments, including a valid MSVC tool installed beneath a directory containing mingw. Keep real MinGW runtime-dependency rejection. This audit leaves the good first issue available for contributors and makes no code changes.

  3. added a commit that references this issue on Sep 11, 2026
    39626c8
  4. added a commit that references this issue on Sep 12, 2026
    4a1328f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugbuildcicross-platformgood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions