diff options
author | Brian Gaeke <gaeke@uiuc.edu> | 2003-10-10 17:02:42 +0000 |
---|---|---|
committer | Brian Gaeke <gaeke@uiuc.edu> | 2003-10-10 17:02:42 +0000 |
commit | e8bbcfc298d8e515a3fed6ad863bb3d7b113d415 (patch) | |
tree | 2047b3e4eb7f50838109ddd093d36bbab927f274 /llvm/lib/ExecutionEngine/ExecutionEngine.cpp | |
parent | 0cf2da2b03b1784f8aed674fbd399d79740a9738 (diff) | |
download | bcm5719-llvm-e8bbcfc298d8e515a3fed6ad863bb3d7b113d415.tar.gz bcm5719-llvm-e8bbcfc298d8e515a3fed6ad863bb3d7b113d415.zip |
Change to use GetAddressOfSymbol instead of dlsym.
llvm-svn: 9012
Diffstat (limited to 'llvm/lib/ExecutionEngine/ExecutionEngine.cpp')
-rw-r--r-- | llvm/lib/ExecutionEngine/ExecutionEngine.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp index b7aa3ba87f5..fb70ff1e725 100644 --- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp @@ -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 @@ void ExecutionEngine::emitGlobals() { 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: " |