Skip to content

Commit

Permalink
Add __x86.get_pc_thunk.bx to avoid dependency (microsoft#9955)
Browse files Browse the repository at this point in the history
  • Loading branch information
yihonglyu authored Dec 8, 2021
1 parent a7f649d commit f60a287
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmake/onnxruntime_mlas.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
34 changes: 34 additions & 0 deletions onnxruntime/core/mlas/lib/x86/x86.get_pc_thunk.S
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit f60a287

Please sign in to comment.