<div dir="ltr">You can add symbols from Archieve via StaticLibrarySearchGenerator. But it is added recently though<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 27 Aug 2019 at 21:02, Praveen Velliengiri <<a href="mailto:praveenvelliengiri@gmail.com">praveenvelliengiri@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi Geoff,</div><div>I tried it, but I can't able to reproduce it.</div><div><br></div><div>Test Program:</div><div>#include <fstream><br>int main()<br>{<br> std::ifstream stream1, stream2;<br> stream1.swap(stream2);<br> return 0;<br>}</div><div><br></div><div>I didn't get undefined symbols error. I used DynamicLibrarySearchGenerator::GetForCurrentProcess API to make symbols from STL visible to ORC JIT. <br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 27 Aug 2019 at 20:36, Geoff Levner <<a href="mailto:glevner@gmail.com" target="_blank">glevner@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Tue, Aug 27, 2019 at 4:56 PM Praveen Velliengiri<br>
<<a href="mailto:praveenvelliengiri@gmail.com" target="_blank">praveenvelliengiri@gmail.com</a>> wrote:<br>
><br>
> HI<br>
> Did you run the static constructor and destructor? How did you make your process symbols visible to ORC jit?<br>
<br>
Yes. It's the constructor that generates the undefined symbol error.<br>
We use DynamicLibrary::LoadLibraryPermanently(nullptr) to add process<br>
symbols.<br>
<br>
> Could you please share us the for what symbols you get undefined references :-)<br>
<br>
Certainly! Mangled:<br>
<br>
_ZNSi4swapERSi<br>
_ZNSt13basic_filebufIcSt11char_traitsIcEE4swapERS2_<br>
<br>
And unmangled:<br>
<br>
std::basic_istream<char, std::char_traits<char><br>
>::swap(std::basic_istream<char, std::char_traits<char> >&)<br>
std::basic_filebuf<char, std::char_traits<char><br>
>::swap(std::basic_filebuf<char, std::char_traits<char> >&)<br>
<br>
Incidentally, if I call that STL swap() function in the application,<br>
to ensure it is in the process symbols, the second symbol is found,<br>
but the first is still undefined.<br>
<br>
<br>
><br>
> On Aug 27, 2019 8:18 PM, "Geoff Levner via llvm-dev" <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
>><br>
>> Greetings, LLVM wizards.<br>
>><br>
>> We are using 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>
>> The problem we have run into recently is when a module calls a function from the STL -- in particular this swap() function for input streams:<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 two undefined symbols. And explicitly adding libstdc++ doesn't help. It turns out that the missing symbols are defined not in the runtime DSO but in an archive file:<br>
>><br>
>> /opt/rh/devtoolset-6/root/usr/lib/gcc/x86_64-redhat-linux/6.3.1/libstdc++.a<br>
>><br>
>> So my questions are:<br>
>><br>
>> 1. Is there a simple way to get access to all symbols defined in the STL? Intuitively, it seems like we should not need to know about such compiler magic.<br>
>><br>
>> 2. If there is no magical solution, is there a way to explicitly add symbols from an archive?<br>
>><br>
>> Thanks,<br>
>> Geoff<br>
>><br>
>><br>
>> _______________________________________________<br>
>> LLVM Developers mailing list<br>
>> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
>> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
>><br>
</blockquote></div>
</blockquote></div>