This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
RE: libm -fno-builtin
- From: "Jon Beniston" <jon at beniston dot com>
- To: <newlib at sourceware dot org>
- Date: Wed, 20 Jun 2018 17:11:23 +0100
- Subject: RE: libm -fno-builtin
- References: <005301d407c1$b3a9a8b0$1afcfa10$@beniston.com>
Hi,
I've tried removing -fno-builtin for libm and the results look good. As well
as fabs and floor, gcc also inlines creal, cimag, carg, copysign and finite.
Some of the complex maths functions are greatly simplified, as creal & cimag
can effectively be optimised away, whereas at the moment the function calls
result in lots of stack manipulation. I can't see anything obviously
problematic with this.
Overall, for my embedded target, libm code size reduced by about 4%.
Cheers,
Jon
Here's a few places where it can be removed - there's also other uses in
machine/*/configure - but I guess that is best left to the maintainers of
those ports to remove.
diff --git a/newlib/libm/configure b/newlib/libm/configure
index 961f0cb6d..f37fae2a7 100755
--- a/newlib/libm/configure
+++ b/newlib/libm/configure
@@ -3725,7 +3725,7 @@ fi
. ${newlib_basedir}/configure.host
-newlib_cflags="${newlib_cflags} -fno-builtin"
+newlib_cflags="${newlib_cflags}"
NEWLIB_CFLAGS=${newlib_cflags}
diff --git a/newlib/libm/machine/configure b/newlib/libm/machine/configure
index c15ef32ee..2b9c5c1b9 100755
--- a/newlib/libm/machine/configure
+++ b/newlib/libm/machine/configure
@@ -3671,7 +3671,7 @@ fi
. ${newlib_basedir}/configure.host
-newlib_cflags="${newlib_cflags} -fno-builtin"
+newlib_cflags="${newlib_cflags}"
NEWLIB_CFLAGS=${newlib_cflags}
diff --git a/newlib/libm/machine/i386/configure
b/newlib/libm/machine/i386/configure
index f6bf9892a..9f07b7bd2 100755
--- a/newlib/libm/machine/i386/configure
+++ b/newlib/libm/machine/i386/configure
@@ -3661,7 +3661,7 @@ fi
. ${newlib_basedir}/configure.host
-newlib_cflags="${newlib_cflags} -fno-builtin"
+newlib_cflags="${newlib_cflags}"
NEWLIB_CFLAGS=${newlib_cflags}