summaryrefslogtreecommitdiff
path: root/lib
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
commit859e09f06ea44b9182119fce4c75ba52baf429a6 (patch)
treefdd9bd877e0355e2fbdd81e524c872c3bbf0ebf7 /lib
parent291c2c59b011436087ba1982a6b5fe0609336f05 (diff)
downloadllvm-859e09f06ea44b9182119fce4c75ba52baf429a6.tar.gz
llvm-859e09f06ea44b9182119fce4c75ba52baf429a6.tar.bz2
llvm-859e09f06ea44b9182119fce4c75ba52baf429a6.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7177 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/ExecutionEngine/ExecutionEngine.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp
index a661dd49b5..74a3c867ed 100644
--- a/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/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";