[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
parent
1dc533ce
Please register or sign in to comment