This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
How to default to -fno-math-errno on all FreeBSD targets
- From: Gerald Pfeifer <gerald at pfeifer dot com>
- To: gcc at gcc dot gnu dot org
- Cc: David Schultz <das at freebsd dot org>, Loren James Rittle <rittle at labs dot mot dot com>
- Date: Mon, 7 Feb 2011 02:48:00 +0100 (CET)
- Subject: How to default to -fno-math-errno on all FreeBSD targets
David Schultz noticed that the FreeBSD libm does not set errno, never
has done, and never will, and thus has made -fno-math-errno the default
in the (old, GCC 4.2-based) system compiler:
http://svn.freebsd.org/viewvc/base?view=revision&revision=181538
We should also make this change for GCC 4.6 and possibly retroactively
GCC 4.5 since we are giving away performance for nothing.
Our documentation already notes that this is the case on Darwin
On Darwin systems, the math library never sets @code{errno}. There is
therefore no reason for the compiler to consider the possibility that
it might, and @option{-fno-math-errno} is the default.
which hacks config/i386/i386.c as follows:
ix86_option_init_struct (struct gcc_options *opts)
{
if (TARGET_MACHO)
/* The Darwin libraries never set errno, so we might as well
avoid calling them when that's the only reason we would. */
opts->x_flag_errno_math = 0;
I guess I could just add a check for FSB_MAJOR there, but that would
only address i386. Is there a better way to accomplish this?
Gerald