Browse Source

rework ARM NEON support

Don't build C library with -ffast-math when NEON is globally enabled.
Disable NEON support by default.
Remove dangerous -funsafe-math-optimizations.

Most suggestions from Rich Felker after analyzing libc-test
failures in my setup.
Waldemar Brodkorb 8 years ago
parent
commit
77f9d57de4
4 changed files with 9 additions and 5 deletions
  1. 2 2
      mk/vars.mk
  2. 1 1
      target/config/Config.in.fpu
  3. 2 0
      toolchain/musl/Makefile
  4. 4 2
      toolchain/uclibc-ng/Makefile

+ 2 - 2
mk/vars.mk

@@ -264,8 +264,8 @@ endif
 
 ifeq ($(ADK_TARGET_ARCH_ARM),y)
 ifeq ($(ADK_TARGET_ARCH_ARM_WITH_NEON),y)
-TARGET_CFLAGS+=		-funsafe-math-optimizations -ffast-math
-TARGET_CXXFLAGS+=	-funsafe-math-optimizations -ffast-math
+TARGET_CFLAGS+=		-ffast-math
+TARGET_CXXFLAGS+=	-ffast-math
 endif
 ifeq ($(ADK_TARGET_ARCH_ARM_WITH_THUMB),y)
 TARGET_CFLAGS+=		-mthumb -Wa,-mimplicit-it=thumb -mno-thumb-interwork

+ 1 - 1
target/config/Config.in.fpu

@@ -4,7 +4,7 @@
 config ADK_TARGET_ARCH_ARM_WITH_NEON
 	bool "enable NEON SIMD support"
 	depends on ADK_TARGET_ARCH_ARM && ADK_TARGET_CPU_WITH_NEON
-	default y
+	default n
 	help
 	  Enable support for NEON SIMD CPU extensions.
 

+ 2 - 0
toolchain/musl/Makefile

@@ -12,6 +12,8 @@ endif
 # not yet possible
 TARGET_CFLAGS:=		$(filter-out -fstack-protector-all,$(TARGET_CFLAGS))
 TARGET_LDFLAGS:=	$(filter-out -fstack-protector-all,$(TARGET_LDFLAGS))
+# don't use fast-math for C library
+TARGET_CFLAGS:=         $(filter-out -ffast-math,$(TARGET_CFLAGS))
 
 $(WRKBUILD)/.configured:
 	(cd $(WRKBUILD); CC='$(TARGET_CC)' CROSS_COMPILE='$(TARGET_CROSS)' \

+ 4 - 2
toolchain/uclibc-ng/Makefile

@@ -9,10 +9,12 @@ include Makefile.inc
 include ${ADK_TOPDIR}/mk/buildhlp.mk
 
 # disable LTO
-TARGET_CFLAGS:=$(filter-out -flto,$(TARGET_CFLAGS))
+TARGET_CFLAGS:=	$(filter-out -flto,$(TARGET_CFLAGS))
 # handled by uClibc-ng makefiles
-TARGET_CFLAGS:=$(filter-out -fstack-protector-all,$(TARGET_CFLAGS))
+TARGET_CFLAGS:=	$(filter-out -fstack-protector-all,$(TARGET_CFLAGS))
 TARGET_LDFLAGS:=$(filter-out -fstack-protector-all,$(TARGET_LDFLAGS))
+# don't use fast-math for C library
+TARGET_CFLAGS:=	$(filter-out -ffast-math,$(TARGET_CFLAGS))
 
 ifeq ($(ADK_TARGET_HARD_FLOAT),y)
 ifeq ($(ADK_TARGET_ARCH_ARM),y)