[llvm-commits] CVS: llvm/tools/lli/JIT/Intercept.cpp

Misha Brukman brukman at cs.uiuc.edu
Mon Jul 28 14:08:03 PDT 2003


Changes in directory llvm/tools/lli/JIT:

Intercept.cpp updated: 1.5 -> 1.6

---
Log message:

Clean up code dealing with RTLD_SELF differences on Sparc and X86.


---
Diffs of the changes:

Index: llvm/tools/lli/JIT/Intercept.cpp
diff -u llvm/tools/lli/JIT/Intercept.cpp:1.5 llvm/tools/lli/JIT/Intercept.cpp:1.6
--- llvm/tools/lli/JIT/Intercept.cpp:1.5	Mon Jun 30 16:59:03 2003
+++ llvm/tools/lli/JIT/Intercept.cpp	Mon Jul 28 14:07:30 2003
@@ -54,11 +54,12 @@
   if (Name == "atexit") return (void*)&jit_atexit;
 
   // If it's an external function, look it up in the process image...
-#if defined(i386) || defined(__i386__) || defined(__x86__)
-  void *Ptr = dlsym(0, Name.c_str());
-#elif defined(sparc) || defined(__sparc__) || defined(__sparcv9)
-  void *Ptr = dlsym(RTLD_SELF, Name.c_str());
+  // On Sparc, RTLD_SELF is already defined and it's not zero
+  // Linux/x86 wants to use a 0, other systems may differ
+#ifndef RTLD_SELF
+#define RTLD_SELF 0
 #endif
+  void *Ptr = dlsym(RTLD_SELF, Name.c_str());
   if (Ptr == 0) {
     std::cerr << "WARNING: Cannot resolve fn '" << Name
 	      << "' using a dummy noop function instead!\n";
@@ -67,4 +68,3 @@
   
   return Ptr;
 }
-





More information about the llvm-commits mailing list