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  -  FREEBSD11  -  FREEBSD10  -  FREEBSD9  -  FREEBSD92  -  FREEBSD91  -  FREEBSD90  -  FREEBSD8  -  FREEBSD82  -  FREEBSD81  -  FREEBSD80  -  FREEBSD7  -  FREEBSD74  -  FREEBSD73  -  FREEBSD72  -  FREEBSD71  -  FREEBSD70  -  FREEBSD6  -  FREEBSD64  -  FREEBSD63  -  FREEBSD62  -  FREEBSD61  -  FREEBSD60  -  FREEBSD5  -  FREEBSD55  -  FREEBSD54  -  FREEBSD53  -  FREEBSD52  -  FREEBSD51  -  FREEBSD50  -  FREEBSD4  -  FREEBSD3  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 # $FreeBSD: stable/11/sys/conf/kern.mk 323720 2017-09-18 20:09:17Z rlibby $
    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                 -Wno-unknown-pragmas \
   11                 ${CWARNEXTRA}
   12 #
   13 # The following flags are next up for working on:
   14 #       -Wextra
   15 
   16 # Disable a few warnings for clang, since there are several places in the
   17 # kernel where fixing them is more trouble than it is worth, or where there is
   18 # a false positive.
   19 .if ${COMPILER_TYPE} == "clang"
   20 NO_WCONSTANT_CONVERSION=        -Wno-constant-conversion
   21 NO_WSHIFT_COUNT_NEGATIVE=       -Wno-shift-count-negative
   22 NO_WSHIFT_COUNT_OVERFLOW=       -Wno-shift-count-overflow
   23 NO_WSELF_ASSIGN=                -Wno-self-assign
   24 NO_WUNNEEDED_INTERNAL_DECL=     -Wno-unneeded-internal-declaration
   25 NO_WSOMETIMES_UNINITIALIZED=    -Wno-error-sometimes-uninitialized
   26 NO_WCAST_QUAL=                  -Wno-cast-qual
   27 # Several other warnings which might be useful in some cases, but not severe
   28 # enough to error out the whole kernel build.  Display them anyway, so there is
   29 # some incentive to fix them eventually.
   30 CWARNEXTRA?=    -Wno-error-tautological-compare -Wno-error-empty-body \
   31                 -Wno-error-parentheses-equality -Wno-error-unused-function \
   32                 -Wno-error-pointer-sign
   33 .if ${COMPILER_VERSION} >= 30700
   34 CWARNEXTRA+=    -Wno-error-shift-negative-value
   35 .endif
   36 .if ${COMPILER_VERSION} >= 40000
   37 CWARNEXTRA+=    -Wno-error-address-of-packed-member
   38 .endif
   39 
   40 CLANG_NO_IAS= -no-integrated-as
   41 .if ${COMPILER_VERSION} < 30500
   42 # XXX: clang < 3.5 integrated-as doesn't grok .codeNN directives
   43 CLANG_NO_IAS34= -no-integrated-as
   44 .endif
   45 .endif
   46 
   47 .if ${COMPILER_TYPE} == "gcc"
   48 .if ${COMPILER_VERSION} >= 40800
   49 # Catch-all for all the things that are in our tree, but for which we're
   50 # not yet ready for this compiler.
   51 CWARNEXTRA?=    -Wno-error=address                              \
   52                 -Wno-error=aggressive-loop-optimizations        \
   53                 -Wno-error=array-bounds                         \
   54                 -Wno-error=attributes                           \
   55                 -Wno-error=cast-qual                            \
   56                 -Wno-error=enum-compare                         \
   57                 -Wno-error=inline                               \
   58                 -Wno-error=maybe-uninitialized                  \
   59                 -Wno-error=overflow                             \
   60                 -Wno-error=sequence-point                       \
   61                 -Wno-error=unused-but-set-variable
   62 .if ${COMPILER_VERSION} >= 60100
   63 CWARNEXTRA+=    -Wno-error=misleading-indentation               \
   64                 -Wno-error=nonnull-compare                      \
   65                 -Wno-error=shift-overflow                       \
   66                 -Wno-error=tautological-compare
   67 .endif
   68 .else
   69 # For gcc 4.2, eliminate the too-often-wrong warnings about uninitialized vars.
   70 CWARNEXTRA?=    -Wno-uninitialized
   71 .endif
   72 .endif
   73 
   74 # External compilers may not support our format extensions.  Allow them
   75 # to be disabled.  WARNING: format checking is disabled in this case.
   76 .if ${MK_FORMAT_EXTENSIONS} == "no"
   77 FORMAT_EXTENSIONS=      -Wno-format
   78 .elif ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 30600
   79 FORMAT_EXTENSIONS=      -D__printf__=__freebsd_kprintf__
   80 .else
   81 FORMAT_EXTENSIONS=      -fformat-extensions
   82 .endif
   83 
   84 #
   85 # On i386, do not align the stack to 16-byte boundaries.  Otherwise GCC 2.95
   86 # and above adds code to the entry and exit point of every function to align the
   87 # stack to 16-byte boundaries -- thus wasting approximately 12 bytes of stack
   88 # per function call.  While the 16-byte alignment may benefit micro benchmarks,
   89 # it is probably an overall loss as it makes the code bigger (less efficient
   90 # use of code cache tag lines) and uses more stack (less efficient use of data
   91 # cache tag lines).  Explicitly prohibit the use of FPU, SSE and other SIMD
   92 # operations inside the kernel itself.  These operations are exclusively
   93 # reserved for user applications.
   94 #
   95 # gcc:
   96 # Setting -mno-mmx implies -mno-3dnow
   97 # Setting -mno-sse implies -mno-sse2, -mno-sse3 and -mno-ssse3
   98 #
   99 # clang:
  100 # Setting -mno-mmx implies -mno-3dnow and -mno-3dnowa
  101 # Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42
  102 #
  103 .if ${MACHINE_CPUARCH} == "i386"
  104 CFLAGS.gcc+=    -mno-align-long-strings -mpreferred-stack-boundary=2
  105 CFLAGS.clang+=  -mno-aes -mno-avx
  106 CFLAGS+=        -mno-mmx -mno-sse -msoft-float
  107 INLINE_LIMIT?=  8000
  108 .endif
  109 
  110 .if ${MACHINE_CPUARCH} == "arm"
  111 INLINE_LIMIT?=  8000
  112 .endif
  113 
  114 .if ${MACHINE_CPUARCH} == "aarch64"
  115 # We generally don't want fpu instructions in the kernel.
  116 CFLAGS += -mgeneral-regs-only
  117 # Reserve x18 for pcpu data
  118 CFLAGS += -ffixed-x18
  119 .endif
  120 
  121 .if ${MACHINE_CPUARCH} == "riscv"
  122 CFLAGS.gcc+=    -mcmodel=medany
  123 INLINE_LIMIT?=  8000
  124 .endif
  125 
  126 #
  127 # For sparc64 we want the medany code model so modules may be located
  128 # anywhere in the 64-bit address space.  We also tell GCC to use floating
  129 # point emulation.  This avoids using floating point registers for integer
  130 # operations which it has a tendency to do.
  131 #
  132 .if ${MACHINE_CPUARCH} == "sparc64"
  133 CFLAGS.clang+=  -mcmodel=large -fno-dwarf2-cfi-asm
  134 CFLAGS.gcc+=    -mcmodel=medany -msoft-float
  135 INLINE_LIMIT?=  15000
  136 .endif
  137 
  138 #
  139 # For AMD64, we explicitly prohibit the use of FPU, SSE and other SIMD
  140 # operations inside the kernel itself.  These operations are exclusively
  141 # reserved for user applications.
  142 #
  143 # gcc:
  144 # Setting -mno-mmx implies -mno-3dnow
  145 # Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3 and -mfpmath=387
  146 #
  147 # clang:
  148 # Setting -mno-mmx implies -mno-3dnow and -mno-3dnowa
  149 # Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42
  150 # (-mfpmath= is not supported)
  151 #
  152 .if ${MACHINE_CPUARCH} == "amd64"
  153 CFLAGS.clang+=  -mno-aes -mno-avx
  154 CFLAGS+=        -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float \
  155                 -fno-asynchronous-unwind-tables
  156 INLINE_LIMIT?=  8000
  157 .endif
  158 
  159 #
  160 # For PowerPC we tell gcc to use floating point emulation.  This avoids using
  161 # floating point registers for integer operations which it has a tendency to do.
  162 # Also explicitly disable Altivec instructions inside the kernel.
  163 #
  164 .if ${MACHINE_CPUARCH} == "powerpc"
  165 CFLAGS+=        -mno-altivec -msoft-float
  166 INLINE_LIMIT?=  15000
  167 .endif
  168 
  169 #
  170 # Use dot symbols on powerpc64 to make ddb happy
  171 #
  172 .if ${MACHINE_ARCH} == "powerpc64"
  173 CFLAGS.gcc+=    -mcall-aixdesc
  174 .endif
  175 
  176 #
  177 # For MIPS we also tell gcc to use floating point emulation
  178 #
  179 .if ${MACHINE_CPUARCH} == "mips"
  180 CFLAGS+=        -msoft-float
  181 INLINE_LIMIT?=  8000
  182 .endif
  183 
  184 #
  185 # GCC 3.0 and above like to do certain optimizations based on the
  186 # assumption that the program is linked against libc.  Stop this.
  187 #
  188 CFLAGS+=        -ffreestanding
  189 
  190 #
  191 # The C standard leaves signed integer overflow behavior undefined.
  192 # gcc and clang opimizers take advantage of this.  The kernel makes
  193 # use of signed integer wraparound mechanics so we need the compiler
  194 # to treat it as a wraparound and not take shortcuts.
  195 # 
  196 CFLAGS+=        -fwrapv
  197 
  198 #
  199 # GCC SSP support
  200 #
  201 .if ${MK_SSP} != "no" && \
  202     ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips"
  203 CFLAGS+=        -fstack-protector
  204 .endif
  205 
  206 #
  207 # Add -gdwarf-2 when compiling -g. The default starting in clang v3.4
  208 # and gcc 4.8 is to generate DWARF version 4. However, our tools don't
  209 # cope well with DWARF 4, so force it to genereate DWARF2, which they
  210 # understand. Do this unconditionally as it is harmless when not needed,
  211 # but critical for these newer versions.
  212 #
  213 .if ${CFLAGS:M-g} != "" && ${CFLAGS:M-gdwarf*} == ""
  214 CFLAGS+=        -gdwarf-2
  215 .endif
  216 
  217 CFLAGS+= ${CWARNFLAGS:M*} ${CWARNFLAGS.${.IMPSRC:T}}
  218 CFLAGS+= ${CFLAGS.${COMPILER_TYPE}} ${CFLAGS.${.IMPSRC:T}}
  219 
  220 # Tell bmake not to mistake standard targets for things to be searched for
  221 # or expect to ever be up-to-date.
  222 PHONY_NOTMAIN = afterdepend afterinstall all beforedepend beforeinstall \
  223                 beforelinking build build-tools buildfiles buildincludes \
  224                 checkdpadd clean cleandepend cleandir cleanobj configure \
  225                 depend distclean distribute exe \
  226                 html includes install installfiles installincludes lint \
  227                 obj objlink objs objwarn \
  228                 realinstall regress \
  229                 tags whereobj
  230 
  231 .PHONY: ${PHONY_NOTMAIN}
  232 .NOTMAIN: ${PHONY_NOTMAIN}
  233 
  234 CSTD=           c99
  235 
  236 .if ${CSTD} == "k&r"
  237 CFLAGS+=        -traditional
  238 .elif ${CSTD} == "c89" || ${CSTD} == "c90"
  239 CFLAGS+=        -std=iso9899:1990
  240 .elif ${CSTD} == "c94" || ${CSTD} == "c95"
  241 CFLAGS+=        -std=iso9899:199409
  242 .elif ${CSTD} == "c99"
  243 CFLAGS+=        -std=iso9899:1999
  244 .else # CSTD
  245 CFLAGS+=        -std=${CSTD}
  246 .endif # CSTD
  247 
  248 # Set target-specific linker emulation name. Used by ld -b binary to convert
  249 # binary files into ELF objects.
  250 LD_EMULATION_aarch64=aarch64elf
  251 LD_EMULATION_amd64=elf_x86_64_fbsd
  252 LD_EMULATION_arm=armelf_fbsd
  253 LD_EMULATION_armeb=armelfb_fbsd
  254 LD_EMULATION_armv6=armelf_fbsd
  255 LD_EMULATION_i386=elf_i386_fbsd
  256 LD_EMULATION_mips= elf32btsmip_fbsd
  257 LD_EMULATION_mips64= elf64btsmip_fbsd
  258 LD_EMULATION_mipsel= elf32ltsmip_fbsd
  259 LD_EMULATION_mips64el= elf64ltsmip_fbsd
  260 LD_EMULATION_mipsn32= elf32btsmipn32_fbsd
  261 LD_EMULATION_mipsn32el= elf32btsmipn32_fbsd   # I don't think this is a thing that works
  262 LD_EMULATION_powerpc= elf32ppc_fbsd
  263 LD_EMULATION_powerpc64= elf64ppc_fbsd
  264 LD_EMULATION_riscv64= elf64lriscv
  265 LD_EMULATION_sparc64= elf64_sparc_fbsd
  266 LD_EMULATION=${LD_EMULATION_${MACHINE_ARCH}}

Cache object: 75215a04d934b89c8bfa476b20382c87


[ 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.