1999-08-28 00:22:10 +00:00
|
|
|
# $FreeBSD$
|
1996-10-08 22:10:49 +00:00
|
|
|
|
|
|
|
#
|
2011-05-24 09:01:56 +00:00
|
|
|
# Warning flags for compiling the kernel and components of the kernel:
|
1996-10-08 22:10:49 +00:00
|
|
|
#
|
2001-09-10 06:23:33 +00:00
|
|
|
CWARNFLAGS?= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
|
|
|
|
-Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \
|
2013-05-20 19:41:34 +00:00
|
|
|
-Wundef -Wno-pointer-sign ${FORMAT_EXTENSIONS} \
|
2011-12-23 13:50:33 +00:00
|
|
|
-Wmissing-include-dirs -fdiagnostics-show-option \
|
|
|
|
${CWARNEXTRA}
|
1999-01-29 10:57:18 +00:00
|
|
|
#
|
|
|
|
# The following flags are next up for working on:
|
2011-05-02 10:35:27 +00:00
|
|
|
# -Wextra
|
1999-01-27 22:53:58 +00:00
|
|
|
|
2011-12-21 15:59:18 +00:00
|
|
|
# Disable a few warnings for clang, since there are several places in the
|
|
|
|
# kernel where fixing them is more trouble than it is worth, or where there is
|
|
|
|
# a false positive.
|
2012-09-13 16:00:46 +00:00
|
|
|
.if ${COMPILER_TYPE} == "clang"
|
2011-12-21 15:59:18 +00:00
|
|
|
NO_WCONSTANT_CONVERSION= -Wno-constant-conversion
|
2011-12-21 16:38:37 +00:00
|
|
|
NO_WARRAY_BOUNDS= -Wno-array-bounds
|
2011-12-21 17:01:13 +00:00
|
|
|
NO_WSHIFT_COUNT_NEGATIVE= -Wno-shift-count-negative
|
|
|
|
NO_WSHIFT_COUNT_OVERFLOW= -Wno-shift-count-overflow
|
2011-12-30 01:54:45 +00:00
|
|
|
NO_WUNUSED_VALUE= -Wno-unused-value
|
2011-12-30 13:16:59 +00:00
|
|
|
NO_WSELF_ASSIGN= -Wno-self-assign
|
2012-02-21 21:20:52 +00:00
|
|
|
NO_WFORMAT_SECURITY= -Wno-format-security
|
2012-03-23 11:35:01 +00:00
|
|
|
NO_WUNNEEDED_INTERNAL_DECL= -Wno-unneeded-internal-declaration
|
2012-08-20 18:33:03 +00:00
|
|
|
NO_WSOMETIMES_UNINITIALIZED= -Wno-error-sometimes-uninitialized
|
2011-12-23 00:23:37 +00:00
|
|
|
# Several other warnings which might be useful in some cases, but not severe
|
|
|
|
# enough to error out the whole kernel build. Display them anyway, so there is
|
|
|
|
# some incentive to fix them eventually.
|
2011-12-24 18:57:42 +00:00
|
|
|
CWARNEXTRA?= -Wno-error-tautological-compare -Wno-error-empty-body \
|
2014-07-19 18:33:09 +00:00
|
|
|
-Wno-error-parentheses-equality -Wno-error-unused-function \
|
MFC 261991:
Upgrade our copy of llvm/clang to 3.4 release. This version supports
all of the features in the current working draft of the upcoming C++
standard, provisionally named C++1y.
The code generator's performance is greatly increased, and the loop
auto-vectorizer is now enabled at -Os and -O2 in addition to -O3. The
PowerPC backend has made several major improvements to code generation
quality and compile time, and the X86, SPARC, ARM32, Aarch64 and SystemZ
backends have all seen major feature work.
Release notes for llvm and clang can be found here:
<http://llvm.org/releases/3.4/docs/ReleaseNotes.html>
<http://llvm.org/releases/3.4/tools/clang/docs/ReleaseNotes.html>
MFC 262121 (by emaste):
Update lldb for clang/llvm 3.4 import
This commit largely restores the lldb source to the upstream r196259
snapshot with the addition of threaded inferior support and a few bug
fixes.
Specific upstream lldb revisions restored include:
SVN git
181387 779e6ac
181703 7bef4e2
182099 b31044e
182650 f2dcf35
182683 0d91b80
183862 15c1774
183929 99447a6
184177 0b2934b
184948 4dc3761
184954 007e7bc
186990 eebd175
Sponsored by: DARPA, AFRL
MFC 262186 (by emaste):
Fix mismerge in r262121
A break statement was lost in the merge. The error had no functional
impact, but restore it to reduce the diff against upstream.
MFC 262303:
Pull in r197521 from upstream clang trunk (by rdivacky):
Use the integrated assembler by default on FreeBSD/ppc and ppc64.
Requested by: jhibbits
MFC 262611:
Pull in r196874 from upstream llvm trunk:
Fix a crash that occurs when PWD is invalid.
MCJIT needs to be able to run in hostile environments, even when PWD
is invalid. There's no need to crash MCJIT in this case.
The obvious fix is to simply leave MCContext's CompilationDir empty
when PWD can't be determined. This way, MCJIT clients,
and other clients that link with LLVM don't need a valid working directory.
If we do want to guarantee valid CompilationDir, that should be done
only for clients of getCompilationDir(). This is as simple as checking
for an empty string.
The only current use of getCompilationDir is EmitGenDwarfInfo, which
won't conceivably run with an invalid working dir. However, in the
purely hypothetically and untestable case that this happens, the
AT_comp_dir will be omitted from the compilation_unit DIE.
This should help fix assertions occurring with ports-mgmt/tinderbox,
when it is using jails, and sometimes invalidates clang's current
working directory.
Reported by: decke
MFC 262809:
Pull in r203007 from upstream clang trunk:
Don't produce an alias between destructors with different calling conventions.
Fixes pr19007.
(Please note that is an LLVM PR identifier, not a FreeBSD one.)
This should fix Firefox and/or libxul crashes (due to problems with
regparm/stdcall calling conventions) on i386.
Reported by: multiple users on freebsd-current
PR: bin/187103
MFC 263048:
Repair recognition of "CC" as an alias for the C++ compiler, since it
was silently broken by upstream for a Windows-specific use-case.
Apparently some versions of CMake still rely on this archaic feature...
Reported by: rakuco
MFC 263049:
Garbage collect the old way of adding the libstdc++ include directories
in clang's InitHeaderSearch.cpp. This has been superseded by David
Chisnall's commit in r255321.
Moreover, if libc++ is used, the libstdc++ include directories should
not be in the search path at all. These directories are now only used
if you pass -stdlib=libstdc++.
2014-03-21 17:53:59 +00:00
|
|
|
${NO_WFORMAT}
|
2013-05-15 13:04:10 +00:00
|
|
|
.endif
|
|
|
|
|
2015-02-13 16:08:45 +00:00
|
|
|
.if ${COMPILER_TYPE} == "gcc"
|
|
|
|
# For gcc 4.2, eliminate the too-often-wrong warnings about uninitialized vars.
|
|
|
|
CWARNEXTRA?= -Wno-uninitialized
|
|
|
|
.endif
|
|
|
|
|
2013-05-15 13:04:10 +00:00
|
|
|
# External compilers may not support our format extensions. Allow them
|
|
|
|
# to be disabled. WARNING: format checking is disabled in this case.
|
|
|
|
.if ${MK_FORMAT_EXTENSIONS} == "no"
|
|
|
|
NO_WFORMAT= -Wno-format
|
|
|
|
.else
|
2013-05-20 19:41:34 +00:00
|
|
|
FORMAT_EXTENSIONS= -fformat-extensions
|
2011-12-21 15:59:18 +00:00
|
|
|
.endif
|
|
|
|
|
1999-11-17 07:30:35 +00:00
|
|
|
#
|
2011-05-02 10:35:27 +00:00
|
|
|
# On i386, do not align the stack to 16-byte boundaries. Otherwise GCC 2.95
|
|
|
|
# and above adds code to the entry and exit point of every function to align the
|
1999-11-17 07:30:35 +00:00
|
|
|
# stack to 16-byte boundaries -- thus wasting approximately 12 bytes of stack
|
2011-05-02 10:35:27 +00:00
|
|
|
# per function call. While the 16-byte alignment may benefit micro benchmarks,
|
2000-04-24 08:50:15 +00:00
|
|
|
# it is probably an overall loss as it makes the code bigger (less efficient
|
1999-11-17 07:30:35 +00:00
|
|
|
# use of code cache tag lines) and uses more stack (less efficient use of data
|
2011-05-02 10:35:27 +00:00
|
|
|
# cache tag lines). Explicitly prohibit the use of FPU, SSE and other SIMD
|
2005-03-31 22:53:58 +00:00
|
|
|
# operations inside the kernel itself. These operations are exclusively
|
|
|
|
# reserved for user applications.
|
1999-11-17 07:30:35 +00:00
|
|
|
#
|
2011-05-14 11:26:00 +00:00
|
|
|
# gcc:
|
|
|
|
# Setting -mno-mmx implies -mno-3dnow
|
|
|
|
# Setting -mno-sse implies -mno-sse2, -mno-sse3 and -mno-ssse3
|
|
|
|
#
|
|
|
|
# clang:
|
2012-03-13 19:18:34 +00:00
|
|
|
# Setting -mno-mmx implies -mno-3dnow and -mno-3dnowa
|
|
|
|
# Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42
|
2011-05-14 11:26:00 +00:00
|
|
|
#
|
2011-04-19 18:09:21 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "i386"
|
2012-09-13 16:00:46 +00:00
|
|
|
.if ${COMPILER_TYPE} != "clang"
|
2012-03-13 19:18:34 +00:00
|
|
|
CFLAGS+= -mno-align-long-strings -mpreferred-stack-boundary=2
|
2011-05-14 11:26:00 +00:00
|
|
|
.else
|
|
|
|
CFLAGS+= -mno-aes -mno-avx
|
2010-07-22 18:47:41 +00:00
|
|
|
.endif
|
2012-03-13 19:18:34 +00:00
|
|
|
CFLAGS+= -mno-mmx -mno-sse -msoft-float
|
2004-03-03 09:35:06 +00:00
|
|
|
INLINE_LIMIT?= 8000
|
1999-11-17 07:30:35 +00:00
|
|
|
.endif
|
|
|
|
|
2010-09-13 07:27:03 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "arm"
|
2004-05-14 13:35:46 +00:00
|
|
|
INLINE_LIMIT?= 8000
|
|
|
|
.endif
|
2011-05-02 10:35:27 +00:00
|
|
|
|
2000-10-16 20:04:52 +00:00
|
|
|
#
|
|
|
|
# For IA-64, we use r13 for the kernel globals pointer and we only use
|
|
|
|
# a very small subset of float registers for integer divides.
|
|
|
|
#
|
2010-09-13 07:27:03 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "ia64"
|
2007-05-19 04:45:54 +00:00
|
|
|
CFLAGS+= -ffixed-r13 -mfixed-range=f32-f127 -fpic #-mno-sdata
|
2003-11-04 23:29:17 +00:00
|
|
|
INLINE_LIMIT?= 15000
|
2000-10-16 20:04:52 +00:00
|
|
|
.endif
|
2001-09-10 06:23:33 +00:00
|
|
|
|
2003-02-28 06:49:59 +00:00
|
|
|
#
|
2011-12-24 12:28:23 +00:00
|
|
|
# For sparc64 we want the medany code model so modules may be located
|
|
|
|
# anywhere in the 64-bit address space. We also tell GCC to use floating
|
2003-02-28 06:49:59 +00:00
|
|
|
# point emulation. This avoids using floating point registers for integer
|
|
|
|
# operations which it has a tendency to do.
|
|
|
|
#
|
2010-09-13 07:27:03 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "sparc64"
|
2014-03-26 07:31:57 +00:00
|
|
|
.if ${COMPILER_TYPE} == "clang"
|
|
|
|
CFLAGS+= -mcmodel=large -fno-dwarf2-cfi-asm
|
|
|
|
.else
|
2006-11-26 23:16:46 +00:00
|
|
|
CFLAGS+= -mcmodel=medany -msoft-float
|
2014-03-26 07:31:57 +00:00
|
|
|
.endif
|
2003-11-04 23:29:17 +00:00
|
|
|
INLINE_LIMIT?= 15000
|
2003-02-28 06:49:59 +00:00
|
|
|
.endif
|
|
|
|
|
2003-04-30 22:22:29 +00:00
|
|
|
#
|
2005-03-31 22:53:58 +00:00
|
|
|
# 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.
|
2003-04-30 22:22:29 +00:00
|
|
|
#
|
2011-05-14 11:26:00 +00:00
|
|
|
# gcc:
|
|
|
|
# Setting -mno-mmx implies -mno-3dnow
|
|
|
|
# Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3 and -mfpmath=387
|
|
|
|
#
|
|
|
|
# clang:
|
2012-03-13 19:18:34 +00:00
|
|
|
# Setting -mno-mmx implies -mno-3dnow and -mno-3dnowa
|
|
|
|
# Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42
|
2011-05-14 11:26:00 +00:00
|
|
|
# (-mfpmath= is not supported)
|
|
|
|
#
|
2010-09-13 07:27:03 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "amd64"
|
2012-09-13 16:00:46 +00:00
|
|
|
.if ${COMPILER_TYPE} == "clang"
|
2011-05-14 11:26:00 +00:00
|
|
|
CFLAGS+= -mno-aes -mno-avx
|
|
|
|
.endif
|
2012-03-13 19:18:34 +00:00
|
|
|
CFLAGS+= -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float \
|
2011-05-14 11:26:00 +00:00
|
|
|
-fno-asynchronous-unwind-tables
|
2004-02-06 20:40:04 +00:00
|
|
|
INLINE_LIMIT?= 8000
|
2003-04-30 22:22:29 +00:00
|
|
|
.endif
|
|
|
|
|
2003-12-07 09:56:30 +00:00
|
|
|
#
|
|
|
|
# For PowerPC we tell gcc to use floating point emulation. This avoids using
|
|
|
|
# floating point registers for integer operations which it has a tendency to do.
|
2009-02-22 18:45:30 +00:00
|
|
|
# Also explicitly disable Altivec instructions inside the kernel.
|
2003-12-07 09:56:30 +00:00
|
|
|
#
|
2010-09-13 07:27:03 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "powerpc"
|
2009-02-22 18:45:30 +00:00
|
|
|
CFLAGS+= -msoft-float -mno-altivec
|
2003-12-07 09:56:30 +00:00
|
|
|
INLINE_LIMIT?= 15000
|
|
|
|
.endif
|
|
|
|
|
2011-02-18 21:44:53 +00:00
|
|
|
#
|
|
|
|
# Use dot symbols on powerpc64 to make ddb happy
|
|
|
|
#
|
|
|
|
.if ${MACHINE_ARCH} == "powerpc64"
|
|
|
|
CFLAGS+= -mcall-aixdesc
|
|
|
|
.endif
|
|
|
|
|
2008-04-29 11:28:10 +00:00
|
|
|
#
|
2010-01-09 17:21:36 +00:00
|
|
|
# For MIPS we also tell gcc to use floating point emulation
|
2008-04-29 11:28:10 +00:00
|
|
|
#
|
2010-09-13 07:27:03 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "mips"
|
2010-01-09 17:21:36 +00:00
|
|
|
CFLAGS+= -msoft-float
|
2009-03-03 18:53:47 +00:00
|
|
|
INLINE_LIMIT?= 8000
|
2008-04-29 11:28:10 +00:00
|
|
|
.endif
|
|
|
|
|
2001-09-10 06:23:33 +00:00
|
|
|
#
|
|
|
|
# GCC 3.0 and above like to do certain optimizations based on the
|
|
|
|
# assumption that the program is linked against libc. Stop this.
|
|
|
|
#
|
|
|
|
CFLAGS+= -ffreestanding
|
2008-06-25 21:33:28 +00:00
|
|
|
|
|
|
|
#
|
2011-05-02 10:35:27 +00:00
|
|
|
# GCC SSP support
|
2008-06-25 21:33:28 +00:00
|
|
|
#
|
2011-04-19 18:09:21 +00:00
|
|
|
.if ${MK_SSP} != "no" && ${MACHINE_CPUARCH} != "ia64" && \
|
|
|
|
${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips"
|
2008-06-25 21:33:28 +00:00
|
|
|
CFLAGS+= -fstack-protector
|
|
|
|
.endif
|
2014-07-17 22:31:46 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Add -gdwarf-2 when compiling -g
|
|
|
|
#
|
|
|
|
.if ${COMPILER_TYPE} == "clang" && ${CFLAGS:M-g} != "" && ${CFLAGS:M-gdwarf} == ""
|
|
|
|
CFLAGS+= -gdwarf-2
|
|
|
|
.endif
|