From: Misha Brukman Date: Tue, 15 Jul 2003 15:55:32 +0000 (+0000) Subject: On Sparc/Solaris, the special handle RTLD_SELF is used as a handle referring to X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=291c2c59b011436087ba1982a6b5fe0609336f05;p=oota-llvm.git On Sparc/Solaris, the special handle RTLD_SELF is used as a handle referring to the program's executing image, not 0 as it is on Linux/x86 and possibly other systems. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7176 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp index 532f8fd49b2..a661dd49b51 100644 --- a/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/lib/ExecutionEngine/ExecutionEngine.cpp @@ -361,8 +361,13 @@ void ExecutionEngine::emitGlobals() { } else { // External variable reference, try to use dlsym to get a pointer to it in // the LLI image. - if (void *SymAddr = dlsym(0, I->getName().c_str())) +#if defined(sparc) || defined(__sparc__) || defined(__sparcv9) + if (void *SymAddr = dlsym(RTLD_SELF, I->getName().c_str())) GlobalAddress[I] = SymAddr; +#else + if (void *SymAddr = dlsym(0, I->getName().c_str())) + GlobalAddress[I] = SymAddr; +#endif else { std::cerr << "Could not resolve external global address: " << I->getName() << "\n";