Skip to content

Commit

Permalink
Add linker option -z global to libonnxruntime_providers_shared.so on …
Browse files Browse the repository at this point in the history
…Android
  • Loading branch information
adrianlizarraga committed Dec 23, 2024
1 parent b707c46 commit 7f50558
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions cmake/onnxruntime_providers_cpu.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,16 @@ if (NOT onnxruntime_MINIMAL_BUILD AND NOT onnxruntime_EXTENDED_MINIMAL_BUILD
set_property(TARGET onnxruntime_providers_shared APPEND_STRING PROPERTY LINK_FLAGS "-Xlinker -exported_symbols_list ${ONNXRUNTIME_ROOT}/core/providers/shared/exported_symbols.lst")
elseif(UNIX)
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
target_link_options(onnxruntime_providers_shared PRIVATE
"LINKER:--version-script=${ONNXRUNTIME_ROOT}/core/providers/shared/version_script.lds"
"LINKER:--gc-sections")
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
target_link_options(onnxruntime_providers_shared PRIVATE
"LINKER:--version-script=${ONNXRUNTIME_ROOT}/core/providers/shared/version_script.lds"
"LINKER:--gc-sections"
"LINKER:-z,global")
else()
target_link_options(onnxruntime_providers_shared PRIVATE
"LINKER:--version-script=${ONNXRUNTIME_ROOT}/core/providers/shared/version_script.lds"
"LINKER:--gc-sections")
endif()
endif()
elseif(WIN32)
set_property(TARGET onnxruntime_providers_shared APPEND_STRING PROPERTY LINK_FLAGS "-DEF:${ONNXRUNTIME_ROOT}/core/providers/shared/symbols.def")
Expand Down
2 changes: 1 addition & 1 deletion cmake/onnxruntime_providers_qnn.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"LINKER:--version-script=${ONNXRUNTIME_ROOT}/core/providers/qnn/version_script.lds"
"LINKER:--gc-sections"
"LINKER:-rpath=\$ORIGIN"
"LINKER:-u,_Provider_GetHost"
"LINKER:-z,undefs"
)
else()
target_link_options(onnxruntime_providers_qnn PRIVATE
Expand Down

0 comments on commit 7f50558

Please sign in to comment.