Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Safar <marek.safar@gmail.com>2021-01-11 18:45:46 +0300
committerGitHub <noreply@github.com>2021-01-11 18:45:46 +0300
commit7a095faf3925689f2a3450da1a76fdd79a070de9 (patch)
tree8bd2f0016591b178b6987adde66ef6e3b7187dd3
parentbe3545f99b32e38bb74d31a04868890021e51d34 (diff)
Sweep EntryPoint method reference (#1726)
m---------external/cecil0
-rw-r--r--src/linker/Linker.Steps/SweepStep.cs4
-rw-r--r--test/Mono.Linker.Tests.Cases/References/Dependencies/ReferenceWithEntryPoint_Lib.cs13
-rw-r--r--test/Mono.Linker.Tests.Cases/References/ReferenceWithEntryPoint.cs21
4 files changed, 38 insertions, 0 deletions
diff --git a/external/cecil b/external/cecil
-Subproject 8cf97c125748b0a2832f0420728c8fac2ae2234
+Subproject 2f9b2fb759c50e756f9c6580b9fb8518581020c
diff --git a/src/linker/Linker.Steps/SweepStep.cs b/src/linker/Linker.Steps/SweepStep.cs
index 5f74b3075..4bf6a60da 100644
--- a/src/linker/Linker.Steps/SweepStep.cs
+++ b/src/linker/Linker.Steps/SweepStep.cs
@@ -223,6 +223,10 @@ namespace Mono.Linker.Steps
if (main.HasModuleReferences)
SweepCollectionMetadata (main.ModuleReferences);
+ if (main.EntryPoint != null && !Annotations.IsMarked (main.EntryPoint)) {
+ main.EntryPoint = null;
+ }
+
SweepTypeForwarders (assembly);
SweepAssemblyReferences (assembly);
diff --git a/test/Mono.Linker.Tests.Cases/References/Dependencies/ReferenceWithEntryPoint_Lib.cs b/test/Mono.Linker.Tests.Cases/References/Dependencies/ReferenceWithEntryPoint_Lib.cs
new file mode 100644
index 000000000..a11080c39
--- /dev/null
+++ b/test/Mono.Linker.Tests.Cases/References/Dependencies/ReferenceWithEntryPoint_Lib.cs
@@ -0,0 +1,13 @@
+namespace Mono.Linker.Tests.Cases.References.Dependencies
+{
+ public class ReferenceWithEntryPoint_Lib
+ {
+ public static void Main ()
+ {
+ }
+
+ public static void UsedMethod ()
+ {
+ }
+ }
+} \ No newline at end of file
diff --git a/test/Mono.Linker.Tests.Cases/References/ReferenceWithEntryPoint.cs b/test/Mono.Linker.Tests.Cases/References/ReferenceWithEntryPoint.cs
new file mode 100644
index 000000000..dd572e64e
--- /dev/null
+++ b/test/Mono.Linker.Tests.Cases/References/ReferenceWithEntryPoint.cs
@@ -0,0 +1,21 @@
+using Mono.Linker.Tests.Cases.Expectations.Assertions;
+using Mono.Linker.Tests.Cases.Expectations.Metadata;
+using Mono.Linker.Tests.Cases.References.Dependencies;
+
+namespace Mono.Linker.Tests.Cases.References
+{
+ // Actions:
+ // link - This assembly
+ // link - lib.exe
+
+ [SetupCompileBefore ("lib.exe", new[] { "Dependencies/ReferenceWithEntryPoint_Lib.cs" })]
+ [KeptAssembly ("lib.exe")]
+ [KeptMemberInAssembly ("lib.exe", typeof (ReferenceWithEntryPoint_Lib), "UsedMethod()")]
+ class ReferenceWithEntryPoint
+ {
+ public static void Main ()
+ {
+ ReferenceWithEntryPoint_Lib.UsedMethod ();
+ }
+ }
+}