Skip to content
Snippets Groups Projects
Commit 1f6feb7b authored by Misha Brukman's avatar Misha Brukman
Browse files

Cleaned up the code which chooses the appropriate value for the file descriptor

to pass to dlsym() -- Linux/x86 wants 0 while Sparc/Solaris wants RTLD_SELF,
which is not zero. Thanks to Chris for the suggestion.

llvm-svn: 7204
parent ba943afa
No related branches found
No related tags found
No related merge requests found
...@@ -359,14 +359,13 @@ void ExecutionEngine::emitGlobals() { ...@@ -359,14 +359,13 @@ void ExecutionEngine::emitGlobals() {
DEBUG(std::cerr << "Global '" << I->getName() << "' -> " DEBUG(std::cerr << "Global '" << I->getName() << "' -> "
<< (void*)GlobalAddress[I] << "\n"); << (void*)GlobalAddress[I] << "\n");
} else { } else {
// External variable reference, try to use dlsym to get a pointer to it in // On Sparc, RTLD_SELF is already defined and it's not zero
// the LLI image.
#if defined(sparc) || defined(__sparc__) || defined(__sparcv9)
// RTLD_SELF is already defined and it's not zero
#else
// Linux/x86 wants to use a 0, other systems may differ // Linux/x86 wants to use a 0, other systems may differ
#ifndef RTLD_SELF
#define RTLD_SELF 0 #define RTLD_SELF 0
#endif #endif
// External variable reference, try to use dlsym to get a pointer to it in
// the LLI image.
if (void *SymAddr = dlsym(RTLD_SELF, I->getName().c_str())) if (void *SymAddr = dlsym(RTLD_SELF, I->getName().c_str()))
GlobalAddress[I] = SymAddr; GlobalAddress[I] = SymAddr;
else { else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment