JIT fails linking to libc++ symbols...

Hi,

   since moving to OSX 10.9 with libc++ our code which uses the JIT to compile C++ code on the fly fails to link with certain libc++ symbols that are reported by nm to be of type t (small t, i.e. defined but not exported, if I understand correctly). So, why does the JITted code want to link with these symbols? How to avoid that or how to make these symbols available in one way or another. Prior with libstdc++ (on OSX and Linux) no problems.

This are some of the symbols that fail linking:

ExecutionContext: use of undefined symbol '_ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE13get_allocatorEv'!
ExecutionContext: use of undefined symbol '_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS4_'!
ExecutionContext: use of undefined symbol '_ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4sizeEv'!
ExecutionContext: use of undefined symbol '_ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE4dataEv'!

That is:

std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::allocator<char> const&)
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::size() const
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::data() const
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::get_allocator() const

Any help appreciated.

Cheers, Fons.

All of those routines are decorated in the header <string> with "_LIBCPP_INLINE_VISIBILITY", which expands to
either: __attribute__ ((__always_inline__))
or: __forceinline
(depending on your compiler)

Since they're supposed to be always inlined, it's not surprising that they are not in the dylib.
A followup question would be: How/why are you generating calls to them, as opposed to just inlining them?

-- Marshall

Marshall Clow Idio Software <mailto:mclow.lists@gmail.com>

A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
        -- Yu Suzuki

Ah, now I remember we build LLVM with the flag:

--disable-visibility-inlines-hidden

passed to ./configure, so there must be some interference. I'll try without this flag.

Cheers, Fons.

Alas, removing this flag does not make any difference. JIT still fails to link. Any other ideas on what might be going on?

Cheers, Fons.

Hi Fons,

On Windows, I have seen this error as the result of having loaded a shared library compiled by gcc against libstdc++ looking for its imports.

Yaron