-
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
Trimming locals from a method doesn't remove the locals from the pdb #1260
Comments
* Add ILLink.Substitutions.xml files for System.Private.CoreLib. Ported the settings from https://github.com/mono/mono/blob/eaa32d13659f0a6b6b5e62ddb49af68b1f9efb6c/sdks/wasm/src/linker-subs.xml and split them out as appropriate to reduce duplication across the different platform builds. Contributes to #31785 * Remove all Platforms other than wasm to workaround linker bug. See dotnet/linker#1260
There are actually two issues here
This issue will be about the local variable debug information. The problem is in Fix is to walk all local scopes (even nested ones) and remove variables which are also removed from the body (not replaced with |
Candidate fix: https://github.com/vitek-karas/linker/tree/CleanLocalVariableDebugInfo |
Cleaner way to fix this would be in Cecil itself. |
@vitek-karas - I see the underlying Cecil fixes have been merged. Is this issue now fixed? Or do we need to take the latest Cecil in Once this is fixed, we can fix dotnet/runtime#31785. |
We need to get a new build of https://github.com/jbevain/cecil published. It should be in the works.. so hopefully soon. |
Fixed in master and 5.0 release |
With change dotnet/runtime#37615, we are introducing some ILLink.Substitutions.xml files that direct the linker to trim branches in IL that will never be called. For example, when building for
x64
, anyif (AdvSimd.IsSupported)
branches can be trimmed away, since ARM intrinsics will never be true forx64
.However, Pdb2Pdb is failing in this PR:
Debugging into Pdb2Pdb.exe, I see the first problem is that we are trimming away locals from this method:
https://github.com/dotnet/runtime/blob/bd6cbe3642f51d70839912a6a666e5de747ad581/src/libraries/System.Private.CoreLib/src/System/Numerics/BitOperations.cs#L233-L251
The
if (AdvSimd.Arm64.IsSupported)
branch is getting trimmed, but it looks like the local variables are not getting removed from the portable .pdb. Here is the code after trimming:The error
Is being emitted because Pdb2Pdb is finding local variables in the pdb, but the method doesn't have a "local signature" (since there are no locals in the resulting method).
The ILLinker needs to be removing the locals from the pdbs as well, so tools like Pdb2Pdb still work.
The text was updated successfully, but these errors were encountered: