Skip to content

[wasm][CoreCLR] InvariantGlobalizationTests native relink fails: undefined GlobalizationNative_* symbols #128219

Closed

Description

@maraf

Note

This issue was authored with assistance from GitHub Copilot.

Summary

On CoreCLR-Wasm, Wasm.Build.Tests.InvariantGlobalizationTests.RelinkingWithoutAOT(invariantGlobalization: True) fails during the native relink step. wasm-ld reports ~40 undefined symbols pulled in by pinvoke-table.o, all of them GlobalizationNative_* entry points.

Example failing run:

Representative error lines:

wasm-ld : error : pinvoke-table.o: undefined symbol: GlobalizationNative_ChangeCase
wasm-ld : error : pinvoke-table.o: undefined symbol: GlobalizationNative_CompareString
wasm-ld : error : pinvoke-table.o: undefined symbol: GlobalizationNative_LoadICU
wasm-ld : error : pinvoke-table.o: undefined symbol: GlobalizationNative_GetCalendars
... (~37 more GlobalizationNative_* symbols)
emcc : error : '.../wasm-ld ...' failed (returned 1)
BrowserWasmApp.CoreCLR.targets(625,5): error MSB3073: ... emcc ... exited with code 1.

Test failure summary:

Wasm.Build.Tests.InvariantGlobalizationTests.RelinkingWithoutAOT(config: Release, aot: False, invariantGlobalization: True) [FAIL]
Wasm.Build.Tests  Total: 3, Errors: 0, Failed: 1, Skipped: 0, Time: 237.356s

Analysis

When InvariantGlobalization=true, the generated pinvoke-table.o still references the GlobalizationNative_* PInvoke entry points (because managed code in System.Private.CoreLib / System.Globalization declares them), but libSystem.Globalization.Native.a is intentionally not linked into the CoreCLR browser-wasm app. There is no providing object for these symbols, so wasm-ld fails.

On Mono-Wasm the same logical situation does not blow up because the Mono native link path provides stubs / weak resolution for the invariant case.

This is distinct from the related JS-side issue around wasm_load_icu_data being excluded from libBrowserHost.footer.js commonDeps — that fix addresses the JS Emscripten library dependency graph, not the native wasm-ld PInvoke link.

Proposed fix

Provide an empty stub library for System.Globalization.Native that gets linked into the CoreCLR browser-wasm app when InvariantGlobalization=true. The stub exports the same GlobalizationNative_* symbols (as no-op / unreachable / abort() implementations) so wasm-ld can satisfy pinvoke-table.o references, while ensuring the runtime never actually calls them (managed code guards on the invariant mode flag before calling into them).

This mirrors how other "no-op" native libraries are linked into the browser-wasm app (e.g. the TimeZoneData / Native variants already split by configuration).

Workaround until fixed

InvariantGlobalizationTests is gated to Mono-only via [ConditionalTheory(typeof(BuildTestBase), nameof(IsMonoRuntime))] in PR (link to follow). Once the stub library is in place, remove the gating to re-enable CoreCLR coverage.

Areas

  • area-Codegen-Interop-coreclr
  • area-System.Globalization
  • arch-wasm

/cc @maraf @lewing @pavelsavara

Activity

  1. dotnet-policy-service commented on May 14, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
    See info in area-owners.md if you want to be subscribed.

  2. dotnet-policy-service commented on May 14, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @dotnet/area-system-globalization
    See info in area-owners.md if you want to be subscribed.

  3. added
    os-browserBrowser variant of arch-wasm
    and removed
    untriagedNew issue has not been triaged by the area owner
    on May 14, 2026
  4. added this to the 11.0.0 milestone on May 14, 2026
  5. pavelsavara commented on Jun 12, 2026

    @pavelsavara
    Member

    This should be the workaround #129243
    And duplicates #129242 #129324

  6. locked and limited conversation to collaborators on Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions