diff mbox

[RFC] fix math cflags overrides

Message ID 599E9BF4.2060202@arm.com
State Committed
Commit 8aa48656bb00074f3f422d805f15d07d786970ba
Headers show

Commit Message

Szabolcs Nagy Aug. 24, 2017, 9:27 a.m. UTC
The problem i see is that in the makefile logic the sysdirs var has
sysdeps/aarch64/fpu before sysdeps/ieee754/dbl-64.

this means source files and rules in the former override files in
the later (which is good), but it also means variable definitions
in makefile fragments of the later overrides the ones of the former
(i.e. reverse order wrt the source override, which is not what i'd
expect).

as a workaround i'd just use += instead of = in the dbl-64 makefile
cflags definitions so at least it does not drop earlier cflags,
the cflag definition ordering is not ideal: if i have a target
specific sqrt, i don't want to compile it with nofma flags.

2017-08-23  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* sysdeps/ieee754/dbl-64/Makefile: Don't override cflags.

Comments

Joseph Myers Aug. 24, 2017, 2:33 p.m. UTC | #1
On Thu, 24 Aug 2017, Szabolcs Nagy wrote:

> as a workaround i'd just use += instead of = in the dbl-64 makefile
> cflags definitions so at least it does not drop earlier cflags,
> the cflag definition ordering is not ideal: if i have a target
> specific sqrt, i don't want to compile it with nofma flags.

This patch is OK on the general principle of using += in Makefiles when 
overriding is not specifically intended.

For a target-specific file, the nofma flags could be worked around by just 
having a dummy e_sqrt.c and the main implementation in a separate 
e_sqrt_<arch>.c.  Or make all the cases where contraction is appropriate 
explicit (e.g. sysdeps/powerpc/fpu/e_sqrt.c makes explicit use of 
__builtin_fma to fix bug 17964).
diff mbox

Patch

diff --git a/sysdeps/ieee754/dbl-64/Makefile b/sysdeps/ieee754/dbl-64/Makefile
index 5557c75b45..c965982fa5 100644
--- a/sysdeps/ieee754/dbl-64/Makefile
+++ b/sysdeps/ieee754/dbl-64/Makefile
@@ -1,6 +1,6 @@ 
 ifeq ($(subdir),math)
 # branred depends on precise IEEE double rounding
-CFLAGS-branred.c = $(config-cflags-nofma)
-CFLAGS-e_sqrt.c = $(config-cflags-nofma)
-CFLAGS-e_pow.c = $(config-cflags-nofma)
+CFLAGS-branred.c += $(config-cflags-nofma)
+CFLAGS-e_sqrt.c += $(config-cflags-nofma)
+CFLAGS-e_pow.c += $(config-cflags-nofma)
 endif