[llvm] Use hidden visibility when building for MinGW with Clang
Since c5b3de67 (git main, August 11th), Clang does generate working hidden visibility on MinGW targets. Using that reduces the number of exports from a dylib build of LLVM significantly, which is vital for fitting within the limit of 64k exported symbols from a DLL. It's essential that if we set CMAKE_CXX_VISIBILITY_PRESET=hidden (which passes -fvisibility=hidden on the command line), we also must define LLVM_EXTERNAL_VISIBILITY consistently to override it. (If there are mismatches, e.g. setting hidden visibility generally but never overriding it back to default for the symbols that do need to be exported, we'd get broken builds in such configurations.) We don't want to be using __attribute__((visibility("hidden"))) on MinGW with GCC, because GCC produces a warning about it. (GCC hasn't warned about the command line options that set hidden visibility though.) Clang has historically not warned about either of ...
parent
a5881e8a
Please register or sign in to comment