Skip to content
This repository was archived by the owner on Sep 25, 2026. It is now read-only.
This repository was archived by the owner on Sep 25, 2026. It is now read-only.

Linker optimization leads to invalid IL #2016

Closed

Description

@vargaz

To reproduce:

  • Use dotnet/runtime HEAD
  • Build wasm support using
    make -C src/mono/wasm build-all
  • Build a test suite:
./dotnet.sh build /t:Test /p:TargetOS=Browser /p:TargetArchitecture=wasm /p:Configuration=Release /p:EnableAggressiveTrimming=true /p:RunAOTCompilation=true /p:WasmNativeStrip=false src/libraries/Microsoft.Extensions.Logging/tests/Microsoft.Extensions.Logging.Generators.Tests/
  • Look at artifacts/obj/Microsoft.Extensions.Logging.Generators.Tests/net6.0-Release/browser-wasm/linked/Microsoft.CodeAnalysis.CSharp.dll:

In the

          ToDisplayParts([Microsoft.CodeAnalysis]Microsoft.CodeAnalysis.ISymbol symbol,
                         [Microsoft.CodeAnalysis]Microsoft.CodeAnalysis.SemanticModel semanticModelOpt,
                         int32 positionOpt,
                         [Microsoft.CodeAnalysis]Microsoft.CodeAnalysis.SymbolDisplayFormat format,
                         bool minimal) cil managed

method:

    IL_0043:  pop
    IL_0044:  ldnull
    IL_0045:  br.s       IL_004f

    IL_0047:  call       instance class Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol Microsoft.CodeAnalysis.CSharp.Symbols.PublicModel.MethodSymbol::get_UnderlyingMethodSymbol()
    IL_004c:  pop
    IL_004d:  ldnull
    IL_004e:  brfalse.s  IL_0063

Note that the br at 45 jumps to 4f, but 4f is not a valid instruction offset

Activity

  1. changed the title [-]Linker optimization lead to invalid IL[/-] [+]Linker optimization leads to invalid IL[/+] on May 6, 2021
  2. self-assigned this
    on May 6, 2021
  3. lewing commented on May 7, 2021

    @lewing
    Member

    We're hitting this in several of the AOT tests

  4. marek-safar commented on May 7, 2021

    @marek-safar
    Contributor

    I know what's wrong here just need to work on a fix

  5. added a commit that references this issue on May 17, 2021
    ff63eb5
  6. added a commit that references this issue on May 17, 2021
    a621b9a
  7. added a commit that references this issue on Nov 16, 2022
    ed0cb85
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions