1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

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.

llvm-svn: 7176
This commit is contained in:
Misha Brukman 2003-07-15 15:55:32 +00:00
parent d594e21afa
commit 6a087a3a2f

View File

@ -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";