Skip to content

Commit f70d8a9

Browse files
authored
Encode calling convention in mangled function pointer representation (#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
1 parent 0043b6e commit f70d8a9

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

src/coreclr/tools/Common/Compiler/NativeAotNameMangler.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,8 @@ private string ComputeMangledTypeName(TypeDesc type)
290290
mangledName = GetMangledTypeName(((PointerType)type).ParameterType) + NestMangledName("Pointer");
291291
break;
292292
case TypeFlags.FunctionPointer:
293-
// TODO: need to also encode calling convention (or all modopts?)
294293
var fnPtrType = (FunctionPointerType)type;
295-
mangledName = "__FnPtr" + EnterNameScopeSequence;
294+
mangledName = "__FnPtr_" + ((int)fnPtrType.Signature.Flags).ToString("X2") + EnterNameScopeSequence;
296295
mangledName += GetMangledTypeName(fnPtrType.Signature.ReturnType);
297296

298297
mangledName += EnterNameScopeSequence;

src/tests/issues.targets

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -874,9 +874,6 @@
874874
<ExcludeList Include="$(XunitTestBinBase)/JIT/opt/ObjectStackAllocation/ObjectStackAllocationTests/*">
875875
<Issue>https://github.com/dotnet/runtime/issues/81103</Issue>
876876
</ExcludeList>
877-
<ExcludeList Include = "$(XunitTestBinBase)/Loader/classloader/Casting/Functionpointer/**">
878-
<Issue>https://github.com/dotnet/runtime/issues/81106</Issue>
879-
</ExcludeList>
880877
</ItemGroup>
881878

882879
<!-- Crossgen2 x86 specific excludes -->

0 commit comments

Comments
 (0)