Skip to content

Commit

Permalink
Encode calling convention in mangled function pointer representation (#…
Browse files Browse the repository at this point in the history
…81122)

This fixes the recently introduced issue #81106 tracking Crossgen2
crash due to not being able to distinguish two function pointers
differing only by calling convention (one of the pointers is Static
and the other is Static | UnmanagedCallingConvention).

This change also removes the issues.targets exclusion for the
new function pointer test that Fan Yang had to add to unblock
merging in the test in the first place.

Thanks

Tomas

* Delete superfluous comment per Michal's PR feedback
  • Loading branch information
trylek authored Jan 31, 2023
1 parent 0043b6e commit f70d8a9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
3 changes: 1 addition & 2 deletions src/coreclr/tools/Common/Compiler/NativeAotNameMangler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,8 @@ private string ComputeMangledTypeName(TypeDesc type)
mangledName = GetMangledTypeName(((PointerType)type).ParameterType) + NestMangledName("Pointer");
break;
case TypeFlags.FunctionPointer:
// TODO: need to also encode calling convention (or all modopts?)
var fnPtrType = (FunctionPointerType)type;
mangledName = "__FnPtr" + EnterNameScopeSequence;
mangledName = "__FnPtr_" + ((int)fnPtrType.Signature.Flags).ToString("X2") + EnterNameScopeSequence;
mangledName += GetMangledTypeName(fnPtrType.Signature.ReturnType);

mangledName += EnterNameScopeSequence;
Expand Down
3 changes: 0 additions & 3 deletions src/tests/issues.targets
Original file line number Diff line number Diff line change
Expand Up @@ -874,9 +874,6 @@
<ExcludeList Include="$(XunitTestBinBase)/JIT/opt/ObjectStackAllocation/ObjectStackAllocationTests/*">
<Issue>https://github.com/dotnet/runtime/issues/81103</Issue>
</ExcludeList>
<ExcludeList Include = "$(XunitTestBinBase)/Loader/classloader/Casting/Functionpointer/**">
<Issue>https://github.com/dotnet/runtime/issues/81106</Issue>
</ExcludeList>
</ItemGroup>

<!-- Crossgen2 x86 specific excludes -->
Expand Down

0 comments on commit f70d8a9

Please sign in to comment.