[clang] [llvm] Add __attribute__((visibility("default"))) attribute to certain symbols to stop them being hidden when linking clangInterpreter library to other libraries during Emscripten build (PR #146786)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 3 01:44:19 PDT 2025


mcbarton wrote:

> I'm super confused by what you are doing here. Most of the symbols you are annotating here are not inline and shouldn't be affected by `-fvisibility-inlines-hidden`. Some of them have already been annotated as LLVM_ABI in the header (and some of them haven't because the annotation effort hasn't progressed to them yet). It sounds to me like you are actually building with `-fvisibilty=hidden`, which is not yet a supported configuration.

Hi @nikic I worked out that was a troublesome flag, by removing it locally, and the symbols then appeared in the Emscripten shared library of CppInterOp, although the Emscripten shared library ended up very large, and unusable. I can also get them to appear in CppInterOp Emscripten shared library by building the Emscripten version of llvm using EMCC_CFLAGS="-fvisibilty=default" , but again the size of the Emscripten shared library ends up much bigger.

Sorry, I missed where these that have already been annotated with LLVM_ABI. Can you help me out by pointing out an example?

The llvm build I am doing is detailed here https://github.com/compiler-research/CppInterOp/blob/main/Emscripten-build-instructions.md . 

Also, this is separate to the issue to making a Windows Shared library issue here https://github.com/llvm/llvm-project/issues/109483 (this purely based on your comment that ' the annotation effort hasn't progressed to them yet')

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


More information about the llvm-commits mailing list