[PATCH] D89702: [clang] [msvc] Automatically link against oldnames just as linking against libcmt

Martin Storsjö via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 19 13:39:00 PDT 2020


mstorsjo added a comment.

In D89702#2339716 <https://reviews.llvm.org/D89702#2339716>, @rnk wrote:

> lgtm
>
> We need to invent spellings for /MD /MT for the GCC-style driver if we want it to be usable in the MSVC environment. I don't think there's a precise translation to the `-static-*` family of options, unless I'm mistaken.

Yeah I don't think there's any good match in existing GCC-style options. I guess the most appropriate in such a case would be to use `-nostdlib` or something such, and explicitly mention `msvcrt.lib` and `oldnames.lib`. (If compiling with the GCC-style driver but linking by invoking (lld-)link directly, that's essentially what one has to do anyway.)

In D89702#2339719 <https://reviews.llvm.org/D89702#2339719>, @amccarth wrote:

> It seems weird that we're implicitly adding `defaultlib` options without checking if the user specified `nodefaultlib`.  But given that's already the case, I don't see a big problem with also adding oldnames.lib.

Well we do check for the `-nostdlib` and `-nostartupfiles` options - I guess making it react to `-nodefaultlibs` also could be considered sensible - as an orthogonal change to this one.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89702/new/

https://reviews.llvm.org/D89702



More information about the cfe-commits mailing list