[PATCH] D37530: [MinGW] Allow overriding which version of msvcrt to link to

Martin Storsjö via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 6 22:16:36 PDT 2017


mstorsjo added a comment.

In https://reviews.llvm.org/D37530#862644, @rnk wrote:

> What do you think of letting people spell this as `-lmsvcrt120`? We could forward those options and suppress our implicit addition of `-lmsvcrt` if we see `-lmsvcr*` anywhere.


That might work and would probably be sensible. Does the argument order matter, if the `-lmsvcr120` is listed at the end or at the same spot as `-lmsvcrt` were to be included?

Another complicating matter is that the pattern shouldn't just be `-lmsvcr*`, it should also match `-lucrtbase` since that's the name of the new Win10 CRT DLL (that I've just posted patches for mingw to support). And not sure if there later would be another import library for the case where one would link to `api-ms-win-crt*-dll` instead (which is mostly similar `ucrtbase.dll` but split up over a number of smaller files).



================
Comment at: lib/Driver/ToolChains/MinGW.cpp:161
       if (TC.getArch() == llvm::Triple::x86)
-        CmdArgs.push_back("_DllMainCRTStartup at 12");
+        CmdArgs.push_back("DllMainCRTStartup at 12");
       else
----------------
rnk wrote:
> I guess ld.bfd for COFF does some wacky name mangling. =/
Oh, sorry - this was unrelated to this patch and slip through accidentally. (It turned out to be an issue with the lld mingw frontend, not with clang itself.)


https://reviews.llvm.org/D37530





More information about the cfe-commits mailing list