<div dir="ltr">This breaks linking LLDB on Linux:<div><br></div><div><div>/usr/bin/ld: bin/lldb-3.6.0: hidden symbol `__morestack' in /usr/local/google/home/rnk/gcc/install/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0/libgcc.a(morestack.o) is referenced by DSO</div><div>/usr/bin/ld: final link failed: Bad value</div></div><div><br></div><div>It also breaks building lli if you use cmake -DBUILD_SHARED_LIBS=ON.</div><div><br></div><div>Ideas? It's not clear to me how to reference __morestack from a DSO.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 30, 2014 at 10:06 AM, Peter Collingbourne <span dir="ltr"><<a href="mailto:peter@pcc.me.uk" target="_blank">peter@pcc.me.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: pcc<br>
Date: Tue Dec 30 12:06:52 2014<br>
New Revision: 224993<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=224993&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=224993&view=rev</a><br>
Log:<br>
Make the __morestack function available to the JIT memory manager under Linux.<br>
<br>
This function's implementation lives in libgcc, a static library, so we need<br>
to expose it explicitly, like the other such functions.<br>
<br>
Differential Revision: <a href="http://reviews.llvm.org/D6788" target="_blank">http://reviews.llvm.org/D6788</a><br>
<br>
Modified:<br>
llvm/trunk/lib/ExecutionEngine/RTDyldMemoryManager.cpp<br>
<br>
Modified: llvm/trunk/lib/ExecutionEngine/RTDyldMemoryManager.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RTDyldMemoryManager.cpp?rev=224993&r1=224992&r2=224993&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RTDyldMemoryManager.cpp?rev=224993&r1=224992&r2=224993&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/ExecutionEngine/RTDyldMemoryManager.cpp (original)<br>
+++ llvm/trunk/lib/ExecutionEngine/RTDyldMemoryManager.cpp Tue Dec 30 12:06:52 2014<br>
@@ -210,6 +210,10 @@ ARM_MATH_IMPORTS(ARM_MATH_DECL)<br>
#undef ARM_MATH_DECL<br>
#endif<br>
<br>
+#if defined(__linux__) && defined(__GLIBC__)<br>
+extern "C" void __morestack();<br>
+#endif<br>
+<br>
uint64_t<br>
RTDyldMemoryManager::getSymbolAddressInProcess(const std::string &Name) {<br>
// This implementation assumes that the host program is the target.<br>
@@ -233,6 +237,9 @@ RTDyldMemoryManager::getSymbolAddressInP<br>
if (Name == "lstat64") return (uint64_t)&lstat64;<br>
if (Name == "atexit") return (uint64_t)&atexit;<br>
if (Name == "mknod") return (uint64_t)&mknod;<br>
+<br>
+ // __morestack lives in libgcc, a static library.<br>
+ if (Name == "__morestack") return (uint64_t)&__morestack;<br>
#endif // __linux__ && __GLIBC__<br>
<br>
// See ARM_MATH_IMPORTS definition for explanation<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>