]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix link error for 32-bit build on OSX 10.7 (Lion). This is the
authorJulian Seward <jseward@acm.org>
Tue, 23 Aug 2011 07:35:42 +0000 (07:35 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 23 Aug 2011 07:35:42 +0000 (07:35 +0000)
failure referred to in #275168 comment 0.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12000

coregrind/m_main.c

index f0134b6a0aaefec8a78bf89eaea1a0b11d70f194..ca82eb473b5ca7a69d556893a7f26aea2cdf3caf 100644 (file)
@@ -3208,6 +3208,104 @@ Long __moddi3 (Long u, Long v)
   return r;
 }
 
+/* ------------------------------------------------
+   ld_classic: Undefined symbols:
+      ___fixunsdfdi
+   ------------------------------------------------
+*/
+
+/* ===-- fixunsdfdi.c - Implement __fixunsdfdi -----------------------------===
+ *
+ *                     The LLVM Compiler Infrastructure
+ *
+ * This file is dual licensed under the MIT and the University of Illinois Open
+ * Source Licenses. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __fixunsdfdi for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
+
+/* As per http://www.gnu.org/licenses/license-list.html#GPLCompatibleLicenses,
+
+   the "NCSA/University of Illinois Open Source License" is compatible
+   with the GPL (both version 2 and 3).  What is claimed to be
+   compatible is this
+
+   http://www.opensource.org/licenses/UoI-NCSA.php
+
+   and the LLVM documentation at
+
+   http://www.llvm.org/docs/DeveloperPolicy.html#license
+
+   says all the code in LLVM is available under the University of
+   Illinois/NCSA Open Source License, at this URL
+
+   http://www.opensource.org/licenses/UoI-NCSA.php
+
+   viz, the same one that the FSF pages claim is compatible.  So I
+   think it's OK to include it.
+*/
+
+/* Returns: convert a to a unsigned long long, rounding toward zero.
+ *          Negative values all become zero.
+ */
+
+/* Assumption: double is a IEEE 64 bit floating point type 
+ *             du_int is a 64 bit integral type
+ *             value in double is representable in du_int or is negative 
+ *                 (no range checking performed)
+ */
+
+/* seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm */
+
+typedef unsigned long long du_int;
+typedef unsigned su_int;
+
+typedef union
+{
+    du_int all;
+    struct
+    {
+#if VG_LITTLEENDIAN
+        su_int low;
+        su_int high;
+#else
+        su_int high;
+        su_int low;
+#endif /* VG_LITTLEENDIAN */
+    }s;
+} udwords;
+
+typedef union
+{
+    udwords u;
+    double  f;
+} double_bits;
+
+du_int __fixunsdfdi(double a);
+
+du_int
+__fixunsdfdi(double a)
+{
+    double_bits fb;
+    fb.f = a;
+    int e = ((fb.u.s.high & 0x7FF00000) >> 20) - 1023;
+    if (e < 0 || (fb.u.s.high & 0x80000000))
+        return 0;
+    udwords r;
+    r.s.high = (fb.u.s.high & 0x000FFFFF) | 0x00100000;
+    r.s.low = fb.u.s.low;
+    if (e > 52)
+        r.all <<= (e - 52);
+    else
+        r.all >>= (52 - e);
+    return r.all;
+}
+
+
 #endif