[oe-commits] Khem Raj : uclibc: Add copysignl implementation for powerpc to uclibc

git version control git at git.openembedded.org
Thu Feb 3 22:36:26 UTC 2011


Module: openembedded.git
Branch: ulf/linux-2.6.30-2011-01-16
Commit: d2c8692a40c6f651d55833ebcac48519f5fdb245
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=d2c8692a40c6f651d55833ebcac48519f5fdb245

Author: Khem Raj <raj.khem at gmail.com>
Date:   Tue Jan 25 22:16:29 2011 -0800

uclibc: Add copysignl implementation for powerpc to uclibc

* On some ppc architectures like ppce500 gcc generates calls to
  copysignl but this function is not provided by uclibc or gcc itself
  we add it to uclibc.

Signed-off-by: Khem Raj <raj.khem at gmail.com>

---

 recipes/uclibc/uclibc-git/powerpc_copysignl.patch |  107 +++++++++++++++++++++
 recipes/uclibc/uclibc_git.bb                      |    3 +-
 2 files changed, 109 insertions(+), 1 deletions(-)

diff --git a/recipes/uclibc/uclibc-git/powerpc_copysignl.patch b/recipes/uclibc/uclibc-git/powerpc_copysignl.patch
new file mode 100755
index 0000000..339ce7f
--- /dev/null
+++ b/recipes/uclibc/uclibc-git/powerpc_copysignl.patch
@@ -0,0 +1,107 @@
+Index: git/libc/sysdeps/linux/powerpc/Makefile.arch
+===================================================================
+--- git.orig/libc/sysdeps/linux/powerpc/Makefile.arch
++++ git/libc/sysdeps/linux/powerpc/Makefile.arch
+@@ -5,7 +5,7 @@
+ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ #
+ 
+-CSRC := __syscall_error.c pread_write.c ioctl.c
++CSRC := __syscall_error.c pread_write.c ioctl.c copysignl.c
+ 
+ ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),y)
+ CSRC += posix_fadvise.c posix_fadvise64.c
+Index: git/libc/sysdeps/linux/powerpc/copysignl.c
+===================================================================
+--- /dev/null
++++ git/libc/sysdeps/linux/powerpc/copysignl.c
+@@ -0,0 +1,89 @@
++/* s_copysignl.c -- long double version of s_copysign.c.
++ * Conversion to long double by Ulrich Drepper,
++ * Cygnus Support, drepper at cygnus.com.
++ */
++
++/*
++ * ====================================================
++ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
++ *
++ * Developed at SunPro, a Sun Microsystems, Inc. business.
++ * Permission to use, copy, modify, and distribute this
++ * software is freely granted, provided that this notice
++ * is preserved.
++ * ====================================================
++ */
++
++/*
++ * copysignl(long double x, long double y)
++ * copysignl(x,y) returns a value with the magnitude of x and
++ * with the sign bit of y.
++ */
++
++#include <endian.h>
++#include <stdint.h>
++
++#if __FLOAT_WORD_ORDER == BIG_ENDIAN
++
++typedef union
++{
++  long double value;
++  struct
++  {
++    int sign_exponent:16;
++    unsigned int empty:16;
++    uint32_t msw;
++    uint32_t lsw;
++  } parts;
++} ieee_long_double_shape_type;
++
++#endif
++
++#if __FLOAT_WORD_ORDER == LITTLE_ENDIAN
++
++typedef union
++{
++  long double value;
++  struct
++  {
++    uint32_t lsw;
++    uint32_t msw;
++    int sign_exponent:16;
++    unsigned int empty:16;
++  } parts;
++} ieee_long_double_shape_type;
++
++#endif
++
++/* Get int from the exponent of a long double.  */
++
++#define GET_LDOUBLE_EXP(exp,d)					\
++do {								\
++  ieee_long_double_shape_type ge_u;				\
++  ge_u.value = (d);						\
++  (exp) = ge_u.parts.sign_exponent;				\
++} while (0)
++
++/* Set exponent of a long double from an int.  */
++
++#define SET_LDOUBLE_EXP(d,exp)					\
++do {								\
++  ieee_long_double_shape_type se_u;				\
++  se_u.value = (d);						\
++  se_u.parts.sign_exponent = (exp);				\
++  (d) = se_u.value;						\
++} while (0)
++
++long double copysignl(long double x, long double y);
++libc_hidden_proto(copysignl);
++
++long double copysignl(long double x, long double y)
++{
++	uint32_t es1,es2;
++	GET_LDOUBLE_EXP(es1,x);
++	GET_LDOUBLE_EXP(es2,y);
++	SET_LDOUBLE_EXP(x,(es1&0x7fff)|(es2&0x8000));
++        return x;
++}
++
++libc_hidden_def(copysignl);
diff --git a/recipes/uclibc/uclibc_git.bb b/recipes/uclibc/uclibc_git.bb
index 561c81e..f3e6dfb 100644
--- a/recipes/uclibc/uclibc_git.bb
+++ b/recipes/uclibc/uclibc_git.bb
@@ -14,7 +14,7 @@ DEFAULT_PREFERENCE = "-1"
 # precedence.
 
 require uclibc.inc
-PR = "${INC_PR}.7"
+PR = "${INC_PR}.8"
 PROVIDES += "virtual/${TARGET_PREFIX}libc-for-gcc"
 
 #recent versions uclibc require real kernel headers
@@ -39,5 +39,6 @@ SRC_URI = "git://uclibc.org/uClibc.git;branch=master;protocol=git \
 	file://detect-bx-availibility.patch \
 	file://remove-eabi-oabi-selection.patch \
 	file://mips64-no-waitpid.patch \
+	file://powerpc_copysignl.patch \
 	"
 S = "${WORKDIR}/git"





More information about the Openembedded-commits mailing list