summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2003-07-15 15:58:26 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2003-07-15 15:58:26 +0000
commit528a37621b93c3072ecc8fa5011257d7f6535042 (patch)
tree1581715ab8483d45e466d359c5998340aa8c13d8 /llvm/lib/ExecutionEngine/ExecutionEngine.cpp
parent7225461edfe243137b2a0efdbd0176ac312ec310 (diff)
downloadbcm5719-llvm-528a37621b93c3072ecc8fa5011257d7f6535042.tar.gz
bcm5719-llvm-528a37621b93c3072ecc8fa5011257d7f6535042.zip
Clean up my last checkin: code is easier to read and explains the differences in
usage of the special file handle RTLD_SELF on Sparc/Solaris vs. 0 on Linux/x86. llvm-svn: 7177
Diffstat (limited to 'llvm/lib/ExecutionEngine/ExecutionEngine.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/ExecutionEngine.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
index a661dd49b51..74a3c867ed7 100644
--- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -362,12 +362,13 @@ void ExecutionEngine::emitGlobals() {
// External variable reference, try to use dlsym to get a pointer to it in
// the LLI image.
#if defined(sparc) || defined(__sparc__) || defined(__sparcv9)
- if (void *SymAddr = dlsym(RTLD_SELF, I->getName().c_str()))
- GlobalAddress[I] = SymAddr;
+ // RTLD_SELF is already defined and it's not zero
#else
- if (void *SymAddr = dlsym(0, I->getName().c_str()))
- GlobalAddress[I] = SymAddr;
+ // Linux/x86 wants to use a 0, other systems may differ
+#define RTLD_SELF 0
#endif
+ if (void *SymAddr = dlsym(RTLD_SELF, I->getName().c_str()))
+ GlobalAddress[I] = SymAddr;
else {
std::cerr << "Could not resolve external global address: "
<< I->getName() << "\n";
OpenPOWER on IntegriCloud