Add __x86.get_pc_thunk.bx to avoid dependency (#9955)

This commit is contained in:
Yi-Hong Lyu 2021-12-08 20:50:41 +08:00 committed by GitHub
parent a7f649db7c
commit f60a287a64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 0 deletions

View file

@ -355,6 +355,16 @@ else()
${mlas_platform_srcs_sse2}
${mlas_platform_srcs_avx}
)
# In r23, NDK remove __x86.get_pc_thunk.* from libatomic. Add our own
# implementation to avoid external dependency.
if(ANDROID)
set(mlas_platform_srcs
${mlas_platform_srcs}
${MLAS_SRC_DIR}/x86/x86.get_pc_thunk.S
)
endif()
if(NOT ONNXRUNTIME_MLAS_MULTI_ARCH)
set(MLAS_SOURCE_IS_NOT_SET 0)
endif()

View file

@ -0,0 +1,34 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.
Module Name:
x86.get_pc_thunk.S
Abstract:
This module implements __x86.get_pc_thunk.* to avoid external dependency.
--*/
#include "asmmacro.h"
.intel_syntax noprefix
/*++
Routine Description:
The routine loads its return address -- which is the address of the
instruction that immediately follows -- into the ebx register.
--*/
FUNCTION_ENTRY __x86.get_pc_thunk.bx
mov ebx, [esp]
ret