Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compilers: Pass vs_module_defs with /DEF: to LLD-LINK #13998

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

lhmouse
Copy link
Contributor

@lhmouse lhmouse commented Dec 11, 2024

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 #13988.

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 mesonbuild#13988.

Signed-off-by: LIU Hao <lh_mouse@126.com>
@lhmouse lhmouse requested a review from dcbaker as a code owner December 11, 2024 01:39
@dcbaker dcbaker merged commit e542901 into mesonbuild:master Dec 11, 2024
33 checks passed
lhmouse added a commit to lhmouse/mcfgthread that referenced this pull request Dec 16, 2024
Clang-CL setups do not work with Meson 1.3 but they are already broken,
so let's wait.

Reference: mesonbuild/meson#13998
Reference: mesonbuild/meson#14012
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.

DEF file not passed properly to Clang + LLD-LINK for MSVC targets
2 participants