unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob baba5971f46349e0dd779b305585944366b59d7d 3251 bytes (raw)
name: gnu/packages/patches/glibc-2-26-0041.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
 
From d37c951fde57e8acb320a9a7d437ba50a1fc3c8a Mon Sep 17 00:00:00 2001
From: "Gabriel F. T. Gomes" <gabriel@inconstante.eti.br>
Date: Wed, 20 Sep 2017 15:10:26 -0300
Subject: [PATCH 41/90] Let fpclassify use the builtin when optimizing for size
 in C++ mode (bug 22146)

When optimization for size is on (-Os), fpclassify does not use the
type-generic __builtin_fpclassify builtin, instead it uses __MATH_TG.
However, when library support for float128 is available, __MATH_TG uses
__builtin_types_compatible_p, which is not available in C++ mode.

On the other hand, libstdc++ undefines (in cmath) many macros from
math.h, including fpclassify, so that it can provide its own functions.
However, during its configure tests, libstdc++ just tests for the
availability of the macros (it does not undefine them, nor does it
provide its own functions).

Finally, when libstdc++ is configured with optimization for size
enabled, its configure tests include math.h and get the definition of
fpclassify that uses __MATH_TG (and __builtin_types_compatible_p).
Since libstdc++ does not undefine the macros during its configure tests,
they fail.

This patch lets fpclassify use the builtin in C++ mode, even when
optimization for size is on.  This allows the configure test in
libstdc++ to work.

Tested for powerpc64le and x86_64.

	[BZ #22146]
	math/math.h: Let fpclassify use the builtin in C++ mode, even
	when optimazing for size.

(cherry picked from commit c5c4a626098ec884b8527356abdf2a4bb7b6bf27)

diff --git a/ChangeLog b/ChangeLog
index 6b09c61d5a..382674d5a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-09-22  Gabriel F. T. Gomes  <gabriel@inconstante.eti.br>
+
+	[BZ #22146]
+	math/math.h: Let fpclassify use the builtin in C++ mode, even
+	when optimazing for size.
+
 2017-08-22  Gabriel F. T. Gomes  <gftg@linux.vnet.ibm.com>
 
 	* include/libc-symbols.h: [!defined HAVE_GCC_IFUNC] (__ifunc):
diff --git a/NEWS b/NEWS
index 9bcb176171..48e2064380 100644
--- a/NEWS
+++ b/NEWS
@@ -30,6 +30,7 @@ The following bugs are resolved with this release:
   [21972] assert macro requires operator== (int) for its argument type
   [22095] resolv: Fix memory leak with OOM during resolv.conf parsing
   [22096] resolv: __resolv_conf_attach must not free passed conf object
+  [22146] Let fpclassify use the builtin when optimizing for size in C++ mode
 \f
 Version 2.26
 
diff --git a/math/math.h b/math/math.h
index 7c0fc6dbb3..f9348ec3ea 100644
--- a/math/math.h
+++ b/math/math.h
@@ -402,7 +402,13 @@ enum
 
 /* Return number of classification appropriate for X.  */
 # if __GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__			      \
-     && !defined __OPTIMIZE_SIZE__
+     && (!defined __OPTIMIZE_SIZE__ || defined __cplusplus)
+     /* The check for __cplusplus allows the use of the builtin, even
+	when optimization for size is on.  This is provided for
+	libstdc++, only to let its configure test work when it is built
+	with -Os.  No further use of this definition of fpclassify is
+	expected in C++ mode, since libstdc++ provides its own version
+	of fpclassify in cmath (which undefines fpclassify).  */
 #  define fpclassify(x) __builtin_fpclassify (FP_NAN, FP_INFINITE,	      \
      FP_NORMAL, FP_SUBNORMAL, FP_ZERO, x)
 # else

debug log:

solving baba5971f ...
found baba5971f in https://yhetil.org/guix-patches/87ine0pjiu.fsf@fastmail.com/ ||
	https://yhetil.org/guix-patches/87d148pe57.fsf@fastmail.com/

applying [1/1] https://yhetil.org/guix-patches/87ine0pjiu.fsf@fastmail.com/
diff --git a/gnu/packages/patches/glibc-2-26-0041.patch b/gnu/packages/patches/glibc-2-26-0041.patch
new file mode 100644
index 000000000..baba5971f

1:54: trailing whitespace.
 
1:55: space before tab in indent.
 	* include/libc-symbols.h: [!defined HAVE_GCC_IFUNC] (__ifunc):
1:67: trailing whitespace.
 
1:73: trailing whitespace.
 
Checking patch gnu/packages/patches/glibc-2-26-0041.patch...
Applied patch gnu/packages/patches/glibc-2-26-0041.patch cleanly.
warning: 4 lines add whitespace errors.

skipping https://yhetil.org/guix-patches/87d148pe57.fsf@fastmail.com/ for baba5971f
index at:
100644 baba5971f46349e0dd779b305585944366b59d7d	gnu/packages/patches/glibc-2-26-0041.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).