llvm: mangle extern function names for Wasm target#13396
Merged
andrewrk merged 2 commits intoziglang:masterfrom Nov 2, 2022
Merged
llvm: mangle extern function names for Wasm target#13396andrewrk merged 2 commits intoziglang:masterfrom
andrewrk merged 2 commits intoziglang:masterfrom
Conversation
When Wasm extern functions contain the same name, but have a different module name such as `extern "a"` vs `extern "b"` LLVM will currently resolve the two functions to the same symbol. By mangling the name of the symbol, we ensure the functions are resolved seperately. We mangle the name by applying <name>|<module> where module is also known as the library name.
This adds a simple linker test to ensure the built library contains an import entry for each extern function call that was mangled.
Contributor
|
Wooo-oooh! |
andrewrk
added a commit
that referenced
this pull request
Nov 2, 2022
llvm: mangle extern function names for Wasm target
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 Wasm extern functions contain the same name but have a different module name such as
extern "a"vsextern "b"LLVM backend will currently resolve the two functions to the same symbol. By mangling the name of the symbol, we ensure the functions are resolved separately. We mangle the name by applying<name>|<module>wheremoduleis also known as the library name.Closes #12880
Sorry, this wasn't part of the 0.10.0 release, but this should at least make it available in 0.10.1