<div dir="ltr"><div>[I am reposting this with a different title and other changes, because I am fairly confident our problem is related to Red Hat's developer toolset.]<br></div><div><br></div>Greetings, LLVM wizards.<br><br>We have an application that uses Clang and Orc JIT (v1) to compile and execute C++ code on the fly. If a C++ module calls functions from external libraries, we add them via DynamicLibrary::LoadLibraryPermanently().<br><br>Recently we moved to gcc 6.3.1 to build our application, using Red Hat's devtoolset-6 on CentOS, and this seems to create problems when a module calls functions from the STL. If a module calls this swap() function for input streams, for example:<br><br>    #include <fstream><br>    std::ifstream stream1, stream2;<br>    stream1.swap(stream2);<br><br>When we run the constructors for the module, we get undefined STL symbols. It turns out that the missing symbols are defined not in the runtime DSO (in /usr/lib64) but in an archive file installed with the developer toolset:<br><br>    /opt/rh/devtoolset-6/root/usr/lib/gcc/x86_64-redhat-linux/6.3.1/libstdc++.a<br><div><br></div><div>Apparently the linker performs some magic allowing an application compiled and linked with gcc 6.3.1 to run on a system with an older version of the STL (from gcc 4.8.5), augmenting the old DSO with stuff that is linked in statically.</div><div><br></div><div>SO my question is: is there any way to reproduce that magical behavior in an Orc JIT compiler, so that code can link properly with the STL?<br></div><br>Thanks,<br>Geoff</div>