[llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JIT.cpp

Evan Cheng evan.cheng at apple.com
Fri Jul 21 16:06:32 PDT 2006



Changes in directory llvm/lib/ExecutionEngine/JIT:

JIT.cpp updated: 1.69 -> 1.70
---
Log message:

Resolve __dso_handle.

---
Diffs of the changes:  (+8 -0)

 JIT.cpp |    8 ++++++++
 1 files changed, 8 insertions(+)


Index: llvm/lib/ExecutionEngine/JIT/JIT.cpp
diff -u llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.69 llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.70
--- llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.69	Tue Jul 11 19:31:47 2006
+++ llvm/lib/ExecutionEngine/JIT/JIT.cpp	Fri Jul 21 18:06:20 2006
@@ -30,6 +30,11 @@
 #include <iostream>
 using namespace llvm;
 
+#ifdef __APPLE__
+// __dso_handle is resolved by Mac OS X dynamic linker.
+extern void *__dso_handle __attribute__ ((__visibility__ ("hidden")));
+#endif
+
 static struct RegisterJIT {
   RegisterJIT() { JIT::Register(); }
 } JITRegistrator;
@@ -289,6 +294,9 @@
 
   // If the global is external, just remember the address.
   if (GV->isExternal()) {
+    // __dso_handle is resolved by the Mac OS X dynamic linker.
+    if (GV->getName() == "__dso_handle")
+      return (void*)&__dso_handle;
     Ptr = sys::DynamicLibrary::SearchForAddressOfSymbol(GV->getName().c_str());
     if (Ptr == 0) {
       std::cerr << "Could not resolve external global address: "






More information about the llvm-commits mailing list