[all-commits] [llvm/llvm-project] 27546a: [libcxx] [test] Use -fms-runtime-lib= for picking ...

Martin Storsjö via All-commits all-commits at lists.llvm.org
Wed Sep 27 03:53:53 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 27546a65d49a21e99038841d47ee7f6ad0e87dd5
      https://github.com/llvm/llvm-project/commit/27546a65d49a21e99038841d47ee7f6ad0e87dd5
  Author: Martin Storsjö <martin at martin.st>
  Date:   2023-09-27 (Wed, 27 Sep 2023)

  Changed paths:
    M libcxx/test/CMakeLists.txt
    M libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in
    M libcxx/test/configs/llvm-libc++-shared-no-vcruntime-clangcl.cfg.in
    M libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in

  Log Message:
  -----------
  [libcxx] [test] Use -fms-runtime-lib= for picking the CRT to use

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, but libcxx
now has dropped support for Clang 15.

Differential Revision: https://reviews.llvm.org/D155562




More information about the All-commits mailing list