-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Avoid copy action for root assemblies #96363
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
bff0b2c
Avoid copy action for root assemblies
sbomer 9e4804b
Ensure attributes get marked too
sbomer d20cd80
Fix wasm test failures
sbomer e281fd0
Fix ApiCompat errors
sbomer 411ca2d
Fix issue, suppress for trimming but not AOT
sbomer 1c948d4
Mark root assemblies visible to reflection
sbomer e5dbcb2
Fix unexpected IL2045
sbomer c9621a2
Disable another test
sbomer b356586
Merge remote-tracking branch 'origin/main' into avoidCopyForRootAssembly
sbomer 5df751b
Preserve DebuggableAttribute for ApplyUpdateTest
sbomer 93942b8
Set DebuggerSupport for System.Runtime.Tests
sbomer aadf946
Fix bug in constant method analysis
sbomer f7dfe0b
Add testcase for root behaviors
sbomer 61ff65e
Check warning behavior
sbomer d447447
Preserve substitution behavior for 'copy' action
sbomer 4c2ef7f
Use LogDoesNotContain instead
sbomer 51d9146
Ignore testcase for nativeaot
sbomer b833a19
Preserve EnC assemblies for System.Runtime.Loader.Tests
sbomer 944bbeb
Add KeptAttributeAttribute
sbomer 2a072e8
Merge remote-tracking branch 'origin/main' into avoidCopyForRootAssembly
sbomer 150a67d
Remove unnecessary DebuggerSupport setting
sbomer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright (c) .NET Foundation and contributors. All rights reserved. | ||
// Copyright (c) .NET Foundation and contributors. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System; | ||
|
@@ -1583,7 +1583,7 @@ public bool Analyze (in CalleePayload callee, Stack<MethodDefinition> callStack) | |
return false; | ||
|
||
if (operand is int oint) { | ||
if (oint == 1) | ||
if (oint != 0) | ||
jmpTarget = (Instruction) instr.Operand; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was this needed? It's a good change, but surprised to see this in this PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
continue; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
.../illink/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerLinkAllAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (c) .NET Foundation and contributors. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System; | ||
|
||
namespace Mono.Linker.Tests.Cases.Expectations.Metadata | ||
{ | ||
[AttributeUsage (AttributeTargets.Class, AllowMultiple = false)] | ||
public class SetupLinkerLinkAllAttribute : BaseMetadataAttribute | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/tools/illink/test/Mono.Linker.Tests.Cases/Libraries/Dependencies/RootAllLibrary.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright (c) .NET Foundation and contributors. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System.Diagnostics.CodeAnalysis; | ||
using System.Runtime.CompilerServices; | ||
using Mono.Linker.Tests.Cases.Libraries.Dependencies; | ||
|
||
#if RootAllLibrary | ||
[assembly: TypeForwardedTo (typeof (RootAllLibrary_ExportedType))] | ||
#endif | ||
|
||
namespace Mono.Linker.Tests.Cases.Libraries.Dependencies | ||
{ | ||
public class RootAllLibrary | ||
{ | ||
public static void Public () | ||
{ | ||
} | ||
|
||
private static void Private () | ||
{ | ||
} | ||
|
||
private class NestedType | ||
{ | ||
} | ||
|
||
public static void RemovedBranch () | ||
{ | ||
if (SubstitutedProperty) | ||
RootAllLibrary_OptionalDependency.Use (); | ||
} | ||
|
||
// Substituted to false in RootAllLibrary_Substitutions.xml | ||
static bool SubstitutedProperty { | ||
get { | ||
RequiresUnreferencedCode (); | ||
return true; | ||
} | ||
} | ||
|
||
[RequiresUnreferencedCode (nameof (RequiresUnreferencedCode))] | ||
static void RequiresUnreferencedCode () | ||
{ | ||
} | ||
|
||
[RootAllLibrary_RemovedAttribute] | ||
class TypeWithRemovedAttribute | ||
{ | ||
} | ||
} | ||
|
||
class NonPublicType | ||
{ | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...illink/test/Mono.Linker.Tests.Cases/Libraries/Dependencies/RootAllLibrary_ExportedType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright (c) .NET Foundation and contributors. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace Mono.Linker.Tests.Cases.Libraries.Dependencies | ||
{ | ||
public class RootAllLibrary_ExportedType | ||
{ | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...ink/test/Mono.Linker.Tests.Cases/Libraries/Dependencies/RootAllLibrary_LinkAttributes.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<linker> | ||
<assembly fullname="removedattribute"> | ||
<type fullname="Mono.Linker.Tests.Cases.Libraries.Dependencies.RootAllLibrary_RemovedAttribute"> | ||
<attribute internal="RemoveAttributeInstances" /> | ||
</type> | ||
</assembly> | ||
</linker> |
12 changes: 12 additions & 0 deletions
12
.../test/Mono.Linker.Tests.Cases/Libraries/Dependencies/RootAllLibrary_OptionalDependency.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
namespace Mono.Linker.Tests.Cases.Libraries.Dependencies | ||
{ | ||
public class RootAllLibrary_OptionalDependency | ||
{ | ||
[RequiresUnreferencedCode (nameof (RootAllLibrary_OptionalDependency))] | ||
public static void Use () | ||
{ | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
...nk/test/Mono.Linker.Tests.Cases/Libraries/Dependencies/RootAllLibrary_RemovedAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using System; | ||
|
||
namespace Mono.Linker.Tests.Cases.Libraries.Dependencies | ||
{ | ||
public class RootAllLibrary_RemovedAttribute : Attribute | ||
{ | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...link/test/Mono.Linker.Tests.Cases/Libraries/Dependencies/RootAllLibrary_Substitutions.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<linker> | ||
<assembly fullname="library"> | ||
<type fullname="Mono.Linker.Tests.Cases.Libraries.Dependencies.RootAllLibrary"> | ||
<method signature="System.Boolean get_SubstitutedProperty()" body="stub" value="false" /> | ||
</type> | ||
</assembly> | ||
</linker> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondered why this wasn't hit with naot and found out illinker has this as a hardcoded list. Weird, but okay I guess. Would be nice to move this to the same plan as all the other attributes at least. I'm not convinced anyone will want to work on 2078 anytime soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed #96907