-
Notifications
You must be signed in to change notification settings - Fork 13.6k
arm64ec incorrect mangling instantiating C++ template #115231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@llvm/issue-subscribers-c-1 Author: Eli Friedman (efriedma-quic)
```
template <typename X> struct Wrapper {
int GetValue(void) const;
};
struct A {
int GetValue(void) const;
};
template<typename X> int Wrapper<X>::GetValue(void) const { return 3; }
template class Wrapper<A>;
```
clang produces CC @mstorsjo @cjacek @dpaoliello @steplong |
@llvm/issue-subscribers-clang-frontend Author: Eli Friedman (efriedma-quic)
```
template <typename X> struct Wrapper {
int GetValue(void) const;
};
struct A {
int GetValue(void) const;
};
template<typename X> int Wrapper<X>::GetValue(void) const { return 3; }
template class Wrapper<A>;
```
clang produces CC @mstorsjo @cjacek @dpaoliello @steplong |
I believe that I have the correct algorithm - PR out shortly |
Arm64EC uses a special name mangling mode that adds `$$h` between the symbol name and its type. In MSVC's name mangling `@` is used to separate the name and type BUT it is also used for other purposes, such as the separator between paths in a fully qualified name. The original algorithm was quite fragile and made assumptions that didn't hold true for all MSVC mangled symbols, so instead of trying to improve this algorithm we are now using the demangler to indicate where the insertion point should be (i.e., to parse the fully-qualified name and return the current string offset). Also fixed `isArm64ECMangledFunctionName` to search for `@$$h` since the `$$h` must always be after a `@`. Fixes #115231
/cherry-pick fa0cf3d |
Failed to cherry-pick: fa0cf3d https://github.com/llvm/llvm-project/actions/runs/11842908473 Please manually backport the fix and push it to your github fork. Once this is done, please create a pull request |
Arm64EC uses a special name mangling mode that adds `$$h` between the symbol name and its type. In MSVC's name mangling `@` is used to separate the name and type BUT it is also used for other purposes, such as the separator between paths in a fully qualified name. The original algorithm was quite fragile and made assumptions that didn't hold true for all MSVC mangled symbols, so instead of trying to improve this algorithm we are now using the demangler to indicate where the insertion point should be (i.e., to parse the fully-qualified name and return the current string offset). Also fixed `isArm64ECMangledFunctionName` to search for `@$$h` since the `$$h` must always be after a `@`. Fixes llvm#115231
Arm64EC uses a special name mangling mode that adds `$$h` between the symbol name and its type. In MSVC's name mangling `@` is used to separate the name and type BUT it is also used for other purposes, such as the separator between paths in a fully qualified name. The original algorithm was quite fragile and made assumptions that didn't hold true for all MSVC mangled symbols, so instead of trying to improve this algorithm we are now using the demangler to indicate where the insertion point should be (i.e., to parse the fully-qualified name and return the current string offset). Also fixed `isArm64ECMangledFunctionName` to search for `@$$h` since the `$$h` must always be after a `@`. Fixes llvm#115231
Arm64EC uses a special name mangling mode that adds `$$h` between the symbol name and its type. In MSVC's name mangling `@` is used to separate the name and type BUT it is also used for other purposes, such as the separator between paths in a fully qualified name. The original algorithm was quite fragile and made assumptions that didn't hold true for all MSVC mangled symbols, so instead of trying to improve this algorithm we are now using the demangler to indicate where the insertion point should be (i.e., to parse the fully-qualified name and return the current string offset). Also fixed `isArm64ECMangledFunctionName` to search for `@$$h` since the `$$h` must always be after a `@`. Fixes llvm#115231
clang produces
?GetValue@$$h?$Wrapper@UA@@@@QEBAHXZ
, MSVC produces?GetValue@?$Wrapper@UA@@@@$$hQEBAHXZ
. I guess the algorithm in llvm::getArm64ECMangledFunctionName is wrong.CC @mstorsjo @cjacek @dpaoliello @steplong
The text was updated successfully, but these errors were encountered: