[BUILD] Hide symbols from linked static libraries#627
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new CMake function, tvm_ffi_hide_static_linked_lib_symbols, to prevent symbols from static archives linked into shared libraries from being exported on ELF targets. This function is applied to the tvm_ffi_shared, tvm_ffi_testing, and tvm_ffi_cython targets. Feedback suggests restricting the compiler option -Wl,--exclude-libs,ALL to specific operating systems (such as Linux, Android, and BSDs) using CMAKE_SYSTEM_NAME to prevent build failures on non-ELF UNIX platforms (like Solaris or AIX) that use native system linkers.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
To avoid downstream mistakenly picking up symbols from static libstdc++_nonshared, it is helpful to always hide symbols from linked static libraries.
c13d31f to
a4020c4
Compare
To avoid downstream mistakenly picking up symbols from static libstdc++_nonshared, always hide symbols from static libraries linked into tvm-ffi shared objects.
This adds a CMake helper for the policy and applies it to tvm_ffi_shared, tvm_ffi_testing, and the optional tvm_ffi_cython target on ELF platforms.
Local validation: