Sparc's dlsym() requires the special operand RTLD_SELF to find a symbol in the
authorMisha Brukman <brukman+llvm@gmail.com>
Wed, 4 Jun 2003 01:57:22 +0000 (01:57 +0000)
committerMisha Brukman <brukman+llvm@gmail.com>
Wed, 4 Jun 2003 01:57:22 +0000 (01:57 +0000)
currently-running process.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6592 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/JIT/Intercept.cpp

index aa58186ad859c3737116dc17e8b2c0f86c5709e1..36eca30af04a36e412f612a411ccea7ac7c29761 100644 (file)
@@ -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";