Build glibc with -frounding-math
authorAndreas Jaeger <aj@suse.de>
Sun, 6 May 2012 07:14:15 +0000 (09:14 +0200)
committerAndreas Jaeger <aj@suse.de>
Sun, 6 May 2012 07:14:15 +0000 (09:14 +0200)
* Makeconfig (+math-flags): New, set to -frounding-math.
(+cflags): Add +math-flags so that all of glibc gets compiled with
it.

ChangeLog
Makeconfig

index e1213921633ac729de6a6be1fb05d49cc3018484..866f9bd6c1b9a82204a0757715fda0b1ad2c744a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-05-06  Andreas Jaeger  <aj@suse.de>
+
+       * Makeconfig (+math-flags): New, set to -frounding-math.
+       (+cflags): Add +math-flags so that all of glibc gets compiled with
+       it.
+
 2012-05-05  Joseph Myers  <joseph@codesourcery.com>
 
        * math/libm-test.inc (hypot_test) [TEST_DOUBLE && TEST_INLINE]:
index 5c78ee497b3f96a22ee6d086f36acffdb65047b4..f68a752766a44f1c90c646c26dcac2fe453ab649 100644 (file)
@@ -574,6 +574,11 @@ endif
 # actually different, so allow the compiler to merge them all.
 +merge-constants = -fmerge-all-constants
 
+# We have to assume that glibc functions are called in any rounding
+# mode and also change the rounding mode in a few functions. So,
+# disable any optimization that assume default rounding mode.
++math-flags = -frounding-math
+
 # This is the program that generates makefile dependencies from C source files.
 # The -MP flag tells GCC >= 3.2 (which we now require) to produce dummy
 # targets for headers so that removed headers don't break the build.
@@ -633,7 +638,7 @@ ifeq        "$(strip $(+cflags))" ""
 +cflags        := $(default_cflags)
 endif  # $(+cflags) == ""
 
-+cflags += $(cflags-cpu) $(+gccwarn) $(+merge-constants)
++cflags += $(cflags-cpu) $(+gccwarn) $(+merge-constants) $(+math-flags)
 +gcc-nowarn := -w
 
 # Don't duplicate options if we inherited variables from the parent.