Skip to content

Conversation

@Anthony-Mai
Copy link
Contributor

Previous the build default to export all symbols, which is inefficient, and a change was made
to do explicit exports. So now some of the symbols become unresolved external symbols and
need to be explicitly exported.

By default, compilation of Linux shared library modules (*.so files)
exports all symbols. This creates large module files as the export
symbol tables contains too many entries. The correct approach is
export nothing by default and anything that needs to be exported
must be explicitly specified. This is accomplished by the following
steps:

1. In the Makefile, add "-fvisibility=hidden" flag. You can search
   for "-fPIC" to find the appropriate place to add the flag. This
   hides symbols by default if not explicitly specified otherwise.

2. To declaration of any symbol to be exported, add this attribute:
      __attribute__((visibility("default")))
   The attribute string can be added using a macro definition. It
   should be added right before the return type for functions, or
   right after the 'class' or 'struct' keyword for class/struct.

For more info on shared module export symbol visibility read:
    http://anadoxin.org/blog/control-over-symbol-exports-in-gcc.html
… all symbols

which is inefficient, and change was make to do explicit exports. So now some of
the symbols become unresolved external symbols and need to be explicitly exported.
@Anthony-Mai
Copy link
Contributor Author

The issue was discovered by:
http://ci.tvm.ai:8080/blue/organizations/jenkins/tvm/detail/PR-2445/9/pipeline/36
The unresolved externals are all from the HalideIR component. For example:
ir_functor_test.cc:(.text._ZN3tvm2ir11ExprFunctorIFiRKN8HalideIR4ExprEiEE10InitVTableEv[_ZN3tvm2ir11ExprFunctorIFiRKN8HalideIR4ExprEiEE10InitVTableEv]+0x1b3b): undefined reference to `tvm::Node::TypeKey2Index(char const*)'

ir_functor_test.cc:(.text._ZN3tvm2ir11ExprFunctorIFiRKN8HalideIR4ExprEiEE10InitVTableEv[_ZN3tvm2ir11ExprFunctorIFiRKN8HalideIR4ExprEiEE10InitVTableEv]+0x1b72): undefined reference to `tvm::Node::TypeIndex2Key(unsigned int)'
This is needed for pull request: apache/tvm#2445

@tqchen tqchen merged commit 7a3287d into dmlc:master Jan 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants