summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2003-07-18 18:33:38 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2003-07-18 18:33:38 +0000
commit1f6feb7bf4baa25dd9bb1a59a822476fdffea0c9 (patch)
tree5fcd459bb19e25c4f019e21303c2c481820317fe
parentba943afa97f8c067caadd7a2f2b73139d00d9294 (diff)
downloadbcm5719-llvm-1f6feb7bf4baa25dd9bb1a59a822476fdffea0c9.tar.gz
bcm5719-llvm-1f6feb7bf4baa25dd9bb1a59a822476fdffea0c9.zip
Cleaned up the code which chooses the appropriate value for the file descriptor
to pass to dlsym() -- Linux/x86 wants 0 while Sparc/Solaris wants RTLD_SELF, which is not zero. Thanks to Chris for the suggestion. llvm-svn: 7204
-rw-r--r--llvm/lib/ExecutionEngine/ExecutionEngine.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
index 74a3c867ed7..5faa2e7f64d 100644
--- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -359,14 +359,13 @@ void ExecutionEngine::emitGlobals() {
DEBUG(std::cerr << "Global '" << I->getName() << "' -> "
<< (void*)GlobalAddress[I] << "\n");
} else {
- // External variable reference, try to use dlsym to get a pointer to it in
- // the LLI image.
-#if defined(sparc) || defined(__sparc__) || defined(__sparcv9)
- // RTLD_SELF is already defined and it's not zero
-#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()))
GlobalAddress[I] = SymAddr;
else {
OpenPOWER on IntegriCloud