[all-commits] [llvm/llvm-project] 6c5b0d: [libcxx] Base MSVC autolinking on _LIBCPP_DISABLE_...
Martin Storsjö via All-commits
all-commits at lists.llvm.org
Mon Apr 19 12:43:09 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 6c5b0d6beaaa634efce700e0c9cbd098e1c2e8a3
https://github.com/llvm/llvm-project/commit/6c5b0d6beaaa634efce700e0c9cbd098e1c2e8a3
Author: Martin Storsjö <martin at martin.st>
Date: 2021-04-19 (Mon, 19 Apr 2021)
Changed paths:
M libcxx/include/__config
Log Message:
-----------
[libcxx] Base MSVC autolinking on _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
Previously the decision of which library to try to autolink was
based on _DLL, however the _DLL define (which is set by the compiler)
is tied to whether using a dynamically linked CRT or not, and the choice
of dynamic or static CRT is entirely orthogonal to whether libc++ is
linked dynamically or statically.
If _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS isn't defined, then all
declarations are decorated with dllimport, and there's no doubt that
the DLL version of the library is what must be linked.
_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS is defined if building with
LIBCXX_ENABLE_SHARED disabled, and thus the static library is what
should be linked.
If defining _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS manually but wanting
to link against the DLL version of the library, that's not a canonical
configuration, and then it's probably reasonable to manually define
_LIBCPP_NO_AUTO_LINK too, and manually link against the desired
library.
This fixes, among other issues, running tests for the library if
built with LIBCXX_ENABLE_STATIC disabled.
Differential Revision: https://reviews.llvm.org/D100539
More information about the All-commits
mailing list