Skip to content

Commit

Permalink
Use -z undefs on android
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianlizarraga committed Dec 19, 2024
1 parent e8df64f commit 863ff04
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions cmake/onnxruntime_providers_qnn.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,20 @@

# Set linker flags for function(s) exported by EP DLL
if(UNIX)
string(CONCAT ONNXRUNTIME_PROVIDERS_QNN_LINK_FLAGS
"-Xlinker --version-script=${ONNXRUNTIME_ROOT}/core/providers/qnn/version_script.lds "
"-Xlinker --gc-sections -Xlinker -rpath=\\$ORIGIN")
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
string(CONCAT ONNXRUNTIME_PROVIDERS_QNN_LINK_FLAGS
"${ONNXRUNTIME_PROVIDERS_QNN_LINK_FLAGS} "
"-Xlinker --allow-shlib-undefined") # Allow undefined global symbols (e.g., Provider_GetHost) in shared library
target_link_options(onnxruntime_providers_qnn PRIVATE
"LINKER:--version-script=${ONNXRUNTIME_ROOT}/core/providers/qnn/version_script.lds"
"LINKER:--gc-sections"
"LINKER:-rpath=\$ORIGIN"
"LINKER:-z,undefs"
)
else()
target_link_options(onnxruntime_providers_qnn PRIVATE
"LINKER:--version-script=${ONNXRUNTIME_ROOT}/core/providers/qnn/version_script.lds"
"LINKER:--gc-sections"
"LINKER:-rpath=\$ORIGIN"
)
endif()
set_property(TARGET onnxruntime_providers_qnn APPEND_STRING PROPERTY LINK_FLAGS "${ONNXRUNTIME_PROVIDERS_QNN_LINK_FLAGS}")
elseif(WIN32)
set_property(TARGET onnxruntime_providers_qnn APPEND_STRING PROPERTY LINK_FLAGS "-DEF:${ONNXRUNTIME_ROOT}/core/providers/qnn/symbols.def")
else()
Expand Down

0 comments on commit 863ff04

Please sign in to comment.