Repository navigation
[Windows] Fix MASM flags in Windows GN tool("asm") - #197464
Merged
Merged
Conversation
`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.
Contributor
There was a problem hiding this comment.
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.
mraleph
reviewed
Nov 26, 2026
mraleph
approved these changes
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
engine/src/build/toolchain/win/BUILD.gnhad an invertedif (is_msvc_assembler)check intool("asm"), passing GCC/Clang-style-c -o{{output}} {{source}}flags toml64.exe/ml.exeinstead of MASM's/c /Fo{{output}} {{source}}. MASM ignored-o...with warning A4018 and exited 0 without writing the expected.objfile, causinglink.exeto fail withLNK1181when assembling Windows x64.Sfiles (such as Dart'sffi_test/clobber_x64_win.S).Both MASM (
ml64.exe/ml.exe) andclang-cl.exe(used for Windows arm64) take/c /Fo{{output}} {{source}}, so remove the invertedis_msvc_assemblerbranch and pass/c /Fo{{output}} {{source}}directly.Also avoid propagating Windows C/C++
cflags(/GS,/FS,/guard:cf,-m64,-fcolor-diagnostics) intoasmflagsfor Windows x86/x64 MASM targets inengine/src/build/config/compiler/BUILD.gnto eliminateMASM : warning A4018noise.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.