diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets index fe49cab873abf1..a64d20b4ca37e4 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets @@ -34,6 +34,7 @@ The .NET Foundation licenses this file to you under the MIT license. $(RuntimeIdentifier) + $(RuntimeIdentifier) x86_64 diff --git a/src/coreclr/nativeaot/Runtime/amd64/InteropThunksHelpers.S b/src/coreclr/nativeaot/Runtime/amd64/InteropThunksHelpers.S index 5c0b6f631ef539..a53dd3c63624f6 100644 --- a/src/coreclr/nativeaot/Runtime/amd64/InteropThunksHelpers.S +++ b/src/coreclr/nativeaot/Runtime/amd64/InteropThunksHelpers.S @@ -14,7 +14,11 @@ LEAF_ENTRY RhCommonStub, _TEXT alloc_stack SIZEOF_FP_REGS SAVE_FLOAT_ARGUMENT_REGISTERS 0 +#ifdef FEATURE_EMULATED_TLS + call C_FUNC(RhpGetThunkData) +#else INLINE_GET_TLS_VAR tls_thunkData +#endif RESTORE_FLOAT_ARGUMENT_REGISTERS 0 free_stack SIZEOF_FP_REGS @@ -36,6 +40,7 @@ LEAF_ENTRY RhGetCommonStubAddress, _TEXT LEAF_END RhGetCommonStubAddress, _TEXT +#ifndef FEATURE_EMULATED_TLS LEAF_ENTRY RhGetCurrentThunkContext, _TEXT INLINE_GET_TLS_VAR tls_thunkData @@ -43,3 +48,4 @@ LEAF_ENTRY RhGetCurrentThunkContext, _TEXT mov rax, qword ptr [rax] ret LEAF_END RhGetCurrentThunkContext, _TEXT +#endif //FEATURE_EMULATED_TLS diff --git a/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosamd64.inc b/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosamd64.inc index ab64ef9ce92b49..11225c0ad5ed2b 100644 --- a/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosamd64.inc +++ b/src/coreclr/nativeaot/Runtime/unix/unixasmmacrosamd64.inc @@ -300,8 +300,12 @@ C_FUNC(\Name): .macro INLINE_GETTHREAD +#ifdef FEATURE_EMULATED_TLS + call C_FUNC(RhpGetThread) +#else // Inlined version of call C_FUNC(RhpGetThread) INLINE_GET_TLS_VAR tls_CurrentThread +#endif .endm .macro INLINE_THREAD_UNHIJACK threadReg, trashReg1, trashReg2