From d94a50f99d5201052e7f88d1f5ef0880d827ab40 Mon Sep 17 00:00:00 2001 From: Misha Brukman Date: Mon, 28 Jul 2003 19:07:30 +0000 Subject: [PATCH] Clean up code dealing with RTLD_SELF differences on Sparc and X86. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7362 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/ExecutionEngine/JIT/Intercept.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/ExecutionEngine/JIT/Intercept.cpp b/lib/ExecutionEngine/JIT/Intercept.cpp index ba49bbde05d..10fd97015f2 100644 --- a/lib/ExecutionEngine/JIT/Intercept.cpp +++ b/lib/ExecutionEngine/JIT/Intercept.cpp @@ -54,11 +54,12 @@ 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()); + // On Sparc, RTLD_SELF is already defined and it's not zero + // Linux/x86 wants to use a 0, other systems may differ +#ifndef RTLD_SELF +#define RTLD_SELF 0 #endif + void *Ptr = dlsym(RTLD_SELF, Name.c_str()); if (Ptr == 0) { std::cerr << "WARNING: Cannot resolve fn '" << Name << "' using a dummy noop function instead!\n"; @@ -67,4 +68,3 @@ void *VM::getPointerToNamedFunction(const std::string &Name) { return Ptr; } -