You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ILLink produces invalid IL metadata with -b switch and Save assembly mode #86462
As part of testing dotnet/macios#18268 we hit an odd case where invalid IL is produced as the output of ILLink, resulting in later crash when post-processing the data with ILStrip. There's actually several issues at play here:
ILLink with -b switch strips the unused AssemblyRef but keeps the unused TypeRef in the Save assembly mode. Xamarin uses ILLink, among other things, to produce the Managed Static Registrar. In this configuration the original Copy mode of the input assembly is changed to Save in the process.
Update the illinktask.dll path in linker.rsp to an absolute path to the included task .dll; the custom task only changes the assembly action to Save since it cannot be done on command line
Tested with .NET 7.0.302 and .NET 8.0 Preview 5 linkers. The issue exists in both. On .NET 8 the original test case produces different linker input and doesn't hit the problem, but the underlying bug still exists.
Removing the -b switch from linker.rsp makes the problem go away
I realized that I forgot to include the .pdb in the repro package. That's essential for the error to occur. Here's a fixed one: extra-typeref-linker.zip
Activity
filipnavara commentedon May 18, 2023
filipnavara commentedon May 19, 2023
I realized that I forgot to include the .pdb in the repro package. That's essential for the error to occur. Here's a fixed one:
extra-typeref-linker.zip
filipnavara commentedon May 19, 2023
This fixes the output for me: filipnavara@7cca2fa
Unit tests will be easier to write once #86474 lands.
filipnavara commentedon May 22, 2023
This is similar to this old issue btw: dotnet/linker#399
filipnavara commentedon Jun 8, 2023
@vitek-karas This should be rather trivial to fix. I suppose that I can take a stab at it if you are busy...
vitek-karas commentedon Jun 9, 2023
I'm definitely busy with other commitments... maybe @sbomer can take a look.
Or if you want to tackle it - we would be happy to help of course.
sbomer commentedon Jun 9, 2023
Would love it if you were able to contribute a fix. :) Otherwise I can take a look next week.
Fix missing assemblyref for typeref only kept for debug info in illink (