[llvm] r225014 - RTDyldMemoryManager.cpp: Make the reference to __morestack weak.

Peter Collingbourne peter at pcc.me.uk
Tue Dec 30 14:52:33 PST 2014


Author: pcc
Date: Tue Dec 30 16:52:33 2014
New Revision: 225014

URL: http://llvm.org/viewvc/llvm-project?rev=225014&view=rev
Log:
RTDyldMemoryManager.cpp: Make the reference to __morestack weak.

This fixes the DSO build for now. Eventually we should develop some
other mechanism to make this work correctly with DSOs.

Modified:
    llvm/trunk/lib/ExecutionEngine/RTDyldMemoryManager.cpp

Modified: llvm/trunk/lib/ExecutionEngine/RTDyldMemoryManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RTDyldMemoryManager.cpp?rev=225014&r1=225013&r2=225014&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/RTDyldMemoryManager.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/RTDyldMemoryManager.cpp Tue Dec 30 16:52:33 2014
@@ -13,6 +13,7 @@
 
 #include "llvm/Config/config.h"
 #include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/DynamicLibrary.h"
 #include "llvm/Support/ErrorHandling.h"
 #include <cstdlib>
@@ -212,7 +213,7 @@ ARM_MATH_IMPORTS(ARM_MATH_DECL)
 
 #if defined(__linux__) && defined(__GLIBC__) && \
       (defined(__i386__) || defined(__x86_64__))
-extern "C" void __morestack();
+extern "C" LLVM_ATTRIBUTE_WEAK void __morestack();
 #endif
 
 uint64_t
@@ -241,7 +242,8 @@ RTDyldMemoryManager::getSymbolAddressInP
 
 #if defined(__i386__) || defined(__x86_64__)
   // __morestack lives in libgcc, a static library.
-  if (Name == "__morestack") return (uint64_t)&__morestack;
+  if (&__morestack && Name == "__morestack")
+    return (uint64_t)&__morestack;
 #endif
 #endif // __linux__ && __GLIBC__
   





More information about the llvm-commits mailing list