Make this actually work on systems that support ppc long double.
authorChris Lattner <sabre@nondot.org>
Tue, 27 Nov 2007 20:45:25 +0000 (20:45 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 27 Nov 2007 20:45:25 +0000 (20:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44374 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/JIT/Intercept.cpp

index 6d5e7da772f77e2b15fa860e240eef58e1eb576e..a4d0faa04ba3cc62a92b75e4434ceeae63481c08 100644 (file)
@@ -107,9 +107,14 @@ void *JIT::getPointerToNamedFunction(const std::string &Name) {
   // 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));
+      memcmp(&Name[Name.size()-8], "LDBLStub", 8) == 0) {
+    // First try turning $LDBLStub into $LDBL128.  If that fails, strip it off.
+    // This mirrors logic in libSystemStubs.a.
+    std::string Prefix = std::string(Name.begin(), Name.end()-9);
+    if (void *Ptr = getPointerToNamedFunction(Prefix+"$LDBL128"))
+      return Ptr;
+    return getPointerToNamedFunction(Prefix);
+  }
 #endif
   
   /// If a LazyFunctionCreator is installed, use it to get/create the function.