-
Notifications
You must be signed in to change notification settings - Fork 128
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
SweepStep doesn't process all type references for forwarded types #1576
Labels
Milestone
Comments
This was referenced Oct 20, 2020
marek-safar
added a commit
to marek-safar/linker
that referenced
this issue
Dec 10, 2020
The previous logic only removed assembly reference for linked assembly if the reference didn't exist in the closure of input assemblies. This was wrong because it kept unused references in one assembly if the another assembly used same reference. Fixes dotnet#1296 Fixes dotnet#1576
marek-safar
added a commit
to marek-safar/linker
that referenced
this issue
Dec 10, 2020
The previous logic only removed assembly reference for linked assembly if the reference didn't exist in the closure of input assemblies. This was wrong because it kept unused references in one assembly if the another assembly used same reference. Fixes dotnet#1296 Fixes dotnet#1576
marek-safar
added a commit
to marek-safar/linker
that referenced
this issue
Dec 10, 2020
The previous logic only removed assembly reference for linked assembly if the reference didn't exist in the closure of input assemblies. This was wrong because it kept unused references in one assembly if the another assembly used same reference. Fixes dotnet#1296 Fixes dotnet#1576
marek-safar
added a commit
to marek-safar/linker
that referenced
this issue
Dec 10, 2020
The previous logic only removed assembly reference for linked assembly if the reference didn't exist in the closure of input assemblies. This was wrong because it kept unused references in one assembly if the another assembly used same reference. Fixes dotnet#1296 Fixes dotnet#1576
marek-safar
added a commit
to marek-safar/linker
that referenced
this issue
Dec 13, 2020
The previous logic only removed assembly reference for linked assembly if the reference didn't exist in the closure of input assemblies. This was wrong because it kept unused references in one assembly if the another assembly used same reference. Fixes dotnet#1296 Fixes dotnet#1576
marek-safar
added a commit
to marek-safar/linker
that referenced
this issue
Dec 16, 2020
The previous logic only removed assembly reference for linked assembly if the reference didn't exist in the closure of input assemblies. This was wrong because it kept unused references in one assembly if the another assembly used same reference. Fixes dotnet#1296 Fixes dotnet#1576
21 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Test case:
linkertestcase-aedcbaa.zip
Extract and execute
testcase.sh
(not test.sh):The problem occurs when one of our custom linker step rewrites IL to call a different method: https://github.com/xamarin/xamarin-macios/blob/699c1f98fbfb9ac1c5d790a99812aa2f2b1a001b/tools/linker/CoreOptimizeGeneratedCode.cs#L911-L918
The different method is imported into the module in question here: https://github.com/xamarin/xamarin-macios/blob/699c1f98fbfb9ac1c5d790a99812aa2f2b1a001b/tools/linker/CoreOptimizeGeneratedCode.cs#L1058-L1073
The problem occurs because the imported method has a parameter whose type is System.Delegate, from System.Runtime.dll, and when System.Runtime.dll is linked away, the corresponding TypeReference in this method's parameter's ParameterType is not updated in SweepStep to reference System.Private.CoreLib.dll instead.
The end result is an invalid assembly (as can be seen from the monodis output) where the imported method's parameter's type is apparently System.Delegate from System.Collections.dll.
Here is an ugly hack that fixes the problem: https://gist.github.com/rolfbjarne/45e8e6d001f5fe9c9c1cf4036ad212f6
The text was updated successfully, but these errors were encountered: