[Mono-bugs] [Bug 60799][Blo] New - jit-icalls.c compiles, but libmono.so won't link -- missing reference to 'trunc'

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sat, 26 Jun 2004 23:55:23 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by jeff.evans@vmd.desjardins.com.

http://bugzilla.ximian.com/show_bug.cgi?id=60799

--- shadow/60799	2004-06-26 23:55:23.000000000 -0400
+++ shadow/60799.tmp.26119	2004-06-26 23:55:23.000000000 -0400
@@ -0,0 +1,66 @@
+Bug#: 60799
+Product: Mono: Compilers
+Version: unspecified
+OS: Solaris 8
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Blocker
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: jeff.evans@vmd.desjardins.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: jit-icalls.c compiles, but libmono.so won't link -- missing reference to 'trunc'
+
+Description of Problem:
+
+Although jit-icalls.c compiles, libmono.so will not link because of a 
+missing reference to 'trunc' on Solaris 8 (jit-icalls.c defines a 
+reference to trunc)
+
+There seems to be a 'hack' in the code to get around this (around line 
+65??), but it doesn't appear to work on all Solaris 8 systems 'out of the 
+box' -- eg: my Solaris 8 system doesn't seem to have 'aintl' either, so, 
+although HAVE_AINTL is not defined during compile, the 'trunc' reference 
+somehow still stays in and the loader expects to find it. (Using gcc to 
+compile - latest version)
+
+I was able to get around this by creating a trunc function directly (from 
+http://www.mozart-oz.org/pipermail/mozart-hackers/2002/000577.html) -- 
+the solution seems to be to change the jit-icalls.c from:
+
+-------------------------- old -------------------------
+#ifndef HAVE_TRUNC
+/* Solaris doesn't have trunc */
+#ifdef HAVE_AINTL
+extern long double aintl (long double);
+#define trunc aintl
+#else
+/* FIXME: This means we will never throw overflow exceptions */
+#define trunc
+#endif
+#endif /* HAVE_TRUNC */
+
+to:
+-------------------------- new -------------------------
+#ifndef HAVE_TRUNC
+/* Solaris doesn't have trunc */
+#ifdef HAVE_AINTL
+extern long double aintl (long double);
+#define trunc aintl
+#else
+
+int myTrunc(double r)
+{
+  int n = floor(r);
+  return ((r-((double)n)) > 0.5)?n+1:n;
+}
+
+#define trunc myTrunc
+
+#endif
+#endif /* HAVE_TRUNC */