cf: Use common macro to test compiler flags
[openafs.git] / src / cf / solaris-test1.m4
1 dnl This test is for the Solaris x86 kernel module
2 dnl build.  They prevent newer Solaris compilers (12.3
3 dnl and up) from using XMM registers (SIMD instructions)
4 dnl and floating point registers, which are invalid in
5 dnl Solaris kernel code.
6 dnl Without this, Solaris may panic in libafs with:
7 dnl   BAD TRAP: type=7 (#nm Device not available)
8 dnl
9 dnl
10 AC_DEFUN([SOLARIS_CC_TAKES_XVECTOR_NONE], [
11 dnl -xvector=%none first appeared in Studio 11, but has only been
12 dnl documented as required for Solaris x86 kernel code since Studio
13 dnl 12.3.  Studio 12.3 is when the compiler started making more
14 dnl aggressive optimizations by using SSE/SIMD instructions with XMM
15 dnl (floating point/ SIMD) registers.  Although -xvector=%none is
16 dnl required to prevent these optimizations, it is not sufficient.
17 dnl Experiments have shown that -xregs=no%float is also needed to
18 dnl 1) eliminate a few optimizations not squelched by -xvector=%none,
19 dnl and 2) prevent actual use of floating point types in the kernel
20 dnl module.
21 dnl
22   AX_APPEND_COMPILE_FLAGS([-xvector=%none -xregs=no%float], [SOLARIS_CC_KOPTS])
23 ])
24