aboutsummaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/JIT/Intercept.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ExecutionEngine/JIT/Intercept.cpp')
-rw-r--r--lib/ExecutionEngine/JIT/Intercept.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/ExecutionEngine/JIT/Intercept.cpp b/lib/ExecutionEngine/JIT/Intercept.cpp
index 318d6067d6..6d5e7da772 100644
--- a/lib/ExecutionEngine/JIT/Intercept.cpp
+++ b/lib/ExecutionEngine/JIT/Intercept.cpp
@@ -102,6 +102,16 @@ void *JIT::getPointerToNamedFunction(const std::string &Name) {
if (Ptr) return Ptr;
}
+ // darwin/ppc adds $LDBLStub suffixes to various symbols like printf. These
+ // are references to hidden visibility symbols that dlsym cannot resolve. If
+ // we have one of these, strip off $LDBLStub and try again.
+#if defined(__APPLE__) && defined(__ppc__)
+ if (Name.size() > 9 && Name[Name.size()-9] == '$' &&
+ memcmp(&Name[Name.size()-8], "LDBLStub", 8) == 0)
+ return getPointerToNamedFunction(std::string(Name.begin(),
+ Name.end()-9));
+#endif
+
/// If a LazyFunctionCreator is installed, use it to get/create the function.
if (LazyFunctionCreator)
if (void *RP = LazyFunctionCreator(Name))