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

Brian Gaeke gaeke at cs.uiuc.edu
Fri Oct 10 12:03:09 PDT 2003


Changes in directory llvm/lib/ExecutionEngine:

ExecutionEngine.cpp updated: 1.29 -> 1.30

---
Log message:

Change to use GetAddressOfSymbol instead of dlsym.


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

Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.29 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.30
--- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.29	Fri Sep  5 15:08:07 2003
+++ llvm/lib/ExecutionEngine/ExecutionEngine.cpp	Fri Oct 10 12:02:41 2003
@@ -16,6 +16,7 @@
 #include "llvm/Target/TargetData.h"
 #include "Support/Debug.h"
 #include "Support/Statistic.h"
+#include "Support/DynamicLinker.h"
 #include "Config/dlfcn.h"
 
 Statistic<> NumInitBytes("lli", "Number of bytes of global vars initialized");
@@ -339,14 +340,9 @@
       DEBUG(std::cerr << "Global '" << I->getName() << "' -> "
 	              << (void*)GlobalAddress[I] << "\n");
     } else {
-      // 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
-      // External variable reference, try to use dlsym to get a pointer to it in
-      // the LLI image.
-      if (void *SymAddr = dlsym(RTLD_SELF, I->getName().c_str()))
+      // External variable reference. Try to use the dynamic loader to
+      // get a pointer to it.
+      if (void *SymAddr = GetAddressOfSymbol(I->getName().c_str()))
         GlobalAddress[I] = SymAddr;
       else {
         std::cerr << "Could not resolve external global address: "





More information about the llvm-commits mailing list