[clang-repl] Use default visibility for symbols while building CompilerInstance against emscripten #116779
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When running clang-repl in the browser we end up having something like the following
"" -cc1 -triple wasm32-unknown-emscripten ...... -main-file-name "<<< inputs >>>" .... -fvisibility=hidden .... -o "<<< inputs >>>.o" -x c++ "<<< inputs >>>"
Due to the default introduced through this commit (e3d71e1#diff-b5496baaf5c83e1ffa1a26d0815843b8d3224aba84366cbb6aeecf703808c803R2083)
That being said, when we generated the shared libraries to be loaded on top of the main module while running clang-repl in the browser, we have to surpass the above through
--export-all
llvm-project/clang/lib/Interpreter/Wasm.cpp
Line 78 in b3e2b1a
This is because obviously
incr_module_XX.wasm
might want to access symbols out of file fromincr_module_XX-1.wasm
toincr_mdoule_0.wasm
But this also exports some problematic things like
__dso_handle
that causes conflicts across modules.A better way to deal with this is to pass
-fvisibility=default
to theCompilerInstance
.