From nobody@FreeBSD.org  Sun Jun 23 01:55:14 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
	by hub.freebsd.org (Postfix) with ESMTP id 5DAE7313
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 23 Jun 2013 01:55:14 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121])
	by mx1.freebsd.org (Postfix) with ESMTP id 3728D1835
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 23 Jun 2013 01:55:14 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
	by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id r5N1tDni029629
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 23 Jun 2013 01:55:13 GMT
	(envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
	by oldred.freebsd.org (8.14.5/8.14.5/Submit) id r5N1tDOf029628;
	Sun, 23 Jun 2013 01:55:13 GMT
	(envelope-from nobody)
Message-Id: <201306230155.r5N1tDOf029628@oldred.freebsd.org>
Date: Sun, 23 Jun 2013 01:55:13 GMT
From: Justin Hibbits <jrh29@alumni.cwru.edu>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Fix for math/gsl on PowerPC
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         179857
>Category:       ports
>Synopsis:       Fix for math/gsl on PowerPC
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bf
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jun 23 02:00:00 UTC 2013
>Closed-Date:    Wed Mar 05 05:13:25 UTC 2014
>Last-Modified:  Wed Mar 05 05:13:25 UTC 2014
>Originator:     Justin Hibbits
>Release:        10-CURRENT
>Organization:
>Environment:
FreeBSD narn.knownspace 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r251882M: Tue Jun 18 07:09:21 PDT 2013     chmeee@zhabar:/usr/home/chmeee/world/narn/powerpc.powerpc/usr/home/chmeee/freebsd/head/sys/NARN  powerpc
>Description:
math/gsl needs some changes to build on PowerPC.
>How-To-Repeat:
Build math/gsl on PowerPC
>Fix:
Patch attached.  It may not be completely correct, but it allows it to build.

Patch attached with submission follows:

--- ieee-utils/fp-freebsd.c.old	2013-06-22 10:07:01.000000000 -0700
+++ ieee-utils/fp-freebsd.c	2013-06-22 18:43:24.000000000 -0700
@@ -24,23 +24,37 @@
 int
 gsl_ieee_set_mode (int precision, int rounding, int exception_mask)
 {
+#ifndef __ppc__
   fp_prec_t prec = 0 ;
+#endif
   fp_except_t mode = 0 ;
   fp_rnd_t    rnd  = 0 ;
 
   switch (precision)
     {
     case GSL_IEEE_SINGLE_PRECISION:
+#ifdef __ppc__
+      GSL_ERROR ("powerpc only supports default precision rounding", GSL_EUNSUP);
+#else
       prec = FP_PS;
       fpsetprec(prec);      
+#endif
       break ;
     case GSL_IEEE_DOUBLE_PRECISION:
+#ifdef __ppc__
+      GSL_ERROR ("powerpc only supports default precision rounding", GSL_EUNSUP);
+#else
       prec = FP_PD;
       fpsetprec(prec);
+#endif
       break ;
     case GSL_IEEE_EXTENDED_PRECISION:
+#ifdef __ppc__
+      GSL_ERROR ("powerpc only supports default precision rounding", GSL_EUNSUP);
+#else
       prec = FP_PE;
       fpsetprec(prec);
+#endif
       break ;
     }
 
@@ -69,13 +83,27 @@
 
   /* Turn on all the exceptions apart from 'inexact' */
 
-  mode = FP_X_INV | FP_X_DNML | FP_X_DZ | FP_X_OFL | FP_X_UFL ;
+  mode = FP_X_INV | FP_X_DZ | FP_X_OFL | FP_X_UFL ;
+#ifndef __ppc__
+  mode |= FP_X_DNML;
+#endif
 
   if (exception_mask & GSL_IEEE_MASK_INVALID)
     mode &= ~ FP_X_INV ;
 
   if (exception_mask & GSL_IEEE_MASK_DENORMALIZED)
+#ifdef __ppc__
+    {
+      /* Do nothing */
+    }
+  else
+    {
+      GSL_ERROR ("powerpc does not support the denormalized operand exception. "
+                 "Use 'mask-denormalized' to work around this.", GSL_EUNSUP) ;
+    }
+#else
     mode &= ~ FP_X_DNML ;
+#endif
 
   if (exception_mask & GSL_IEEE_MASK_DIVISION_BY_ZERO)
     mode &= ~ FP_X_DZ ;
@@ -88,7 +116,11 @@
 
   if (exception_mask & GSL_IEEE_TRAP_INEXACT)
     {
+#ifdef __ppc__
+     GSL_ERROR ("powerpc does not support traps for inexact operations", GSL_EUNSUP) ;
+#else
       mode |= FP_X_IMP ;
+#endif
     }
   else
     {


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->bf 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Sun Jun 23 02:00:08 UTC 2013 
Responsible-Changed-Why:  
Over to maintainer (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=179857 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/179857: commit references a PR
Date: Mon,  3 Mar 2014 12:06:46 +0000 (UTC)

 Author: bf
 Date: Mon Mar  3 12:06:38 2014
 New Revision: 346884
 URL: http://svnweb.freebsd.org/changeset/ports/346884
 QAT: https://qat.redports.org/buildarchive/r346884/
 
 Log:
   Attempt to fix the build on powerpc* by the same means used on Darwin and GNU/Linux
   
   PR:		179857
   Submitted by:	jhibbits, nwhitehorn
 
 Added:
   head/math/gsl/files/patch-ieee-utils-fp-freebsd.c   (contents, props changed)
 Modified:
   head/math/gsl/Makefile
 
 Modified: head/math/gsl/Makefile
 ==============================================================================
 --- head/math/gsl/Makefile	Mon Mar  3 12:03:02 2014	(r346883)
 +++ head/math/gsl/Makefile	Mon Mar  3 12:06:38 2014	(r346884)
 @@ -30,10 +30,4 @@ check regression-test test: build
  	@cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${CORELIMIT} ${MAKE_CMD} \
  	${MAKE_ARGS} check
  
 -.include <bsd.port.pre.mk>
 -
 -.if ${ARCH} == "powerpc"
 -BROKEN=		Does not compile on powerpc
 -.endif
 -
 -.include <bsd.port.post.mk>
 +.include <bsd.port.mk>
 
 Added: head/math/gsl/files/patch-ieee-utils-fp-freebsd.c
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/math/gsl/files/patch-ieee-utils-fp-freebsd.c	Mon Mar  3 12:06:38 2014	(r346884)
 @@ -0,0 +1,66 @@
 +--- ieee-utils/fp-freebsd.c.orig	2014-02-03 11:46:44.000000000 -0600
 ++++ ieee-utils/fp-freebsd.c	2014-02-03 11:46:18.000000000 -0600
 +@@ -24,10 +24,28 @@
 + int
 + gsl_ieee_set_mode (int precision, int rounding, int exception_mask)
 + {
 +-  fp_prec_t prec = 0 ;
 +   fp_except_t mode = 0 ;
 +   fp_rnd_t    rnd  = 0 ;
 + 
 ++#ifdef __powerpc__
 ++  switch (precision)
 ++    {
 ++    case GSL_IEEE_SINGLE_PRECISION:
 ++      GSL_ERROR ("powerpc only supports default precision rounding", GSL_EUNSUP)
 ++;
 ++      break ;
 ++    case GSL_IEEE_DOUBLE_PRECISION:
 ++      GSL_ERROR ("powerpc only supports default precision rounding", GSL_EUNSUP)
 ++;
 ++      break ;
 ++    case GSL_IEEE_EXTENDED_PRECISION:
 ++      GSL_ERROR ("powerpc only supports default precision rounding", GSL_EUNSUP)
 ++;
 ++      break ;
 ++    }
 ++#else
 ++  fp_prec_t prec = 0 ;
 ++
 +   switch (precision)
 +     {
 +     case GSL_IEEE_SINGLE_PRECISION:
 +@@ -43,6 +61,7 @@
 +       fpsetprec(prec);
 +       break ;
 +     }
 ++#endif
 + 
 +   switch (rounding)
 +     {
 +@@ -69,13 +88,23 @@
 + 
 +   /* Turn on all the exceptions apart from 'inexact' */
 + 
 +-  mode = FP_X_INV | FP_X_DNML | FP_X_DZ | FP_X_OFL | FP_X_UFL ;
 ++  mode = FP_X_INV | FP_X_DZ | FP_X_OFL | FP_X_UFL ;
 + 
 +   if (exception_mask & GSL_IEEE_MASK_INVALID)
 +     mode &= ~ FP_X_INV ;
 + 
 +   if (exception_mask & GSL_IEEE_MASK_DENORMALIZED)
 +-    mode &= ~ FP_X_DNML ;
 ++    {
 ++      /* do nothing */
 ++    }
 ++  else
 ++    {
 ++#ifdef __powerpc__
 ++      GSL_ERROR ("powerpc does not support the denormalized operand exception. "                 "Use 'mask-denormalized' to work around this.", GSL_EUNSUP) ;
 ++#else
 ++      mode |= FP_X_DNML;
 ++#endif
 ++    }
 + 
 +   if (exception_mask & GSL_IEEE_MASK_DIVISION_BY_ZERO)
 +     mode &= ~ FP_X_DZ ;
 _______________________________________________
 svn-ports-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-ports-all
 To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: bf 
State-Changed-When: Wed Mar 5 05:13:23 UTC 2014 
State-Changed-Why:  
Committed. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=179857 
>Unformatted:
