diff options
| author | LIU Hao <lh_mouse@126.com> | 2024-12-11 09:27:53 +0800 |
|---|---|---|
| committer | Dylan Baker <dylan@pnwbakers.com> | 2024-12-10 19:42:06 -0800 |
| commit | e542901af6e30865715d3c3c18f703910a096ec0 (patch) | |
| tree | c1d59894787fff2abbde5a529a5a9ca0c3554056 | |
| parent | 8156e12ce0de62aa47472e529489f7412628e6e5 (diff) | |
| download | meson-e542901af6e30865715d3c3c18f703910a096ec0.tar.gz | |
compilers: Pass `vs_module_defs` with `/DEF:` to LLD-LINK
Recently, it is possible to install Clang with Visual Studio Installer. By
default this Clang has a MSVC target, and invokes the Microsoft Linker; if
`-fuse-ld=lld` is specified, it will invoke LLD-LINK. Both linkers take
MSVC-style arguments, and take DEF files with `/DEF:<path>`.
Previously DEF files were passed in the GNU way, directly on the linker
command line like an object file, which caused errors like
lld-link: error: ..\my.def: unknown file type
While Clang-CL takes Unix-style options, it actually passes MSVC-style
options to LINK or LLD-LINK with `-Wl,`. There is already a check for both
linkers in `linker_to_compiler_args()`, so it's necessary to do the same
in `gen_vs_module_defs_args()`.
This commit closes https://github.com/mesonbuild/meson/issues/13988.
Signed-off-by: LIU Hao <lh_mouse@126.com>
| -rw-r--r-- | mesonbuild/compilers/mixins/clang.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mesonbuild/compilers/mixins/clang.py b/mesonbuild/compilers/mixins/clang.py index a0d3d5ffb..41b35c041 100644 --- a/mesonbuild/compilers/mixins/clang.py +++ b/mesonbuild/compilers/mixins/clang.py @@ -135,7 +135,7 @@ class ClangCompiler(GnuLikeCompiler): return [] def gen_vs_module_defs_args(self, defsfile: str) -> T.List[str]: - if isinstance(self.linker, (MSVCDynamicLinker)): + if isinstance(self.linker, (ClangClDynamicLinker, MSVCDynamicLinker)): # With MSVC, DLLs only export symbols that are explicitly exported, # so if a module defs file is specified, we use that to export symbols return ['-Wl,/DEF:' + defsfile] |
