summary refs log tree commit diff stats
path: root/config
diff options
context:
space:
mode:
authorJuan Carlos <juancarlospaco@gmail.com>2022-10-06 02:19:41 -0300
committerGitHub <noreply@github.com>2022-10-06 07:19:41 +0200
commitc273496d1852bef725092cbc44295221823edc49 (patch)
treef833269444a697ca5d238b187e851ae52f228d8b /config
parent7caa0379366a500b5db11922d3ac1e739dd5dea1 (diff)
downloadNim-c273496d1852bef725092cbc44295221823edc49.tar.gz
Add no-math-errno for GCC when build for Release (#20503)
* gcc matherrno
* changelog
Diffstat (limited to 'config')
-rw-r--r--config/nim.cfg7
1 files changed, 5 insertions, 2 deletions
diff --git a/config/nim.cfg b/config/nim.cfg
index de525ae92..47bc78ba5 100644
--- a/config/nim.cfg
+++ b/config/nim.cfg
@@ -250,14 +250,17 @@ clang.objc.options.linker = "-lobjc -lgnustep-base"
   gcc.options.linker %= "-L $WIND_BASE/target/lib/usr/lib/ppc/PPC32/common -mrtp -fno-strict-aliasing -D_C99 -D_HAS_C9X -std=c99 -fasm -Wall -Wno-write-strings"
 @end
 
-gcc.options.speed = "-O3 -fno-strict-aliasing -fno-ident"
+# -fno-math-errno is default in OSX, iOS, BSD, Musl, Libm, LLVM, Clang, ICC.
+# See https://itnext.io/why-standard-c-math-functions-are-slow-d10d02554e33
+# and https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/Optimize-Options.html#Optimize-Options
+gcc.options.speed = "-O3 -fno-strict-aliasing -fno-ident -fno-math-errno"
 gcc.options.size = "-Os -fno-ident"
 @if windows:
   gcc.options.debug = "-g3 -Og -gdwarf-3"
 @else:
   gcc.options.debug = "-g3 -Og"
 @end
-gcc.cpp.options.speed = "-O3 -fno-strict-aliasing -fno-ident"
+gcc.cpp.options.speed = "-O3 -fno-strict-aliasing -fno-ident -fno-math-errno"
 gcc.cpp.options.size = "-Os -fno-ident"
 gcc.cpp.options.debug = "-g3 -Og"
 #passl = "-pg"