[clang] [Clang][Cygwin] attempt to fix building shared libclang. (PR #138351)

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Mon May 5 03:21:02 PDT 2025


mstorsjo wrote:

> > Surprisingly, it looks like Cygwin (@tyan0) is working around the export limit on gcc by setting `-DCMAKE_SHARED_LINKER_FLAGS=-fvisibility=hidden`.
> 
> This was my misunderstanding. Building successfully was due to `-DLLVM_TARGETS_TO_BUILD=X86` which restrict target architecture only to x86. `-fvisibility=hidden` does not seem to take effect.

Thanks for clarifying this!

Indeed, `-fvisibility=hidden` (or `__attribute__((visibility("hidden")))` or `-fvisibility-inlines-hidden` etc) only have an effect with Clang, but the embedded attributes for omitting symbols from autoexport that it produces are honored by both ld.bfd and LLD.

https://github.com/llvm/llvm-project/pull/138351


More information about the cfe-commits mailing list