clang and -mfpmath=387 on ARCH=amd64

Dimitry Andric dim at FreeBSD.org
Sun Dec 12 19:17:31 UTC 2010


On 2010-12-11 12:47, Alexander Best wrote:
> clang doesn't seem to make use of -mfpmath=387 on ARCH=amd64 and complains
> about it (e.g. during TARGET=buildkernel).
>
> any thoughts about the attached patch?

I have compiled two GENERIC kernels on amd64 with and without the
-mfpmath=386 option, and those resulted in exactly the same binaries
(apart from the compilation timestamp).

So I think the whole -mfpmath=387 option is nonsensical anyway.  The
comment just above those CFLAGS in sys/conf/kern.mk says:

# For AMD64, we explicitly prohibit the use of FPU, SSE and other SIMD
# operations inside the kernel itself.  These operations are exclusively
# reserved for user applications.

However, according to the gcc manual, the -mfpmath option does *not*
disable FPU instructions at all, but simply switches the default (for
amd64) from SSE to 387 instructions:

http://gcc.gnu.org/onlinedocs/gcc-4.2.4/gcc/i386-and-x86_002d64-Options.html#index-march-1052

Since -mno-sse is already specified, this flag may actually be worse
than not specifying it at all! :)

I suggest to just remove the entire -mfpmath=387 option unconditionally.


More information about the freebsd-toolchain mailing list