Skip to content

Conversation

@amyspark
Copy link
Contributor

This PR fixes passing and detection of link arguments when using Microsoft's linker in combination with clang-cl or stock clang.

Currently, not only Meson lacks a way to induce a --fatal-warnings on LINK.exe, thus rendering all flag detection morose, it is also unable to pass flags appropriately by wrapping them in -Wl,.

This commit fixes it by implementing fatal_warnings() in the MSVCDynamicLinker and ClangCLDynamicLinker classes, and by implementing the requisite conversion steps in linker_to_compiler_args for ClangCompiler.

@nirbheek
Copy link
Member

LGTM otherwise, but maybe @eli-schwartz or @xclaesse will want to comment since they're more up-to-date on the compilers/linkers classes.

@amyspark amyspark force-pushed the fix-msvc-clangcl-linker-flag-detection branch from 9af1bdb to 26f31cc Compare August 21, 2023 15:56
@tristan957 tristan957 added this to the 1.3.0 milestone Aug 22, 2023
@nirbheek
Copy link
Member

@amyspark could you please add a test for this? I'm surprised this wasn't already caught by CI.

@nirbheek nirbheek modified the milestones: 1.3.0, 1.2.2 Aug 24, 2023
@amyspark amyspark force-pushed the fix-msvc-clangcl-linker-flag-detection branch 2 times, most recently from a8ef6de to 8cf2fb3 Compare September 1, 2023 02:46
@amyspark amyspark force-pushed the fix-msvc-clangcl-linker-flag-detection branch 2 times, most recently from 2507ef5 to c052d08 Compare September 6, 2023 02:29
@xclaesse xclaesse modified the milestones: 1.3.0, 1.4.0 Oct 17, 2023
@amyspark amyspark force-pushed the fix-msvc-clangcl-linker-flag-detection branch from c052d08 to 4f8945e Compare January 16, 2024 21:57
@tristan957
Copy link
Member

@bruchar1 can you test this?

Currently, not only Meson lacks a way to induce a "--fatal-warnings" on
LINK.exe, it is also unable to pass flags appropriately when using
clang-cl or Microsoft's stock clang.

This commit fixes it by implementing `fatal_warnings()` in the
MSVCDynamicLinker and ClangCLDynamicLinker classes, and by implementing
the requisite conversion steps in linker_to_compiler_args for
ClangCompiler.
The latter prefers LINK.exe by default, which rejects GNU-like linker
flags.
@amyspark amyspark force-pushed the fix-msvc-clangcl-linker-flag-detection branch from 4f8945e to f3fad6c Compare February 25, 2024 13:49
@jpakkane jpakkane merged commit 30c38e2 into mesonbuild:master Apr 4, 2024
@amyspark amyspark deleted the fix-msvc-clangcl-linker-flag-detection branch April 4, 2024 21:15
@bruchar1 bruchar1 modified the milestones: 1.4.0, 1.4.1 Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants