Skip to content

[NativeAOT][Android] ARM64 link fails with undefined tls_CurrentThread after EH helper changes #137692

Closed

Description

@jonathanpeppers

Android ARM64 NativeAOT apps fail to link after the dependency update in dotnet/android#13572. Confirmed in Windows and macOS CI binlogs; the apps never reach execution.

error XA3007: Could not link native shared library
ld.lld: error: undefined symbol: tls_CurrentThread
>>> referenced by EHHelpers.S:77
>>> EHHelpers.S.o:(CallEHFunclet) in libRuntime.WorkstationGC.a

Failing build

Regression range

Relevant changes in dotnet/android/eng/Versions.props:

-    <MicrosoftNETSdkPackageVersion>12.0.100-alpha.1.26556.115</MicrosoftNETSdkPackageVersion>
+    <MicrosoftNETSdkPackageVersion>12.0.100-alpha.1.26565.104</MicrosoftNETSdkPackageVersion>
-    <MicrosoftNETCoreAppRefPackageVersion>12.0.0-alpha.1.26556.115</MicrosoftNETCoreAppRefPackageVersion>
+    <MicrosoftNETCoreAppRefPackageVersion>12.0.0-alpha.1.26565.104</MicrosoftNETCoreAppRefPackageVersion>

The failing archive comes from Microsoft.NETCore.App.Runtime.NativeAOT.android-arm64/12.0.0-alpha.1.26565.104.

VMR diff. The runtime source moves from 7066044546b54c4a84bd88a84d52bab5f09e603a to 00178ee32a0d46acf976f96f1d6fa4a65f8dfc74.

Suspected cause

dotnet/runtime#137168 adds the shared ARM64 exception helpers and replaces calls to RhpGetThread with INLINE_GETTHREAD in the NativeAOT exception paths. Full source diff.

The new CallEHFunclet uses:

#ifdef FEATURE_NATIVEAOT
        str     x2, [sp, #locRegs]

        INLINE_GETTHREAD x4
        str     x4, [sp, #locThread]

INLINE_GETTHREAD accesses native TLS through tls_CurrentThread. Android enables FEATURE_EMULATED_TLS, so the C++ runtime instead defines __emutls_v.tls_CurrentThread.

Comparing the old and new archives with NDK llvm-nm:

Old:
  threadstore.cpp.o: D __emutls_v.tls_CurrentThread
  No undefined native tls_CurrentThread reference.

New:
  EHHelpers.S.o: U tls_CurrentThread
  ExceptionHandling.S.o: U tls_CurrentThread
  threadstore.cpp.o: D __emutls_v.tls_CurrentThread

Both exception-helper objects need checking, not only CallEHFunclet.

Small reproduction

With NDK r28c tools on PATH, run against the failing package's runtimes/android-arm64/native/libRuntime.WorkstationGC.a:

llvm-ar x <path-to-archive> EHHelpers.S.o
llvm-nm --undefined-only EHHelpers.S.o
ld.lld -shared --no-undefined EHHelpers.S.o -o repro.so

The object has exactly one undefined symbol, tls_CurrentThread. The link exits with code 1 and reproduces the CI error at EHHelpers.S:77.

AI-generated report; evidence checked against CI binlogs, pinned source, and the shipped archive. 🤖

Activity

  1. added
    untriaged
    on Nov 16, 2026
  2. dotnet-policy-service commented on Nov 16, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib
    See info in area-owners.md if you want to be subscribed.

  3. jkotas commented on Nov 16, 2026

    @jkotas
    Member

    @am11 Could you please take a look?

  4. removed
    untriaged
    on Nov 18, 2026
  5. added a commit that references this issue on Nov 18, 2026
    4c3f89f
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

    • Status
      No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions