aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ExecutionEngine
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2003-06-04 01:57:22 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2003-06-04 01:57:22 +0000
commit88fe358f8aaf611f72eb1b79acb72d94e345ecb0 (patch)
tree6e593186878e6ff9ffc1f0fd352e0c0d9d27de36 /lib/ExecutionEngine
parent2ab5e120d4e7ff02a9245a5051d055b7fdb8dda0 (diff)
downloadexternal_llvm-88fe358f8aaf611f72eb1b79acb72d94e345ecb0.zip
external_llvm-88fe358f8aaf611f72eb1b79acb72d94e345ecb0.tar.gz
external_llvm-88fe358f8aaf611f72eb1b79acb72d94e345ecb0.tar.bz2
Sparc's dlsym() requires the special operand RTLD_SELF to find a symbol in the
currently-running process. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6592 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine')
-rw-r--r--lib/ExecutionEngine/JIT/Intercept.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/ExecutionEngine/JIT/Intercept.cpp b/lib/ExecutionEngine/JIT/Intercept.cpp
index aa58186..36eca30 100644
--- a/lib/ExecutionEngine/JIT/Intercept.cpp
+++ b/lib/ExecutionEngine/JIT/Intercept.cpp
@@ -54,7 +54,11 @@ 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());
+#endif
if (Ptr == 0) {
std::cerr << "WARNING: Cannot resolve fn '" << Name
<< "' using a dummy noop function instead!\n";