Patchwork [2/2] eglibc: Do not use fsqrt in libm when building for fsl ppc with fpu

login
register
mail settings
Submitter Khem Raj
Date Sept. 17, 2012, 8:50 p.m.
Message ID <bffdd81ac7ad4886f01f1046953fde45d858e16c.1347914898.git.raj.khem@gmail.com>
Download mbox | patch
Permalink /patch/36659/
State New
Headers show

Comments

Khem Raj - Sept. 17, 2012, 8:50 p.m.
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../eglibc/eglibc-2.16/fsl-ppc-no-fsqrt.patch      |   44 ++++++++++++++++++++
 meta/recipes-core/eglibc/eglibc_2.16.bb            |    3 +-
 2 files changed, 46 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-core/eglibc/eglibc-2.16/fsl-ppc-no-fsqrt.patch
Khem Raj - Sept. 17, 2012, 9:41 p.m.
>
>  EGLIBC_BRANCH="eglibc-2_16"
> @@ -30,6 +30,7 @@ SRC_URI = "svn://www.eglibc.org/svn/branches/;module=${EGLIBC_BRANCH};protocol=h
>             file://0002-eglibc-menuconfig-hex-string-options.patch \
>             file://0003-eglibc-menuconfig-build-instructions.patch \
>             file://0001-Add-name_to_handle_at-open_by_handle-etc.-to-PowerPC.patch \
> +           file://file://fsl-ppc-no-fsqrt.patch \


I have fixed this typo on the branch

>            "
>  LIC_FILES_CHKSUM = "file://LICENSES;md5=98a1128c4b58120182cbea3b1752d8b9 \
>        file://COPYING;md5=393a5ca445f6965873eca0259a17f833 \
> --
> 1.7.9.5
>

Patch

diff --git a/meta/recipes-core/eglibc/eglibc-2.16/fsl-ppc-no-fsqrt.patch b/meta/recipes-core/eglibc/eglibc-2.16/fsl-ppc-no-fsqrt.patch
new file mode 100644
index 0000000..712b353
--- /dev/null
+++ b/meta/recipes-core/eglibc/eglibc-2.16/fsl-ppc-no-fsqrt.patch
@@ -0,0 +1,44 @@ 
+Create e5500 specific math_private.h and let it include when compiling for e5500/64bit core
+We prefefine __CPU_HAS_FSQRT to 0 and then in general ppc64 math_private.h we check if its
+already defined before redefining it. This way we can ensure that on e5500 builds it wont
+emit fsqrt intructions
+
+-Khem
+
+Upstream-Status: Pending
+
+Index: libc/sysdeps/powerpc/fpu/math_private.h
+===================================================================
+--- libc.orig/sysdeps/powerpc/fpu/math_private.h	2012-09-03 22:37:58.000000000 -0700
++++ libc/sysdeps/powerpc/fpu/math_private.h	2012-09-17 09:35:09.709124003 -0700
+@@ -25,10 +25,12 @@
+ #include <dl-procinfo.h>
+ #include_next <math_private.h>
+ 
+-# if __WORDSIZE == 64 || defined _ARCH_PWR4
+-#  define __CPU_HAS_FSQRT 1
+-# else
+-#  define __CPU_HAS_FSQRT ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0)
++# ifndef __CPU_HAS_FSQRT
++#  if __WORDSIZE == 64 || defined _ARCH_PWR4
++#   define __CPU_HAS_FSQRT 1
++#  else
++#   define __CPU_HAS_FSQRT ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0)
++#  endif
+ # endif
+ 
+ extern double __slow_ieee754_sqrt (double);
+Index: libc/ports/sysdeps/powerpc/powerpc64/e5500/fpu/math_private.h
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ libc/ports/sysdeps/powerpc/powerpc64/e5500/fpu/math_private.h	2012-09-17 09:56:59.129124074 -0700
+@@ -0,0 +1,9 @@
++#ifndef _E5500_MATH_PRIVATE_H_
++#define _E5500_MATH_PRIVATE_H_ 1
++/* E5500 core FPU does not implement
++   fsqrt */
++
++#define __CPU_HAS_FSQRT 0
++#include_next <math_private.h>
++
++#endif /* _E5500_MATH_PRIVATE_H_ */
diff --git a/meta/recipes-core/eglibc/eglibc_2.16.bb b/meta/recipes-core/eglibc/eglibc_2.16.bb
index 8f3d159..bc4f044 100644
--- a/meta/recipes-core/eglibc/eglibc_2.16.bb
+++ b/meta/recipes-core/eglibc/eglibc_2.16.bb
@@ -3,7 +3,7 @@  require eglibc.inc
 SRCREV = "20393"
 
 DEPENDS += "gperf-native kconfig-frontends-native"
-PR = "r9"
+PR = "r10"
 PR_append = "+svnr${SRCPV}"
 
 EGLIBC_BRANCH="eglibc-2_16"
@@ -30,6 +30,7 @@  SRC_URI = "svn://www.eglibc.org/svn/branches/;module=${EGLIBC_BRANCH};protocol=h
            file://0002-eglibc-menuconfig-hex-string-options.patch \
            file://0003-eglibc-menuconfig-build-instructions.patch \
            file://0001-Add-name_to_handle_at-open_by_handle-etc.-to-PowerPC.patch \
+           file://file://fsl-ppc-no-fsqrt.patch \
           "
 LIC_FILES_CHKSUM = "file://LICENSES;md5=98a1128c4b58120182cbea3b1752d8b9 \
       file://COPYING;md5=393a5ca445f6965873eca0259a17f833 \