summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/JIT/Intercept.cpp
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2003-07-28 19:07:30 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2003-07-28 19:07:30 +0000
commitee79899ce56ee6a2035e3509ab2c8884ee7f6a1f (patch)
tree0d534246d21d2bcebd683de3c12be79edf3afd6f /llvm/lib/ExecutionEngine/JIT/Intercept.cpp
parentd9a9276fe3e529842d96346a53dae32621ce1d59 (diff)
downloadbcm5719-llvm-ee79899ce56ee6a2035e3509ab2c8884ee7f6a1f.tar.gz
bcm5719-llvm-ee79899ce56ee6a2035e3509ab2c8884ee7f6a1f.zip
Clean up code dealing with RTLD_SELF differences on Sparc and X86.
llvm-svn: 7362
Diffstat (limited to 'llvm/lib/ExecutionEngine/JIT/Intercept.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/JIT/Intercept.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/Intercept.cpp b/llvm/lib/ExecutionEngine/JIT/Intercept.cpp
index ba49bbde05d..10fd97015f2 100644
--- a/llvm/lib/ExecutionEngine/JIT/Intercept.cpp
+++ b/llvm/lib/ExecutionEngine/JIT/Intercept.cpp
@@ -54,11 +54,12 @@ void *VM::getPointerToNamedFunction(const std::string &Name) {
if (Name == "atexit") return (void*)&jit_atexit;
// If it's an external function, look it up in the process image...
-#if defined(i386) || defined(__i386__) || defined(__x86__)
- void *Ptr = dlsym(0, Name.c_str());
-#elif defined(sparc) || defined(__sparc__) || defined(__sparcv9)
- void *Ptr = dlsym(RTLD_SELF, Name.c_str());
+ // 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
+ void *Ptr = dlsym(RTLD_SELF, Name.c_str());
if (Ptr == 0) {
std::cerr << "WARNING: Cannot resolve fn '" << Name
<< "' using a dummy noop function instead!\n";
@@ -67,4 +68,3 @@ void *VM::getPointerToNamedFunction(const std::string &Name) {
return Ptr;
}
-
OpenPOWER on IntegriCloud