Skip to content

compilers: keep MSVC linker flags out of checks - #16094

Open
tianrking wants to merge 1 commit into
mesonbuild:masterfrom
tianrking:fix/msvc-linker-check-args
Open

compilers: keep MSVC linker flags out of checks#16094
tianrking wants to merge 1 commit into
mesonbuild:masterfrom
tianrking:fix/msvc-linker-check-args

Conversation

@tianrking

Copy link
Copy Markdown

Compiler.get_compiler_args_for_mode() started including the dynamic linker's always-arguments in 1.11. For MSVC builds, normal targets invoke link.exe separately, but compiler checks link through cl.exe. This placed linker-only options such as /release before /link, where cl.exe rejects them with D8043.

Keep link-mode compiler-check arguments limited to the MSVC compiler's own always-arguments. The regular link step still receives the dynamic linker's always-arguments through the backend.

The regression test uses the real MSVCDynamicLinker and verifies that link-mode compiler arguments do not contain its /release option.

Fixes #16086

Tests:

  • python run_unittests.py InternalTests.test_compiler_args_class_visualstudio
  • python run_mypy.py mesonbuild/compilers/mixins/visualstudio.py
  • git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MSVC: /release linker flag leaks into cl.exe command line in has_function() tests (regression in 1.11)

2 participants