summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2003-07-15 15:55:32 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2003-07-15 15:55:32 +0000
commit7225461edfe243137b2a0efdbd0176ac312ec310 (patch)
tree94b3061f6752384865eb88abacec73f21b131397 /llvm/lib/ExecutionEngine/ExecutionEngine.cpp
parentb402819ddf200c178fc25e273f05d395d927de46 (diff)
downloadbcm5719-llvm-7225461edfe243137b2a0efdbd0176ac312ec310.tar.gz
bcm5719-llvm-7225461edfe243137b2a0efdbd0176ac312ec310.zip
On Sparc/Solaris, the special handle RTLD_SELF is used as a handle referring to
the program's executing image, not 0 as it is on Linux/x86 and possibly other systems. llvm-svn: 7176
Diffstat (limited to 'llvm/lib/ExecutionEngine/ExecutionEngine.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/ExecutionEngine.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
index 532f8fd49b2..a661dd49b51 100644
--- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -361,8 +361,13 @@ void ExecutionEngine::emitGlobals() {
} else {
// External variable reference, try to use dlsym to get a pointer to it in
// the LLI image.
- if (void *SymAddr = dlsym(0, I->getName().c_str()))
+#if defined(sparc) || defined(__sparc__) || defined(__sparcv9)
+ if (void *SymAddr = dlsym(RTLD_SELF, I->getName().c_str()))
GlobalAddress[I] = SymAddr;
+#else
+ if (void *SymAddr = dlsym(0, I->getName().c_str()))
+ GlobalAddress[I] = SymAddr;
+#endif
else {
std::cerr << "Could not resolve external global address: "
<< I->getName() << "\n";
OpenPOWER on IntegriCloud