diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2016-07-26 19:07:10 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2016-07-26 19:07:10 +0000 |
commit | 7be1b07afad34d8e30960b2ba4ef0345981de096 (patch) | |
tree | 3bce595df93e3d0c9100618218c9ccfb59b154b7 /lib/libc | |
parent | d9f6c851eb9fb66fff25d6f2669cd86def7a5363 (diff) |
Wrap fpgetround() so internal calls to it (seen on arm, powerpc, and sh)
go direct instead of through the PLT.
ok millert@ kettenis@
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/arch/alpha/gen/fpgetround.c | 5 | ||||
-rw-r--r-- | lib/libc/arch/hppa/gen/fpgetround.c | 5 | ||||
-rw-r--r-- | lib/libc/arch/m88k/gen/fpgetround.c | 5 | ||||
-rw-r--r-- | lib/libc/arch/mips64/gen/fpgetround.c | 5 | ||||
-rw-r--r-- | lib/libc/arch/powerpc/gen/flt_rounds.c | 5 | ||||
-rw-r--r-- | lib/libc/arch/powerpc/gen/fpgetround.c | 5 | ||||
-rw-r--r-- | lib/libc/arch/sh/gen/flt_rounds.c | 4 | ||||
-rw-r--r-- | lib/libc/arch/sh/gen/fpgetround.c | 5 | ||||
-rw-r--r-- | lib/libc/arch/sparc/gen/fpgetround.c | 5 | ||||
-rw-r--r-- | lib/libc/arch/sparc64/gen/fpgetround.c | 5 | ||||
-rw-r--r-- | lib/libc/hidden/ieeefp.h | 30 | ||||
-rw-r--r-- | lib/libc/softfloat/fpgetround.c | 3 |
12 files changed, 61 insertions, 21 deletions
diff --git a/lib/libc/arch/alpha/gen/fpgetround.c b/lib/libc/arch/alpha/gen/fpgetround.c index a15a82ec3f6..58f4a4f6e47 100644 --- a/lib/libc/arch/alpha/gen/fpgetround.c +++ b/lib/libc/arch/alpha/gen/fpgetround.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fpgetround.c,v 1.4 2005/08/07 16:40:13 espie Exp $ */ +/* $OpenBSD: fpgetround.c,v 1.5 2016/07/26 19:07:09 guenther Exp $ */ /* $NetBSD: fpgetround.c,v 1.1 1995/04/29 05:09:55 cgd Exp $ */ /* @@ -36,7 +36,7 @@ #include <ieeefp.h> fp_rnd -fpgetround() +fpgetround(void) { double fpcrval; u_int64_t old; @@ -48,3 +48,4 @@ fpgetround() return ((old >> 58) & 0x3); } +DEF_WEAK(fpgetround); diff --git a/lib/libc/arch/hppa/gen/fpgetround.c b/lib/libc/arch/hppa/gen/fpgetround.c index 8ec62343404..e84297f58cb 100644 --- a/lib/libc/arch/hppa/gen/fpgetround.c +++ b/lib/libc/arch/hppa/gen/fpgetround.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fpgetround.c,v 1.4 2014/04/18 15:09:52 guenther Exp $ */ +/* $OpenBSD: fpgetround.c,v 1.5 2016/07/26 19:07:09 guenther Exp $ */ /* * Written by Miodrag Vallat. Public domain @@ -8,10 +8,11 @@ #include <ieeefp.h> fp_rnd -fpgetround() +fpgetround(void) { u_int64_t fpsr; __asm__ volatile("fstd %%fr0,0(%1)" : "=m" (fpsr) : "r" (&fpsr)); return ((fpsr >> 41) & 0x3); } +DEF_WEAK(fpgetround); diff --git a/lib/libc/arch/m88k/gen/fpgetround.c b/lib/libc/arch/m88k/gen/fpgetround.c index ca59bb78ac7..bbd59ddf5fd 100644 --- a/lib/libc/arch/m88k/gen/fpgetround.c +++ b/lib/libc/arch/m88k/gen/fpgetround.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fpgetround.c,v 1.4 2013/01/05 11:20:55 miod Exp $ */ +/* $OpenBSD: fpgetround.c,v 1.5 2016/07/26 19:07:09 guenther Exp $ */ /* * Written by J.T. Conklin, Apr 10, 1995 @@ -9,10 +9,11 @@ #include <ieeefp.h> fp_rnd -fpgetround() +fpgetround(void) { int x; __asm__ volatile ("fldcr %0, %%fcr63" : "=r" (x)); return (x >> 14) & 0x03; } +DEF_WEAK(fpgetround); diff --git a/lib/libc/arch/mips64/gen/fpgetround.c b/lib/libc/arch/mips64/gen/fpgetround.c index 6d88954d72f..55071978391 100644 --- a/lib/libc/arch/mips64/gen/fpgetround.c +++ b/lib/libc/arch/mips64/gen/fpgetround.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fpgetround.c,v 1.2 2005/08/07 16:40:15 espie Exp $ */ +/* $OpenBSD: fpgetround.c,v 1.3 2016/07/26 19:07:09 guenther Exp $ */ /* * Written by J.T. Conklin, Apr 11, 1995 * Public domain. @@ -7,10 +7,11 @@ #include <ieeefp.h> fp_rnd -fpgetround() +fpgetround(void) { int x; __asm__("cfc1 %0,$31" : "=r" (x)); return x & 0x03; } +DEF_WEAK(fpgetround); diff --git a/lib/libc/arch/powerpc/gen/flt_rounds.c b/lib/libc/arch/powerpc/gen/flt_rounds.c index d3976cede0a..7f9869e1ddf 100644 --- a/lib/libc/arch/powerpc/gen/flt_rounds.c +++ b/lib/libc/arch/powerpc/gen/flt_rounds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: flt_rounds.c,v 1.6 2015/10/27 05:54:49 guenther Exp $ */ +/* $OpenBSD: flt_rounds.c,v 1.7 2016/07/26 19:07:09 guenther Exp $ */ /* $NetBSD: flt_rounds.c,v 1.5 2001/05/25 12:14:05 simonb Exp $ */ /* @@ -34,6 +34,7 @@ #include <sys/types.h> #include <float.h> +#include <ieeefp.h> static const int map[] = { @@ -44,7 +45,7 @@ static const int map[] = { }; int -__flt_rounds() +__flt_rounds(void) { #ifdef _SOFT_FLOAT return map[fpgetround()]; diff --git a/lib/libc/arch/powerpc/gen/fpgetround.c b/lib/libc/arch/powerpc/gen/fpgetround.c index 12aa12e7201..60c6cdeaf86 100644 --- a/lib/libc/arch/powerpc/gen/fpgetround.c +++ b/lib/libc/arch/powerpc/gen/fpgetround.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fpgetround.c,v 1.3 2014/04/17 09:01:25 guenther Exp $ */ +/* $OpenBSD: fpgetround.c,v 1.4 2016/07/26 19:07:09 guenther Exp $ */ /* $NetBSD: fpgetround.c,v 1.1 1999/07/07 01:55:08 danw Exp $ */ /* @@ -34,10 +34,11 @@ #include <ieeefp.h> fp_rnd -fpgetround() +fpgetround(void) { u_int64_t fpscr; __asm__ volatile("mffs %0" : "=f"(fpscr)); return (fpscr & 0x3); } +DEF_WEAK(fpgetround); diff --git a/lib/libc/arch/sh/gen/flt_rounds.c b/lib/libc/arch/sh/gen/flt_rounds.c index 31fe8e2af30..4add477ab84 100644 --- a/lib/libc/arch/sh/gen/flt_rounds.c +++ b/lib/libc/arch/sh/gen/flt_rounds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: flt_rounds.c,v 1.5 2015/10/27 05:54:49 guenther Exp $ */ +/* $OpenBSD: flt_rounds.c,v 1.6 2016/07/26 19:07:09 guenther Exp $ */ /* * Copyright (c) 2006 Miodrag Vallat. * @@ -18,7 +18,7 @@ #include <sys/types.h> #include <float.h> -#include <machine/ieeefp.h> +#include <ieeefp.h> static const int rndmap[] = { 1, /* round to nearest */ diff --git a/lib/libc/arch/sh/gen/fpgetround.c b/lib/libc/arch/sh/gen/fpgetround.c index 3f45ea139ed..de61effe63b 100644 --- a/lib/libc/arch/sh/gen/fpgetround.c +++ b/lib/libc/arch/sh/gen/fpgetround.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fpgetround.c,v 1.2 2014/04/18 15:09:52 guenther Exp $ */ +/* $OpenBSD: fpgetround.c,v 1.3 2016/07/26 19:07:09 guenther Exp $ */ /* * Copyright (c) 2006 Miodrag Vallat. * @@ -20,10 +20,11 @@ #include <ieeefp.h> fp_rnd -fpgetround() +fpgetround(void) { register_t fpscr; __asm__ volatile ("sts fpscr, %0" : "=r" (fpscr)); return (fpscr & 0x3); } +DEF_WEAK(fpgetround); diff --git a/lib/libc/arch/sparc/gen/fpgetround.c b/lib/libc/arch/sparc/gen/fpgetround.c index ed7accb4a1d..84e7f49a82d 100644 --- a/lib/libc/arch/sparc/gen/fpgetround.c +++ b/lib/libc/arch/sparc/gen/fpgetround.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fpgetround.c,v 1.3 2005/08/07 16:40:15 espie Exp $ */ +/* $OpenBSD: fpgetround.c,v 1.4 2016/07/26 19:07:09 guenther Exp $ */ /* * Written by J.T. Conklin, Apr 10, 1995 * Public domain. @@ -7,10 +7,11 @@ #include <ieeefp.h> fp_rnd -fpgetround() +fpgetround(void) { int x; __asm__("st %%fsr,%0" : "=m" (*&x)); return (x >> 30) & 0x03; } +DEF_WEAK(fpgetround); diff --git a/lib/libc/arch/sparc64/gen/fpgetround.c b/lib/libc/arch/sparc64/gen/fpgetround.c index b15f2e3bccc..76f35952631 100644 --- a/lib/libc/arch/sparc64/gen/fpgetround.c +++ b/lib/libc/arch/sparc64/gen/fpgetround.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fpgetround.c,v 1.1 2001/08/29 01:34:56 art Exp $ */ +/* $OpenBSD: fpgetround.c,v 1.2 2016/07/26 19:07:09 guenther Exp $ */ /* * Written by J.T. Conklin, Apr 10, 1995 @@ -8,10 +8,11 @@ #include <ieeefp.h> fp_rnd -fpgetround() +fpgetround(void) { int x; __asm__("st %%fsr,%0" : "=m" (*&x)); return (x >> 30) & 0x03; } +DEF_WEAK(fpgetround); diff --git a/lib/libc/hidden/ieeefp.h b/lib/libc/hidden/ieeefp.h new file mode 100644 index 00000000000..7108eb8fb91 --- /dev/null +++ b/lib/libc/hidden/ieeefp.h @@ -0,0 +1,30 @@ +/* $OpenBSD: ieeefp.h,v 1.1 2016/07/26 19:07:09 guenther Exp $ */ +/* + * Copyright (c) 2016 Philip Guenther <guenther@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBC_IEEEFP_H_ +#define _LIBC_IEEEFP_H_ + +#include_next <ieeefp.h> + +PROTO_DEPRECATED(fpgetmask); +PROTO_NORMAL(fpgetround); +PROTO_DEPRECATED(fpgetsticky); +PROTO_DEPRECATED(fpsetmask); +PROTO_DEPRECATED(fpsetround); +PROTO_DEPRECATED(fpsetsticky); + +#endif /* _LIBC_IEEEFP_H_ */ diff --git a/lib/libc/softfloat/fpgetround.c b/lib/libc/softfloat/fpgetround.c index b180d415bf2..b0042bae105 100644 --- a/lib/libc/softfloat/fpgetround.c +++ b/lib/libc/softfloat/fpgetround.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fpgetround.c,v 1.6 2016/07/18 19:05:22 guenther Exp $ */ +/* $OpenBSD: fpgetround.c,v 1.7 2016/07/26 19:07:09 guenther Exp $ */ /* $NetBSD: fpgetround.c,v 1.2 2002/01/13 21:45:53 thorpej Exp $ */ /*- @@ -45,3 +45,4 @@ fpgetround(void) return float_rounding_mode; } +DEF_WEAK(fpgetround); |