llvm-project/llvm/cmake
Martin Storsjö 2c2fb0c737 [llvm] Use hidden visibility when building for MinGW with Clang
Since c5b3de6745 (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 them, so
it is harmless to use the hidden visibility when building with older
Clang (so we don't need to detect the exact version of Clang/LLVM where
it has an effect).

This reduces the number of exported symbols for a dylib build of LLVM;
previously libLLVM exported around 64650 symbols (when the maximum is
65536) when the ARM, AArch64 and X86 targets were enabled. If enabling
more targets (or if building with e.g. assertions enabled), it would
exceed the limit. Now with visibility flags in use, the same build
with ARM, AArch64 and X86 ends up at around 35k exported symbols.

Differential Revision: https://reviews.llvm.org/D131661
2022-08-12 00:57:05 +03:00
..
modules [llvm] Use hidden visibility when building for MinGW with Clang 2022-08-12 00:57:05 +03:00
platforms [cmake] Fix ms-compat version in WinMsvc.cmake 2022-08-09 11:13:49 +02:00
README
config-ix.cmake [cmake] Support native LoongArch builds 2022-08-01 15:10:24 +08:00
config.guess [cmake] Add LoongArch to config.guess 2022-08-01 15:05:34 +08:00
dummy.cpp
nsis_icon.ico
nsis_logo.bmp
unwind.h [ExecutionEngine] Check for libunwind before calling __register_frame 2021-08-15 13:35:53 +01:00

README

See docs/CMake.html for instructions on how to build LLVM with CMake.