glibc: Backport hotfixes from RHEL6.
[people/teissler/ipfire-2.x.git] / src / patches / glibc / glibc-rh905575.patch
1 diff -rup a/sysdeps/ieee754/dbl-64/slowexp.c b/sysdeps/ieee754/dbl-64/slowexp.c
2 --- a/sysdeps/ieee754/dbl-64/slowexp.c 2012-01-01 05:16:32.000000000 -0700
3 +++ b/sysdeps/ieee754/dbl-64/slowexp.c 2012-03-13 11:57:51.225330782 -0600
4 @@ -31,6 +31,8 @@
5 #include "mpa.h"
6 #include "math_private.h"
7
8 +#include <stap-probe.h>
9 +
10 void __mpexp(mp_no *x, mp_no *y, int p);
11
12 /*Converting from double precision to Multi-precision and calculating e^x */
13 @@ -61,12 +63,21 @@ __slowexp(double x) {
14 __sub(&mpy,&mpcor,&mpz,p);
15 __mp_dbl(&mpw, &w, p);
16 __mp_dbl(&mpz, &z, p);
17 - if (w == z) return w;
18 + if (w == z) {
19 + /* Track how often we get to the slow exp code plus
20 + its input/output values. */
21 + LIBC_PROBE (slowexp_p6, 2, &x, &w);
22 + return w;
23 + }
24 else { /* if calculating is not exactly */
25 p = 32;
26 __dbl_mp(x,&mpx,p);
27 __mpexp(&mpx, &mpy, p);
28 __mp_dbl(&mpy, &res, p);
29 +
30 + /* Track how often we get to the uber-slow exp code plus
31 + its input/output values. */
32 + LIBC_PROBE (slowexp_p32, 2, &x, &res);
33 return res;
34 }
35 }
36 diff -rup a/sysdeps/ieee754/dbl-64/slowpow.c b/sysdeps/ieee754/dbl-64/slowpow.c
37 --- a/sysdeps/ieee754/dbl-64/slowpow.c 2012-01-01 05:16:32.000000000 -0700
38 +++ b/sysdeps/ieee754/dbl-64/slowpow.c 2012-03-13 11:57:59.865284437 -0600
39 @@ -35,6 +35,8 @@
40 #include "mpa.h"
41 #include "math_private.h"
42
43 +#include <stap-probe.h>
44 +
45 void __mpexp(mp_no *x, mp_no *y, int p);
46 void __mplog(mp_no *x, mp_no *y, int p);
47 double ulog(double);
48 @@ -66,7 +68,12 @@ __slowpow(double x, double y, double z)
49 __mp_dbl(&mpr, &res, p);
50 __sub(&mpp,&eps,&mpr1,p); /* pp -eps =r1 */
51 __mp_dbl(&mpr1, &res1, p); /* converting into double precision */
52 - if (res == res1) return res;
53 + if (res == res1) {
54 + /* Track how often we get to the slow pow code plus
55 + its input/output values. */
56 + LIBC_PROBE (slowpow_p10, 4, &x, &y, &z, &res);
57 + return res;
58 + }
59
60 p = 32; /* if we get here result wasn't calculated exactly, continue */
61 __dbl_mp(x,&mpx,p); /* for more exact calculation */
62 @@ -76,5 +83,10 @@ __slowpow(double x, double y, double z)
63 __mul(&mpy,&mpz,&mpw,p); /* y*z =w */
64 __mpexp(&mpw, &mpp, p); /* e^w=pp */
65 __mp_dbl(&mpp, &res, p); /* converting into double precision */
66 +
67 + /* Track how often we get to the uber-slow pow code plus
68 + its input/output values. */
69 + LIBC_PROBE (slowpow_p32, 4, &x, &y, &z, &res);
70 +
71 return res;
72 }