The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/conf/kern.mk

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 # $FreeBSD: releng/10.4/sys/conf/kern.mk 278679 2015-02-13 16:08:45Z ian $
    2 
    3 #
    4 # Warning flags for compiling the kernel and components of the kernel:
    5 #
    6 CWARNFLAGS?=    -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
    7                 -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \
    8                 -Wundef -Wno-pointer-sign ${FORMAT_EXTENSIONS} \
    9                 -Wmissing-include-dirs -fdiagnostics-show-option \
   10                 ${CWARNEXTRA}
   11 #
   12 # The following flags are next up for working on:
   13 #       -Wextra
   14 
   15 # Disable a few warnings for clang, since there are several places in the
   16 # kernel where fixing them is more trouble than it is worth, or where there is
   17 # a false positive.
   18 .if ${COMPILER_TYPE} == "clang"
   19 NO_WCONSTANT_CONVERSION=        -Wno-constant-conversion
   20 NO_WARRAY_BOUNDS=               -Wno-array-bounds
   21 NO_WSHIFT_COUNT_NEGATIVE=       -Wno-shift-count-negative
   22 NO_WSHIFT_COUNT_OVERFLOW=       -Wno-shift-count-overflow
   23 NO_WUNUSED_VALUE=               -Wno-unused-value
   24 NO_WSELF_ASSIGN=                -Wno-self-assign
   25 NO_WFORMAT_SECURITY=            -Wno-format-security
   26 NO_WUNNEEDED_INTERNAL_DECL=     -Wno-unneeded-internal-declaration
   27 NO_WSOMETIMES_UNINITIALIZED=    -Wno-error-sometimes-uninitialized
   28 # Several other warnings which might be useful in some cases, but not severe
   29 # enough to error out the whole kernel build.  Display them anyway, so there is
   30 # some incentive to fix them eventually.
   31 CWARNEXTRA?=    -Wno-error-tautological-compare -Wno-error-empty-body \
   32                 -Wno-error-parentheses-equality -Wno-error-unused-function \
   33                 ${NO_WFORMAT}
   34 .endif
   35 
   36 .if ${COMPILER_TYPE} == "gcc"
   37 # For gcc 4.2, eliminate the too-often-wrong warnings about uninitialized vars.
   38 CWARNEXTRA?=    -Wno-uninitialized
   39 .endif
   40 
   41 # External compilers may not support our format extensions.  Allow them
   42 # to be disabled.  WARNING: format checking is disabled in this case.
   43 .if ${MK_FORMAT_EXTENSIONS} == "no"
   44 NO_WFORMAT=             -Wno-format
   45 .else
   46 FORMAT_EXTENSIONS=      -fformat-extensions
   47 .endif
   48 
   49 #
   50 # On i386, do not align the stack to 16-byte boundaries.  Otherwise GCC 2.95
   51 # and above adds code to the entry and exit point of every function to align the
   52 # stack to 16-byte boundaries -- thus wasting approximately 12 bytes of stack
   53 # per function call.  While the 16-byte alignment may benefit micro benchmarks,
   54 # it is probably an overall loss as it makes the code bigger (less efficient
   55 # use of code cache tag lines) and uses more stack (less efficient use of data
   56 # cache tag lines).  Explicitly prohibit the use of FPU, SSE and other SIMD
   57 # operations inside the kernel itself.  These operations are exclusively
   58 # reserved for user applications.
   59 #
   60 # gcc:
   61 # Setting -mno-mmx implies -mno-3dnow
   62 # Setting -mno-sse implies -mno-sse2, -mno-sse3 and -mno-ssse3
   63 #
   64 # clang:
   65 # Setting -mno-mmx implies -mno-3dnow and -mno-3dnowa
   66 # Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42
   67 #
   68 .if ${MACHINE_CPUARCH} == "i386"
   69 .if ${COMPILER_TYPE} != "clang"
   70 CFLAGS+=        -mno-align-long-strings -mpreferred-stack-boundary=2
   71 .else
   72 CFLAGS+=        -mno-aes -mno-avx
   73 .endif
   74 CFLAGS+=        -mno-mmx -mno-sse -msoft-float
   75 INLINE_LIMIT?=  8000
   76 .endif
   77 
   78 .if ${MACHINE_CPUARCH} == "arm"
   79 INLINE_LIMIT?=  8000
   80 .endif
   81 
   82 #
   83 # For IA-64, we use r13 for the kernel globals pointer and we only use
   84 # a very small subset of float registers for integer divides.
   85 #
   86 .if ${MACHINE_CPUARCH} == "ia64"
   87 CFLAGS+=        -ffixed-r13 -mfixed-range=f32-f127 -fpic #-mno-sdata
   88 INLINE_LIMIT?=  15000
   89 .endif
   90 
   91 #
   92 # For sparc64 we want the medany code model so modules may be located
   93 # anywhere in the 64-bit address space.  We also tell GCC to use floating
   94 # point emulation.  This avoids using floating point registers for integer
   95 # operations which it has a tendency to do.
   96 #
   97 .if ${MACHINE_CPUARCH} == "sparc64"
   98 .if ${COMPILER_TYPE} == "clang"
   99 CFLAGS+=        -mcmodel=large -fno-dwarf2-cfi-asm
  100 .else
  101 CFLAGS+=        -mcmodel=medany -msoft-float
  102 .endif
  103 INLINE_LIMIT?=  15000
  104 .endif
  105 
  106 #
  107 # For AMD64, we explicitly prohibit the use of FPU, SSE and other SIMD
  108 # operations inside the kernel itself.  These operations are exclusively
  109 # reserved for user applications.
  110 #
  111 # gcc:
  112 # Setting -mno-mmx implies -mno-3dnow
  113 # Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3 and -mfpmath=387
  114 #
  115 # clang:
  116 # Setting -mno-mmx implies -mno-3dnow and -mno-3dnowa
  117 # Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42
  118 # (-mfpmath= is not supported)
  119 #
  120 .if ${MACHINE_CPUARCH} == "amd64"
  121 .if ${COMPILER_TYPE} == "clang"
  122 CFLAGS+=        -mno-aes -mno-avx
  123 .endif
  124 CFLAGS+=        -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float \
  125                 -fno-asynchronous-unwind-tables
  126 INLINE_LIMIT?=  8000
  127 .endif
  128 
  129 #
  130 # For PowerPC we tell gcc to use floating point emulation.  This avoids using
  131 # floating point registers for integer operations which it has a tendency to do.
  132 # Also explicitly disable Altivec instructions inside the kernel.
  133 #
  134 .if ${MACHINE_CPUARCH} == "powerpc"
  135 CFLAGS+=        -msoft-float -mno-altivec
  136 INLINE_LIMIT?=  15000
  137 .endif
  138 
  139 #
  140 # Use dot symbols on powerpc64 to make ddb happy
  141 #
  142 .if ${MACHINE_ARCH} == "powerpc64"
  143 CFLAGS+=        -mcall-aixdesc
  144 .endif
  145 
  146 #
  147 # For MIPS we also tell gcc to use floating point emulation
  148 #
  149 .if ${MACHINE_CPUARCH} == "mips"
  150 CFLAGS+=        -msoft-float
  151 INLINE_LIMIT?=  8000
  152 .endif
  153 
  154 #
  155 # GCC 3.0 and above like to do certain optimizations based on the
  156 # assumption that the program is linked against libc.  Stop this.
  157 #
  158 CFLAGS+=        -ffreestanding
  159 
  160 #
  161 # GCC SSP support
  162 #
  163 .if ${MK_SSP} != "no" && ${MACHINE_CPUARCH} != "ia64" && \
  164     ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips"
  165 CFLAGS+=        -fstack-protector
  166 .endif
  167 
  168 #
  169 # Add -gdwarf-2 when compiling -g
  170 #
  171 .if ${COMPILER_TYPE} == "clang" && ${CFLAGS:M-g} != "" && ${CFLAGS:M-gdwarf} == ""
  172 CFLAGS+=        -gdwarf-2
  173 .endif

Cache object: 2e2e74610605aa08dcb32833b9830943


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.