Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / cf / solaris-test1.m4
CommitLineData
805e021f
CE
1dnl This test is for the Solaris x86 kernel module
2dnl build. They prevent newer Solaris compilers (12.3
3dnl and up) from using XMM registers (SIMD instructions)
4dnl and floating point registers, which are invalid in
5dnl Solaris kernel code.
6dnl Without this, Solaris may panic in libafs with:
7dnl BAD TRAP: type=7 (#nm Device not available)
8dnl
9dnl
10AC_DEFUN([SOLARIS_CC_TAKES_XVECTOR_NONE], [
11 AC_CACHE_CHECK([if $CC accepts -xvector=%none],
12 [ac_cv_solaris_cc_takes_xvector_none],
13 [save_CFLAGS="$CFLAGS"
14 CFLAGS="$CFLAGS -xvector=%none"
15 AC_COMPILE_IFELSE(
16 [AC_LANG_PROGRAM([[]], [[int x;]])],
17 [ac_cv_solaris_cc_takes_xvector_none=yes],
18 [ac_cv_solaris_cc_takes_xvector_none=no])
19 CFLAGS="$save_CFLAGS"
20 ])
21
22dnl -xvector=%none first appeared in Studio 11, but has only been
23dnl documented as required for Solaris x86 kernel code since Studio
24dnl 12.3. Studio 12.3 is when the compiler started making more
25dnl aggressive optimizations by using SSE/SIMD instructions with XMM
26dnl (floating point/ SIMD) registers. Although -xvector=%none is
27dnl required to prevent these optimizations, it is not sufficient.
28dnl Experiments have shown that -xregs=no%float is also needed to
29dnl 1) eliminate a few optimizations not squelched by -xvector=%none,
30dnl and 2) prevent actual use of floating point types in the kernel
31dnl module. -xregs=no%float has been present since before Studio 8, so
32dnl it is safe to assume its presence when -xvector=%none is present.
33dnl
34
35 AS_IF([test "$ac_cv_solaris_cc_takes_xvector_none" = "yes"],
36 [SOLARIS_CC_KOPTS="-xvector=%none -xregs=no%float "])
37])
38