-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
[LLD] please support MSVC ABI in GNU toolchain and support GNU ABI in MSVC toolchain #60847
Comments
What exactly is the use case you have in mind? |
@llvm/issue-subscribers-lld-coff |
This problem does only appear on Windows. |
Please mind that in almost all cases you do not want to mix MSVC static libraries (objects) with MinGW, even if they are plain C. Doing so is unsupported and is most certainly going to cause issues. Linking against MSVC dynamic libraries (DLLs) through a import lib from MinGW code (and vice versa) does work, however this applies to C linkage only. When exporting APIs that are expected to be usable from different compilers, they should be limited to C ABI and use
You can use those two ABIs together provided that they live in separate DLLs and you don't try to pass any C++ types between them 1. The MinGW C++ ABI is very much incompatible with the MSVC ABI, and name mangling is only a very small part of it. Making the name mangling "compatible" does not magically make them compatible. (For simple functions it may happen to work, but definitely not when C++ types starts getting involved.) Footnotes
|
Because of the two different name mangling rules (Visual C++ and MinGW-w64) on Windows, LLD cannot link against MSVC libraries in MinGW toolchain (x86_64-w64-windows-gnu) or link against GNU libraries in MSVC toolchain (x86_64-pc-windows-msvc).
Hope to support MSVC ABI in GNU toolchain and support GNU ABI in MSVC toolchain.
The text was updated successfully, but these errors were encountered: