Skip to content

Commit 8394dc9

Browse files
committed
Stop giving special treatment to icalls
As discussed dotnet#113437 (comment)
1 parent e9303d3 commit 8394dc9

8 files changed

+37
-163
lines changed

src/tools/illink/src/linker/Linker.Steps/MarkStep.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3149,7 +3149,7 @@ protected virtual void ProcessMethod (MethodDefinition method, in DependencyInfo
31493149
MarkCustomAttributes (method.MethodReturnType, new DependencyInfo (DependencyKind.ReturnTypeAttribute, method), methodOrigin);
31503150
MarkMarshalSpec (method.MethodReturnType, new DependencyInfo (DependencyKind.ReturnTypeMarshalSpec, method), methodOrigin);
31513151

3152-
if (method.IsPInvokeImpl || method.IsInternalCall) {
3152+
if (method.IsPInvokeImpl) {
31533153
ProcessInteropMethod (method, methodOrigin);
31543154
}
31553155

src/tools/illink/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/DefaultConstructorOfReturnTypeIsNotRemoved.cs

-25
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright (c) .NET Foundation and contributors. All rights reserved.
2+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+
using System.Runtime.CompilerServices;
5+
using Mono.Linker.Tests.Cases.Expectations.Assertions;
6+
7+
namespace Mono.Linker.Tests.Cases.Interop.InternalCalls;
8+
9+
public class NoSpecialMarking
10+
{
11+
public static void Main ()
12+
{
13+
A a = null;
14+
SomeMethod (ref a, null, null);
15+
}
16+
17+
[Kept]
18+
class A;
19+
20+
[Kept]
21+
class B;
22+
23+
[Kept]
24+
class C;
25+
26+
[Kept]
27+
class D
28+
{
29+
int field1;
30+
int field2;
31+
}
32+
33+
[Kept]
34+
[MethodImpl (MethodImplOptions.InternalCall)]
35+
static extern C SomeMethod (ref A a, B b, D d);
36+
}

src/tools/illink/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedDefaultConstructorIsRemoved.cs

-30
This file was deleted.

src/tools/illink/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedDefaultConstructorOfTypePassedByRefIsNotRemoved.cs

-31
This file was deleted.

src/tools/illink/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedFieldsOfTypesAreNotRemoved.cs

-26
This file was deleted.

src/tools/illink/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedFieldsOfTypesPassedByRefAreNotRemoved.cs

-26
This file was deleted.

src/tools/illink/test/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedFieldsOfTypesWhenHasThisAreNotRemoved.cs

-24
This file was deleted.

0 commit comments

Comments
 (0)