Use symbol file to export symbols in onnxruntime library on AIX platform as well#28016
Conversation
@microsoft-github-policy-service agree company="IBM" |
|
Team, Can this be reviewed please ? These changes will remove few AIX specific conditions from the cmake file. |
|
@tianleiwu @snnn |
There was a problem hiding this comment.
Pull request overview
This PR updates the AIX shared-library build to export libonnxruntime symbols via the same generated symbol file mechanism used on other platforms, instead of relying on AIX-specific symbol exporting behavior from onnxruntime_c_api.cc/CMake. This addresses missing exports like OrtSessionOptionsAppendExecutionProvider_CPU by ensuring AIX consumes the provider symbols.txt lists.
Changes:
- Extend
tools/ci_build/gen_def.pyto support anaixoutput style that emits a plain per-line export list. - Enable symbol-file generation on AIX (remove AIX exclusion) and link
onnxruntimeon AIX using-bE:<exportfile>withAIX_EXPORT_ALL_SYMBOLSdisabled. - Simplify AIX shared-lib target creation and dependencies to follow the same generated-source/symbol-file flow as other UNIX platforms.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tools/ci_build/gen_def.py | Adds an aix export-list output style (one symbol name per line, no header). |
| cmake/onnxruntime.cmake | Switches AIX to use the generated symbol file + linker export list (-bE) and removes AIX-only build branches. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tianleiwu
left a comment
There was a problem hiding this comment.
Review Summary
Clean refactoring that eliminates AIX-specific special-casing in the build system by integrating AIX into the common gen_def.py symbol-file generation path. The change is low-risk, reduces code duplication, and correctly applies AIX-appropriate linker flags (-bE:, AIX_EXPORT_ALL_SYMBOLS OFF). Net deletion of 11 lines with no functional behavior change on non-AIX platforms.
Positives:
- Good elimination of five separate AIX conditional blocks in favor of platform-appropriate integration into the common flow.
- Correctly sets
AIX_EXPORT_ALL_SYMBOLS OFFand usesLINKER:-bE:${SYMBOL_FILE}— mirrors the intent of--version-scripton Linux and-exported_symbols_liston macOS. - Now correctly includes
LINK_DEPENDS ${SYMBOL_FILE}for AIX, ensuring relinking when the export list changes. - The
gen_def.py"aix" style correctly generates plain symbol names matching the AIX-bE:export file format.
One trivial nitpick flagged inline.
|
Thanks @tianleiwu |
On AIX platform , the exporting of symbols in libonnxruntime library is handled through
onnxruntime_c_api.ccand CMake itself. Because of which it exports lot of symbols but misses outOrtSessionOptionsAppendExecutionProvider_CPU.This change is to make the symbol exports on AIX platform similar to how it is done for other platforms.