[cfe-dev] JIT fails linking to libc++ symbols...

Marshall Clow mclow.lists at gmail.com
Tue Nov 19 12:28:47 PST 2013


On Nov 18, 2013, at 2:13 PM, Fons Rademakers <Fons.Rademakers at cern.ch> wrote:

> 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

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 at 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





More information about the cfe-dev mailing list