I am wrapping a C++ math library (ntl) using Cxx.
After successfully wrapping a major class, I encountered llvm errors in another class.
The errors are:
LLVM ERROR: Program used external function ‘__emutls_v._symbol’ which could not be resolved!
where symbol is replaced with the function symbol.
checking the share library (libntl.so) the function is not missing.
I am guessing this has to do with Thread Local Storage
NTL has the following definition:
#ifdef NTL_THREADS #define NTL_THREAD_LOCAL thread_local #ifdef __GNUC__ #define NTL_CHEAP_THREAD_LOCAL __thread #else #define NTL_CHEAP_THREAD_LOCAL thread_local #endif #else #define NTL_THREAD_LOCAL #define NTL_CHEAP_THREAD_LOCAL #endif
which means that certain elements in this class are prefixed with
__thread (which was not present in the other class I was able to wrap successfully)