-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Closed
Labels
A-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesO-windows-msvcToolchain: MSVC, Operating system: WindowsToolchain: MSVC, Operating system: WindowsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Description
For -windows-msvc targets linking the C runtime (e.g. C main, etc) is done in the libc crate which then hard codes the CRT startup libraries to use, which means they can't be overridden (without hacks or no_std) except to choose between dynamic or static linking. This makes it difficult to select the right CRT for certain builds. This matters particularly when integrating Rust alongside existing C/C++ build systems. The same CRT must be used in all cases.
I would propose that rustc should behave more like cl (the MSVC compiler) in this case. We should use /DEFAULTLIB: to link the CRT so the library is overridable rather than hard coded. This also means it can work with existing tools rather than needing anything custom for rustc.
CGMossa, Chaoses-Ib, ellacrity, xthexder, Tastaturtaste and 1 more
Metadata
Metadata
Assignees
Labels
A-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesO-windows-msvcToolchain: MSVC, Operating system: WindowsToolchain: MSVC, Operating system: WindowsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.