Skip to content

[Windows] Fix MASM flags in Windows GN tool("asm") - #197464

Merged
auto-submit[bot] merged 1 commit into
flutter:masterfrom
dcharkes:fix-win-asm-flags
Nov 26, 2026
Merged

auto-submit[bot] merged 1 commit into
flutter:masterfrom
dcharkes:fix-win-asm-flags

Conversation

@dcharkes

@dcharkes dcharkes commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

engine/src/build/toolchain/win/BUILD.gn had an inverted if (is_msvc_assembler) check in tool("asm"), passing GCC/Clang-style -c -o{{output}} {{source}} flags to ml64.exe/ml.exe instead of MASM's /c /Fo{{output}} {{source}}. MASM ignored -o... with warning A4018 and exited 0 without writing the expected .obj file, causing link.exe to fail with LNK1181 when assembling Windows x64 .S files (such as Dart's ffi_test/clobber_x64_win.S).

Both MASM (ml64.exe/ml.exe) and clang-cl.exe (used for Windows arm64) take /c /Fo{{output}} {{source}}, so remove the inverted is_msvc_assembler branch and pass /c /Fo{{output}} {{source}} directly.

Also avoid propagating Windows C/C++ cflags (/GS, /FS, /guard:cf, -m64, -fcolor-diagnostics) into asmflags for Windows x86/x64 MASM targets in engine/src/build/config/compiler/BUILD.gn to eliminate MASM : warning A4018 noise.

Fixes Flutter build error from:

That started ocuring after:

Related fix on Dart side:

This PR should be able to land independently from the Dart CLs, but needs to land before the roll.

`engine/src/build/toolchain/win/BUILD.gn` had an inverted
`if (is_msvc_assembler)` check in `tool("asm")`, passing GCC/Clang-style
`-c -o{{output}} {{source}}` flags to `ml64.exe`/`ml.exe` instead of
MASM's `/c /Fo{{output}} {{source}}`. MASM ignored `-o...` with warning
A4018 and exited 0 without writing the expected `.obj` file, causing
`link.exe` to fail with `LNK1181` when assembling Windows x64 `.S` files
(such as Dart's `ffi_test/clobber_x64_win.S`).

Both MASM (`ml64.exe`/`ml.exe`) and `clang-cl.exe` (used for Windows
arm64) take `/c /Fo{{output}} {{source}}`, so remove the inverted
`is_msvc_assembler` branch and pass `/c /Fo{{output}} {{source}}`
directly.

Also avoid propagating Windows C/C++ `cflags` (`/GS`, `/FS`, `/guard:cf`,
`-m64`, `-fcolor-diagnostics`) into `asmflags` for Windows x86/x64 MASM
targets in `engine/src/build/config/compiler/BUILD.gn` to eliminate
`MASM : warning A4018` noise.
@github-actions github-actions Bot added the engine flutter/engine related. See also e: labels. label Nov 26, 2026
@dcharkes
dcharkes requested review from jtmcdole and mraleph November 26, 2026 13:24
@dcharkes
dcharkes marked this pull request as ready for review November 26, 2026 13:24

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request modifies the GN build configuration for Windows compilation. In engine/src/build/config/compiler/BUILD.gn, compiler flags (cflags) are no longer assigned to asmflags on Windows unless the target CPU is ARM64, preventing errors with MSVC assemblers (ml.exe/ml64.exe) which reject C/C++ compiler flags. In engine/src/build/toolchain/win/BUILD.gn, the is_msvc_assembler flag is removed, and the assembler command is simplified to directly use the /c /Fo flags. I have no feedback to provide on these changes.

@dcharkes dcharkes added the CICD Run CI/CD label Nov 26, 2026
Comment thread engine/src/build/toolchain/win/BUILD.gn Resolved
@dcharkes
dcharkes requested a review from mraleph November 26, 2026 15:53
@dcharkes dcharkes added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 26, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Nov 26, 2026
Merged via the queue into flutter:master with commit 2929464 Nov 26, 2026
28 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 26, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Nov 27, 2026
flutter/flutter@82ec424...43150a8

2026-11-27 [email protected] Windows: fix for popup descendent of popup closing the whole tree when the 2nd popup gains focus (flutter/flutter#196911)
2026-11-27 [email protected] Roll Skia from d693d85a4b77 to fe34f20b9689 (1 revision) (flutter/flutter#197491)
2026-11-27 [email protected] Roll Dart SDK from 691817e0ec3b to 5c3e102fc422 (1 revision) (flutter/flutter#197489)
2026-11-27 [email protected] Roll Fuchsia Linux SDK from 0bgCrr76CM4IqPO0v... to cBAjguERWwvY6tFtz... (flutter/flutter#197488)
2026-11-27 [email protected] [flutter_tools] Delete AppContext and legacy test context shims (flutter/flutter#197412)
2026-11-26 [email protected] Revert: [tool][engine] Enable experimental VM service by default (flutter/flutter#197481)
2026-11-26 [email protected] iOS: Remove engine includes from the platform views controller headers (flutter/flutter#197429)
2026-11-26 [email protected] [tool][engine] Enable experimental VM service by default (flutter/flutter#190100)
2026-11-26 [email protected] Add trust gate flags for "flutter analyze" (flutter/flutter#196415)
2026-11-26 [email protected] Roll Dart SDK from 7fcaf46b0308 to 691817e0ec3b (1 revision) (flutter/flutter#197475)
2026-11-26 [email protected] [Windows] Fix MASM flags in Windows GN `tool("asm")` (flutter/flutter#197464)
2026-11-26 [email protected] Roll Skia from cef5963c1bb2 to d693d85a4b77 (2 revisions) (flutter/flutter#197469)
2026-11-26 [email protected] Roll Packages from 105a874 to da586f5 (3 revisions) (flutter/flutter#197471)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD engine flutter/engine related. See also e: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants