[libcxx-commits] [PATCH] D155562: [libcxx] [test] Use -fms-runtime-lib= for picking the CRT to use

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 18 01:07:02 PDT 2023


mstorsjo created this revision.
mstorsjo added reviewers: jyknight, Mordante, andrewng.
Herald added a project: All.
mstorsjo requested review of this revision.
Herald added a project: libc++.
Herald added a reviewer: libc++.

This is a more correct way of linking against a specific runtime
library with the GCC-like clang frontend.

This avoids having to pass -D_DEBUG (and passes flags like -D_DLL,
which we should be passing if linking against the dynamic CRT).

When -fms-runtime-lib= is specified, each compiled object file gets
embedded directives instructing the linker about what CRT it should
link against. The -nostdlib we pass to the compiler driver only
inhibits the libs that the compiler driver passes to the linker
command.

Thus, this also avoids having to specify -lmsvcrt, -lmsvcrtd,
-llibcmt or -llibcmtd and -loldnames.

Based on a patch by Andrew Ng.

The -fms-runtime-lib= option was added in Clang 16, so this patch
can only be landed once libcxx's compiler requirement has been
bumped to Clang 16 (which is expected to be done sometime after
Clang 17 has been branched or released).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155562

Files:
  libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in
  libcxx/test/configs/llvm-libc++-shared-no-vcruntime-clangcl.cfg.in
  libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155562.541378.patch
Type: text/x-patch
Size: 5072 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230718/17155dad/attachment.bin>


More information about the libcxx-commits mailing list