History log of /freebsd-10.1-release/sys/conf/kern.pre.mk
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 272461 02-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 260495 09-Jan-2014 dim

MFC r260102:

Similar to r260020, only use -fms-extensions with gcc, for all other
modules which require this flag to compile. Use a GCC_MS_EXTENSIONS
variable, defined in kern.pre.mk, which can be used to easily supply the
flag (or not), depending on the compiler type.

MFC r260322:

In addition to r260102, also define GCC_MS_EXTENSIONS in bsd.sys.mk,
since kernel module builds do not use kern.pre.mk.


# 260321 05-Jan-2014 dim

Revert MFC of r260102 for now, until I can merge the required fix from
head. This should fix building modules which require -fms-extensions to
compile them with gcc.


# 260268 04-Jan-2014 dim

MFC r260020:

For sys/dev/drm2/radeon, only use -fms-extensions with gcc. This flag
is only to stop gcc complaining about anonymous unions, which clang does
not do. For clang 3.4 however, -fms-extensions enables the Microsoft
__wchar_t type, which clashes with our own types.h.

MFC r260102:

Similar to r260020, only use -fms-extensions with gcc, for all other
modules which require this flag to compile. Use a GCC_MS_EXTENSIONS
variable, defined in kern.pre.mk, which can be used to easily supply the
flag (or not), depending on the compiler type.


# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 253996 06-Aug-2013 avg

opensolaris code: translate INVARIANTS to DEBUG and ZFS_DEBUG

Do this by forcing inclusion of
sys/cddl/compat/opensolaris/sys/debug_compat.h
via -include option into all source files from OpenSolaris.
Note that this -include option must always be after -include opt_global.h.

Additionally, remove forced definition of DEBUG for some modules and fix
their build without DEBUG.

Also, meaning of DEBUG was overloaded to enable WITNESS support for some
OpenSolaris (primarily ZFS) locks. Now this overloading is removed and
that use of DEBUG is replaced with a new option OPENSOLARIS_WITNESS.

MFC after: 17 days


# 250173 02-May-2013 adrian

Add the AR9300 HAL into the kernel and module builds.

Tested:

* make universe (honest!)


# 243664 29-Nov-2012 marcel

Fix LINT build for arm: NOTES defines LDFLAGS by way of a make option
but LDFLAGS is not (yet) passed on to the linker (via SYSTEM_LD et al).
Do so now. As such, any kernel configuration can now define linker
flags by setting LDFLAGS as normal and not have to revert to hacks
like setting DEBUG for flags that do not relate to debugging (see
sys/powerpc/conf/MPC85XX).


# 242933 12-Nov-2012 dim

Redo r242842, now actually fixing the warnings, as follows:
- In sys/ofed/drivers/infiniband/core/cma.c, an enum struct member is
interpreted as an int, so cast it to an int.
- In sys/ofed/drivers/infiniband/core/ud_header.c, initialize the
packet_length variable in ib_ud_header_init(), to prevent undefined
behaviour.
- In sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c, call rdma_notify()
with the correct enum type and value.
- In sys/ofed/include/linux/pci.h, change the PCI_DEVICE and PCI_VDEVICE
macros to use C99 struct initializers, so additional members can be
overridden.

Reviewed by: delphij, Garrett Cooper <yanegomi@gmail.com>
MFC after: 1 week


# 242842 09-Nov-2012 delphij

Attempt toward a buildable universe by silenting a few warnings for OFED.


# 242717 07-Nov-2012 dim

For kernel builds with PROFLEVEL >= 2, such as LINT, don't attempt to
use the -mprofiler-epilogue option if the compiler is clang, as the flag
is not supported. While here, fix up the value indentations.

MFC after: 1 week


# 242715 07-Nov-2012 dim

For kernel builds with PROFLEVEL >= 1, such as LINT, don't attempt to
use the -falign-functions option if the compiler is clang, as the flag
is not supported.

MFC after: 1 week


# 241607 16-Oct-2012 attilio

Disconnect non-MPSAFE XFS from the build in preparation for dropping
GIANT from VFS.

This is not targeted for MFC.


# 240494 14-Sep-2012 glebius

o Create directory sys/netpfil, where all packet filters should
reside, and move there ipfw(4) and pf(4).

o Move most modified parts of pf out of contrib.

Actual movements:

sys/contrib/pf/net/*.c -> sys/netpfil/pf/
sys/contrib/pf/net/*.h -> sys/net/
contrib/pf/pfctl/*.c -> sbin/pfctl
contrib/pf/pfctl/*.h -> sbin/pfctl
contrib/pf/pfctl/pfctl.8 -> sbin/pfctl
contrib/pf/pfctl/*.4 -> share/man/man4
contrib/pf/pfctl/*.5 -> share/man/man5

sys/netinet/ipfw -> sys/netpfil/ipfw

The arguable movement is pf/net/*.h -> sys/net. There are
future plans to refactor pf includes, so I decided not to
break things twice.

Not modified bits of pf left in contrib: authpf, ftp-proxy,
tftp-proxy, pflogd.

The ipfw(4) movement is planned to be merged to stable/9,
to make head and stable match.

Discussed with: bz, luigi


# 240468 13-Sep-2012 brooks

Introduce a new make variable COMPILER_TYPE that specifies what
type of compiler is being used (currently clang or gcc). COMPILER_TYPE
is set in the new bsd.compiler.mk file based on the value of the CC
variable or, should it prove informative, by running ${CC} --version
and examining the output.

To avoid negative performance impacts in the default case and correct
value for COMPILER_TYPE type is determined and passed in the environment
of submake instances while building world.

Replace adhoc attempts at determining the compiler type by examining
CC or MK_CLANG_IS_CC with checks of COMPILER_TYPE. This eliminates
bootstrapping complications when first setting WITH_CLANG_IS_CC.

Sponsored by: DARPA, AFRL
Reviewed by: Yamaya Takashi <yamayan@kbh.biglobe.ne.jp>, imp, linimon
(with some modifications post review)
MFC after: 2 weeks


# 240451 13-Sep-2012 np

Allow cxgbe to be built into a kernel with "device cxgbe."

MFC after: 1 week


# 240402 12-Sep-2012 obrien

Remove duplication and centralize testing of various config(8)ed features.


# 239957 31-Aug-2012 jhb

Similar to how r171350 fixed linking of kernel modules containing
firmware objects by adding --no-warn-mismatch to the linker flags,
add --no-warn-mismatch when linking firmware objects (*.fwo) as
well as to the link of the main kernel file. This permits firmware
modules to be statically linked into an ia64 kernel.


# 239956 31-Aug-2012 jhb

The implied source variable (.IMPSRC) didn't actually work in my previous
commit. Change this to use .ALLSRC instead, but be careful to only use
the .fw file for NORMAL_FWO to ignore opt_global.h.


# 239955 31-Aug-2012 jhb

Add common rules for building firmware object files (NORMAL_FW to run
uudecode, and NORMAL_FWO to use ld to build the .fwo file) and use those
instead of explicit ld/uudecode invocations in sys/conf/files. Apart from
increasing readability, this makes it possible to adjust the flags used for
firmware objects in one place.

MFC after: 2 weeks


# 239272 15-Aug-2012 gonzo

Merging of projects/armv6, part 3

r238211:
Support TARGET_ARCH=armv6 and TARGET_ARCH=armv6eb

This adds a new TARGET_ARCH for building on ARM
processors that support the ARMv6K multiprocessor
extensions. In particular, these processors have
better support for TLS and mutex operations.

This mostly touches a lot of Makefiles to extend
existing patterns for inferring CPUARCH from ARCH.
It also configures:
* GCC to default to arm1176jz-s
* GCC to predefine __FreeBSD_ARCH_armv6__
* gas to default to ARM_ARCH_V6K
* uname -p to return 'armv6'
* make so that MACHINE_ARCH defaults to 'armv6'
It also changes a number of headers to use
the compiler __ARM_ARCH_XXX__ macros to configure
processor-specific support routines.

Submitted by: Tim Kientzle <kientzle@freebsd.org>


# 233644 29-Mar-2012 jmallett

Assume a big-endian default on MIPS and drop the "eb" suffix from MACHINE_ARCH.
This makes our naming scheme more closely match other systems and the
expectations of much third-party software. MIPS builds which are little-endian
should require and exhibit no changes. Big-endian TARGET_ARCHes must be
changed:
From: To:
mipseb mips
mipsn32eb mipsn32
mips64eb mips64

An entry has been added to UPDATING and some foot-shooting protection (complete
with warnings which should become errors in the near future) to the top-level
base system Makefile.


# 233578 27-Mar-2012 peter

Allow (with a license warning) "options ZFS" to work in static kernels.

The 'make depend' rules have to use custom -I paths for the special compat
includes for the opensolaris/zfs headers.

This option will pull in the couple of files that are shared with dtrace,
but they appear to correctly use the MODULE_VERSION/MODULE_DEPEND rules
so loader should do the right thing, as should kldload.

Reviewed by: pjd (glanced at)


# 232477 03-Mar-2012 dim

In r232322, I forgot one case where a check for MK_CLANG_IS_CC was
needed, in sys/conf/kern.pre.mk. Add it now.

MFC after: 2 weeks


# 232476 03-Mar-2012 dim

Revert r232473. I have been convinced by Doug Barton and Bjoern Zeeb
that it is better to error out when people attempt to build using the
wrong bsd.*.mk files, than to silently ignore the problem.

This means, that after this commit, if you want to build kernel modules
by hand (or via a port) from a head source tree, you *must* make sure
the files in /usr/share/mk are in sync with that tree. If that isn't
possible, for example when you are running on an older FreeBSD branch,
you can:

- Run "make buildenv" from your head source tree, to have the correct
environment setup. (It's advisable to have run "make buildworld", or
at a minimum "make toolchain" first.)
- Alternatively, set MAKESYSPATH to the share/mk directory under your
head source tree. If your build tools are too old, other problems may
still occur.
- Alternatively, use "make -m" and specify the share/mk directory under
your head source tree. Again, build tools that are too old may still
result in trouble.

MFC after: 2 weeks


# 232473 03-Mar-2012 dim

After r232322, it turned out many people (and some ports) are building
kernel modules using their old installed /usr/share/mk/bsd.*.mk files,
instead of the updated ones in their source tree. This leads to errors
like:

"sys/conf/kmod.mk", line 111: Malformed conditional (${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang")

Obviously, these errors will go away after a "make installworld", or
alternatively, by using "make buildenv" before attempting to manually
build modules.

However, since it is apparently an expected use case to build using old
.mk files, change the way we test for clang, so it also works when the
MK_CLANG_IS_CC macro doesn't exist.

Note the conditional expressions are becoming rather unreadable now, but
I will attempt to fix that on a followup commit.

MFC after: 2 weeks


# 232322 29-Feb-2012 dim

Add a WITH_CLANG_IS_CC option for src.conf(5), disabled by default, that
installs clang as /usr/bin/cc, /usr/bin/c++ and /usr/bin/cpp.

Note this does *not* disable building and installing gcc, which will
still be available as /usr/bin/gcc, /usr/bin/g++ and /usr/bin/gcpp. If
you want to disable gcc completely, you must use WITHOUT_GCC.

MFC after: 2 weeks


# 232263 28-Feb-2012 dim

Define several extra macros in bsd.sys.mk and sys/conf/kern.pre.mk, to
get rid of testing explicitly for clang (using ${CC:T:Mclang}) in
individual Makefiles.

Instead, use the following extra macros, for use with clang:
- NO_WERROR.clang (disables -Werror)
- NO_WCAST_ALIGN.clang (disables -Wcast-align)
- NO_WFORMAT.clang (disables -Wformat and friends)
- CLANG_NO_IAS (disables integrated assembler)
- CLANG_OPT_SMALL (adds flags for extra small size optimizations)

As a side effect, this enables setting CC/CXX/CPP in src.conf instead of
make.conf! For clang, use the following:

CC=clang
CXX=clang++
CPP=clang-cpp

MFC after: 2 weeks


# 230422 21-Jan-2012 andreast

Revert r230390.


# 230390 20-Jan-2012 andreast

Disable GUPROF on archs other than i386/amd64 since the fine details are not
implemented.


# 229353 02-Jan-2012 gjb

Trivial standardization to a few comments in kern.pre.mk.

Submitted by: arundel
MFC after: 3 days


# 228868 24-Dec-2011 dim

When building the kernel for amd64 with clang, don't attempt to use the
-frename-registers option, as it is not supported. No change for builds
with gcc.

MFC after: 1 week


# 228158 30-Nov-2011 fjoe

- CTF knob is now implemented using common scheme: MK_CTF=yes/no is
defined based on WITH/WITHOUT_CTF settings, default is WITHOUT_CTF,
NO_CTF overrides WITH_CTF (used by Makefile.inc1)
- CTFCONVERT_CMD/NORMAL_CTFCONVERT are now defined to empty string
if make(1) can handle empty commands


# 228140 29-Nov-2011 fjoe

Do not echo ${CTFCONVERT} command: config(8) will be fixed to not
emit '@' for ${NORMAL_CTFCONVERT} invocation.


# 228137 29-Nov-2011 fjoe

- fix WITH_CTF when specified in /etc/src.conf [1]
- CTFCONVERT_CMD=... is a hack (should be defined to empty string instead):
make(1) should be taught to ignore empty commands silently in compat mode
(as it does in !compat mode, GNU make also silently ignores empty commands)
and to skip printing empty commands in !compat mode
- config(8) should generate ${NORMAL_CTFCONVERT} invocation without '@':
this will allow to simplify kern.pre.mk even more and lessen the number
of shell invocations during kernel build when CTF is turned off
- WITH_CTF can now be converted to usual MK_CTF=yes/no infrastructure

Pointy hat to: fjoe [1]


# 228124 29-Nov-2011 fjoe

Conditionalize ctfconvert/ctfmerge runs on make level (.if/.endif) instead
of executing a shell on every object or executable/library file.

This shaves off more than 30,000 shell invocations during buildworld.


# 224882 15-Aug-2011 nwhitehorn

Use a maximum of -O on PowerPC kernels instead of -O2 to prevent a rare
bug that could cause intermittent memory corruption on PowerPC SMP
systems using non-debug kernels. This is a temporary change until the
real problem is fixed.

Approved by: re (kib)


# 221265 30-Apr-2011 bz

Allow MKMODULESENV being preset from other sources like makeoptions
kernel configurations to apply WITH_* WITHOUT_* knobs we use for
module building as well to restrict or control opt_*.h flags.

Reviewed by: imp, +
Sponsored by: The FreeBSD Foundation
Sponsored by: iXsystems
MFC after: 2 weeks


# 220863 19-Apr-2011 dim

Remove support for the Intel C Compiler from the build infrastructure.
This support has not worked for several years, and is not likely to work
again, unless Intel decides to release a native FreeBSD version of their
compiler. ;)


# 219819 21-Mar-2011 jeff

- Merge changes to the base system to support OFED. These include
a wider arg2 for sysctl, updates to vlan code, IFT_INFINIBAND,
and other miscellaneous small features.


# 218894 20-Feb-2011 dim

Clang now supports profiling, so remove the part that says it doesn't
from sys/conf/kern.pre.mk.


# 218792 18-Feb-2011 np

cxgbe(4) - NIC driver for Chelsio T4 (Terminator 4) based 10Gb/1Gb adapters.

MFC after: 3 weeks


# 218538 11-Feb-2011 imp

whitespace nit.


# 218189 02-Feb-2011 pluknet

Remove OpenSolaris include path referring to a non-existing directory
never committed from p4 dtrace branch.
[The correct include path is referenced from every opensolaris compat
consumer's module Makefile, so it doesn't serve any purpose anyway.]

Reported by: arundel on freebsd-hackers@ via clang
Approved by: kib (mentor)
MFC after: 1 week


# 216746 27-Dec-2010 cperciva

Make it possible to specify WITHOUT_MODULES in a kernel config file.

MFC after: 1 week


# 215988 28-Nov-2010 jmallett

Bump up MIPS limits once again; the new Cavium Octeon SDK requires even higher
limits. I'd rather disable the warning and keep the limits at a sane level,
but for now they'll be ridiculously-high.


# 212521 13-Sep-2010 imp

Use :T:Micc here like everywhere else we test icc


# 211725 23-Aug-2010 imp

MFtbemd:

Prefer MACHNE_CPUARCH to MACHINE_ARCH in most contexts where you want
to test of all the CPUs of a given family conform.


# 211437 17-Aug-2010 rpaulo

For every instance of '.if ${CC} == "foo"' or '.if ${CC} != "foo"' in
Makefiles or *.mk files, use ${CC:T:Mfoo} instead, so only the basename
of the compiler command (excluding any arguments) is considered.

This allows you to use, for example, CC="/nondefault/path/clang -xxx",
and still have the various tests in bsd.*.mk identify your compiler as
clang correctly.

ICC if cases were also changed.

Submitted by: Dimitry Andric <dimitry at andric.com>


# 210394 22-Jul-2010 rpaulo

Fix previous commit: don't remove the WERROR definition when using
clang.

Submitted by: Dimitry Andric <dimitry at andric.com>
Reviewed by: jkim


# 210384 22-Jul-2010 rpaulo

Handle a few corner cases for clang like we did with icc. These should
reduce the number of warnings seen while building the kernel.

Submitted by: Dimitry Andric <dimitry at andric.com>


# 210311 20-Jul-2010 jmallett

Update the port of FreeBSD to Cavium Octeon to use the Cavium Simple Executive
library:
o) Increase inline unit / large function growth limits for MIPS to accommodate
the needs of the Simple Executive, which uses a shocking amount of inlining.
o) Remove TARGET_OCTEON and use CPU_CNMIPS to do things required by cnMIPS and
the Octeon SoC.
o) Add OCTEON_VENDOR_LANNER to use Lanner's allocation of vendor-specific
board numbers, specifically to support the MR320.
o) Add OCTEON_BOARD_CAPK_0100ND to hard-wire configuration for the CAPK-0100nd,
which improperly uses an evaluation board's board number and breaks board
detection at runtime. This board is sold by Portwell as the CAM-0100.
o) Add support for the RTC available on some Octeon boards.
o) Add support for the Octeon PCI bus. Note that rman_[sg]et_virtual for IO
ports can not work unless building for n64.
o) Clean up the CompactFlash driver to use Simple Executive macros and
structures where possible (it would be advisable to use the Simple Executive
API to set the PIO mode, too, but that is not done presently.) Also use
structures from FreeBSD's ATA layer rather than structures copied from
Linux.
o) Print available Octeon SoC features on boot.
o) Add support for the Octeon timecounter.
o) Use the Simple Executive's routines rather than local copies for doing reads
and writes to 64-bit addresses and use its macros for various device
addresses rather than using local copies.
o) Rename octeon_board_real to octeon_is_simulation to reduce differences with
Cavium-provided code originally written for Linux. Also make it use the
same simplified test that the Simple Executive and Linux both use rather
than our complex one.
o) Add support for the Octeon CIU, which is the main interrupt unit, as a bus
to use normal interrupt allocation and setup routines.
o) Use the Simple Executive's bootmem facility to allocate physical memory for
the kernel, rather than assuming we know which addresses we can steal.
NB: This may reduce the amount of RAM the kernel reports you as having if
you are leaving large temporary allocations made by U-Boot allocated
when starting FreeBSD.
o) Add a port of the Cavium-provided Ethernet driver for Linux. This changes
Ethernet interface naming from rgmxN to octeN. The new driver has vast
improvements over the old one, both in performance and functionality, but
does still have some features which have not been ported entirely and there
may be unimplemented code that can be hit in everyday use. I will make
every effort to correct those as they are reported.
o) Support loading the kernel on non-contiguous cores.
o) Add very conservative support for harvesting randomness from the Octeon
random number device.
o) Turn SMP on by default.
o) Clean up the style of the Octeon kernel configurations a little and make
them compile with -march=octeon.
o) Add support for the Lanner MR320 and the CAPK-0100nd to the Simple
Executive.
o) Modify the Simple Executive to build on FreeBSD and to build without
executive-config.h or cvmx-config.h. In the future we may want to
revert part of these changes and supply executive-config.h and
cvmx-config.h and access to the options contained in those files via
kernel configuration files.
o) Modify the Simple Executive USB routines to support getting and setting
of the USB PID.


# 210151 15-Jul-2010 imp

Simple compatibility hacks for building on older systems where
MACHINE_CPUARCH isn't defined. I believe that this will cover all
options.

I didn't define it in kern.mk because $M is set to MACHINE_CPUARCH and
then is expanded for the genassym.o rule in kern.post.mk and kern.mk
is included after this, so the expansion isn't quite right. I think
this is a bug in make, but don't have the time to track it to ground
(and even if I did, fixing it would require a MFC of the change to the
very old systems we're targetting with this fix).


# 209993 13-Jul-2010 nwhitehorn

Convert several instances of MACHINE_ARCH to MACHINE_CPUARCH and use the
correct compiler flags on 64-bit PowerPC.


# 207056 22-Apr-2010 netchild

Revert r206179 (by imp) and do something similar which is more consistent
with all other corresponding CTF places by changing the corresponding
code which is generated by config(8). Or in short, move the '@' from
the variable definition to the use of the variable. [1]

While I'm here break up a long line. [2]

Discussed with: imp [1,2], bde [2]


# 206179 05-Apr-2010 imp

Add missing @ to the NORMAL_CTFCONVERT line to keep it from appearing
in the output.


# 206082 02-Apr-2010 netchild

WITH_CTF can now be specified in src.conf (not recommended, there
are some problems with static executables), make.conf (would also
affect ports which do not use GNU make and do not override the
compile targets) or in the kernel config (via "makeoptions
WITH_CTF=yes").

Additional (related) changes:
- propagate WITH_CTF to module builds
- do not add -g to the linker flags, it's a noop there anyway
(at least according to the man page of ld)
- do not add -g to CFLAGS unconditionally
we need to have a look if it is really needed (IMO not) or if there
is a way to add it only when WITH_CTF is used

Note: ctfconvert / ctfmerge lines will not appear in the build output,
to protect the innocent (those which do not build with WITH_CTF would
see the shell-test and may think WITH_CTF is used).

Reviewed by: imp, jhb, scottl (earlier version)
Discussed on: arch@


# 192901 27-May-2009 thompsa

Delete the old USB stack. The new stack has settled in and has all the
drivers/functionality and then some.


# 189089 26-Feb-2009 thompsa

Allow the old usb stack to compile by adding the appropriate -I foo, this must
go before the standard -I$S to have the search happen before /sys/.

Make this conditional on 'makeoptions WITH_LEGACY=1' in the kernel config.

Prodded by: sam


# 187290 15-Jan-2009 rodrigc

Revert previous change, since revision 187103 fixed the problem.
So now, if you:
- specify "makeoptions DEBUG=-g" in your kernel config
- make buildkernel WITH_CTF=1,

then "-g" will be added to CTFFLAGS.

However, "-g" will still not be added to CTFFLAGS when building
kernel modules, if the above steps are performed. This needs to be fixed.

Noticed by: thompsa


# 187260 15-Jan-2009 rodrigc

When building up the command-line for the DTrace ctfmerge and ctfconvert
utilities, add the ${DEBUG} variable from the kernel config. Otherwise,
if we build a kernel with WITH_CTF=1 set, ctfmerge will not have
the -g flag set. In this case, the cc has -g specified, so the
.o files will have debug information generated, but since ctfmerge
does not have -g set, it will strip out the ELF sections containing
the DWARF debugging info, leading to a kernel without debugging symbols.

Reviewed by: jb


# 187103 12-Jan-2009 gnn

Fix CTF based builds to that if the debug build is being used we get
debug symbols.

Reviewed by: jhb


# 185522 01-Dec-2008 sam

Switch to ath hal source code. Note this removes the ath_hal
module; the ath module now brings in the hal support. Kernel
config files are almost backwards compatible; supplying

device ath_hal

gives you the same chip support that the binary hal did but you
must also include

options AH_SUPPORT_AR5416

to enable the extended format descriptors used by 11n parts.
It is now possible to control the chip support included in a
build by specifying exactly which chips are to be supported
in the config file; consult ath_hal(4) for information.


# 183292 23-Sep-2008 kmacy

Update cxgb include paths to not require prefixing with dev/cxgb

Submitted by: Chelsio Inc.


# 180012 25-Jun-2008 ru

Enable GCC stack protection (aka Propolice) for userland:
- It is opt-out for now so as to give it maximum testing, but it may be
turned opt-in for stable branches depending on the consensus. You
can turn it off with WITHOUT_SSP.
- WITHOUT_SSP was previously used to disable the build of GNU libssp.
It is harmless to steal the knob as SSP symbols have been provided
by libc for a long time, GNU libssp should not have been much used.
- SSP is disabled in a few corners such as system bootstrap programs
(sys/boot), process bootstrap code (rtld, csu) and SSP symbols themselves.
- It should be safe to use -fstack-protector-all to build world, however
libc will be automatically downgraded to -fstack-protector because it
breaks rtld otherwise.
- This option is unavailable on ia64.

Enable GCC stack protection (aka Propolice) for kernel:
- It is opt-out for now so as to give it maximum testing.
- Do not compile your kernel with -fstack-protector-all, it won't work.

Submitted by: Jeremie Le Hen <jeremie@le-hen.org>


# 179665 09-Jun-2008 jb

Remove some sparc-specific stuff from my earlier sun4v work in p4.
It never belonged in current.

Pointed out by: marius


# 179226 23-May-2008 jb

Add support for generating CTF data for the kernel.


# 175901 02-Feb-2008 imp

pc98 lint builds w/o warnings. Remove the last special case from our
compiler upgrade.

# if tinderbox breaks, I'll fix it, but it shouldn't...


# 175896 02-Feb-2008 cognet

Arm should build fine with -Werror as well.


# 175895 02-Feb-2008 imp

sun4v has a MACHINE_ARCH of sparc64, so it was covered under that clause and
shouldn't have been added. Remove it.


# 175888 02-Feb-2008 imp

Some platforms that are currently under development have to cope with
a variety of bootloaders. This sometimes means that different loader
scripts are required within one ${MACHINE_ARCH}, which makes the
current practice of using ldscript.${MACHINE_ARCH} unsuitable.
Instead, make the default the current convention and allow the ld
scripts to be overridden as necessary.


# 175886 02-Feb-2008 imp

Wall of shame rather than wall of fame for the -Werror suppression.
If we aren't arm, pc98 or sun4v, then enable treating warnings like
errors. That doesn't mean these platforms aren't -Werror clean, just
that we haven't enforced it before. Someone with some spare time
should investigate these three platforms to see if any can be removed.


# 171790 08-Aug-2007 marcel

Re-enable -Werror for PowerPC. This should really be unconditional again.

Approved by: re (blanket)


# 171668 31-Jul-2007 marcel

Enable -Werror for ia64.

Approved by: re (blanket)


# 171387 11-Jul-2007 jfv

Removed unnecessary global includes for ixgbe, and em. Both have been
determined to be unnecessary.

Approved by: re


# 171383 11-Jul-2007 jfv

New driver for Intel 10G PCI-Express adapter (82598), driver is
still in Beta, but we want early users to have access to it in
7.0, Feedback welcome. Enjoy. -Jack

Approved by: re


# 171267 05-Jul-2007 peter

I did not intend to turn -Werror on for pc98. Refine the test for
turning it on for i386.

Approved by: re (rwatson, followup)


# 171266 05-Jul-2007 peter

Turn on -Werror for sparc64 and sun4v.

Approved by: re (rwatson)


# 171248 05-Jul-2007 peter

Turn on -Werror for i386 kernel builds.

Approved by: re (rwatson)


# 171240 05-Jul-2007 peter

Turn -Werror back on for amd64 for kernel builds.

Approved by: re (rwatson)


# 171239 05-Jul-2007 peter

Compile pf/pf_subr.c and netnatm/cc_conn.c without -Werror for the time
being.

Approved by: re (rwatson)


# 169726 19-May-2007 kan

Disable -Werror for now.
Remove -I- construct obsolete in GCC 4.2.


# 169240 03-May-2007 jfv

Merge in the new driver (6.5.0) of Intel. This has a new
shared code infrastructure that is family specific and
modular. There is also support for our latest gigabit
nic, the 82575 that is MSI/X and multiqueue capable.

The new shared code changes some interfaces to the core
code but testing at Intel has been going on for months,
it is fairly stable.

I have attempted to be careful in retaining any fixes that
CURRENT had and we did not, I apologize in advance if any
thing gets clobbered, I'm sure I'll hear about it :)

Approved by pdeuskar


# 163704 26-Oct-2006 bde

Fixed high resolution profiling on arches that support it (amd64 and
i386). Use -mprofiler-epilogue again, and don't use -finstrument-functions.
The former has been fixed for arches that implement high-res profiling,
and the latter has been useless for kernel profiling since gcc-3.4
when it started forcing -fno-inline. -fno-inline gives a kernel with
performance characteristics too different from a normal kernel to be
worth profiling, by turning off inlining of all the little optimized
functions in headers. This interacts especially badly with FreeBSD's
use of "static inline" for all inlines in headers, by creating many
separate copies of the little functions, so not inlining tends to
increase cache pressure where it should reduce it, and (since gprof(1)
doesn't understand the copies) the statistics for the little functions
are hard to interpret even if you want them.


# 163700 26-Oct-2006 bde

Reduced the ifdef tangle for profiling by moving the unreachable
never-working parts for icc to the attic.

Fixed some nearby style bugs.


# 163333 13-Oct-2006 ru

Define an empty C_DIALECT in case of "icc", just in case.


# 162413 18-Sep-2006 sam

o move ath hal os glue code from the hal to the driver: this code was
part of the hal distribution early on when the hal was built for
each os but it's been portable for a long time so move the os-specific
code out (and off the vendor branch)
o correct the copyright on ah_osdep.?; it was mistakenly given a
restricted license and not a dual-bsd/gpl license
o remove the module api definition as it was never used
o fixup include paths for move of ah_osdep.h

MFC after: 2 weeks


# 162411 18-Sep-2006 sam

nuke unused support for building ath hal from src code

MFC after: 1 week


# 160440 17-Jul-2006 obrien

/etc/src.conf wasn't visable for the kernel build.


# 160043 29-Jun-2006 obrien

Create new dialect knob, as setting the language dialect isn't a warning flag.


# 153325 11-Dec-2005 rodrigc

Hook XFS into kernel build.


# 151605 24-Oct-2005 obrien

We no longer need INCLUDES+= -I$S/contrib/dev/acpica.


# 150966 05-Oct-2005 glebius

Define HAVE_KERNEL_OPTION_HEADERS when building kernel and when building
modules along with kernel.

After this change it is possible to embrace opt_*.h includes with ifdef
HAVE_KERNEL_OPTION_HEADERS. And thus, avoid editing a lot of Makefiles
in modules directory each time we introduce a new opt_xxx.h.

Requested by: bde


# 149978 11-Sep-2005 obrien

The kernel-depend target doesn't get any information from "compile-with",
so repeat the includes paths for that target.


# 149973 11-Sep-2005 obrien

Don't pollute the entire kernel build with -I$S/contrib/dev/ath and
-I$S/contrib/dev/ath/freebsd. "ATH_BUILDING_FROM_SOURCE" can be defined to
globally get back -I$S/contrib/dev/ath.


# 149971 11-Sep-2005 obrien

Don't pollute the entire kernel build with -I$S/contrib/ipfilter.


# 149970 11-Sep-2005 obrien

Don't pollute the entire kernel build with -I$S/contrib/pf.


# 149969 10-Sep-2005 obrien

Don't pollute the entire kernel build with -I$S/contrib/ngatm.


# 149968 10-Sep-2005 obrien

Don't pollute the entire kernel build with -I$S/dev/twa.


# 145016 13-Apr-2005 imp

Never hardcode /sys into these Makefiles. The proper way to spell it is $S.

Also, move the -I stuff to the centralized kern.pre.mk. However, it
might be better to add these flags to files.conf. This is a short
term fix to fix the broken builds on my machine (I don't have a valid
/sys link).


# 144293 29-Mar-2005 phk

Don't generate major.c anymore.


# 141782 13-Feb-2005 obrien

Barrow from kmod.mk and protect against adding -fno-strict-aliasing
when it is already in COPTFLAGS.


# 140606 21-Jan-2005 obrien

Embellish rev 1.61. If we're not building a debug kernel, use -O2 as before.

Submitted by: ru


# 140400 18-Jan-2005 obrien

While we're building kernels -g (ie, makeoptions DEBUG=-g), use -O as it
provides truer debugger stack traces. For those that want to stick with
-O2 kernel builds, one should probably add -fno-optimize-sibling-calls
so that each stack frame as a frame pointer.
It is semi-promissed by the Release Engineers that when RELENG_6 is
created we go back to -O2.

Desired by: scottl, jhb


# 136951 25-Oct-2004 obrien

Don the teflon coated jacket and use the same -O2 optimization options on
the 'i386' kernel that we do all our 64-bit kernels.


# 136237 07-Oct-2004 kensmith

Back out v1.58... We still don't know what is causing the specific
problem I had but it's happening in code that is messing around with
register windows - I'm willing to live with that piece being sensitive
to this and it looks like the other problems we had reported lately
are not fixed by using -O instead of -O2.

Sorry for the churn. Looks like I need a second pointy hat. Someone
tells me they stack well. :-))))


# 136199 06-Oct-2004 kensmith

Back out v1.49. Recent findings suggest sparc64 may not be ready for
-O2 on kernel compiles after all. While working on adding a KASSERT
to sparc64/sparc64/rwindow.c I found that it was "position sensitive",
putting it above a call to flushw() instead of below caused corruption
of processes on the system. jake and jhb have both confirmed there is
no obvious explanation for that. The exact same kernel code does not
have the process corruption problem if compiled with -O instead of -O2.
There have been signs of similar issues floated on the sparc64@ mailing
list, lets see if this helps make them go away.

Note this isn't an optimal fix as far as the file format goes, if this
disgusts too many people I'll fix it the right way. Since compiling
with something other than -O is a known problem this format would prevent
a change to the default causing grief. And this may also help motivate
finding out what the compiler is doing wrong so we can shift back to
using -O2. :-)

My turn for the pointy hat... One of the florescent ones...

MFC after: 2 days


# 135673 23-Sep-2004 cognet

Use -O2 for the arm kernel as well


# 133653 13-Aug-2004 ru

Removed COPTS support from kmod.mk and kern.pre.mk.
COPTS support in bsd.prog.mk is preserved but discouraged.


# 132766 28-Jul-2004 kan

Allow for aggressive function inlining. This might have to be fine-tuned
later.


# 131210 27-Jun-2004 imp

We don't need GEN_M_CFILES. Fold it into GEN_CFILES definition and
adjust as necessary.

Suggested by: bde


# 130416 13-Jun-2004 mlaier

Link ALTQ to the build and break with ABI for struct ifnet. Please recompile
your (network) modules as well as any userland that might make sense of
sizeof(struct ifnet).
This does not change the queueing yet. These changes will follow in a
seperate commit. Same with the driver changes, which need case by case
evaluation.

__FreeBSD_version bump will follow.

Tested-by: (i386)LINT


# 128688 27-Apr-2004 emax

Address few style issues pointed out by bde

Reviewed by: bde, ru


# 128589 23-Apr-2004 emax

Make sure Bluetooth stuff can be statically compiled into kernel

Submitted by: ps
Reviewed by: imp (mentor), ru


# 127543 28-Mar-2004 kensmith

Remove "-frename-registers" option for sparc64 kernel builds. That
was not present in what I originally tested when checking to see if
the kernel built/ran with the -O2 change. Recent instability in
sparc64 kernel was tracked to this. A reproducible kernel stack
traceback followed by hard hang during the call to msleep() at the
point the kernel waits 15 seconds for the SCSI bus to settle crept in
to recent kernel builds and it seems to go away with this patch.

Noticed by: kris
Approved by: rwatson (mentor)


# 127387 24-Mar-2004 obrien

Lets give -O2 kernels a try on sparc64.

Reviewed by: kensmith


# 127259 21-Mar-2004 marcel

Compile the kernel with -O2 on ia64 by default.


# 127206 19-Mar-2004 obrien

Delete local junk in previous commit. Sorry.


# 127204 19-Mar-2004 obrien

Depend on rev 1.40.

Submitted by: ru


# 127180 18-Mar-2004 obrien

For AMD64, lets officially support a -O2 kernel build!
I've added -fno-strict-aliasing for now so we can ease into this.
I wanted to shoot for -O3, but the inlining caused problems due to GCC's
size heuristics; so also add -frename-registers, which is one of the things
-O3 would have given us.


# 126938 13-Mar-2004 trhodes

Fix some style bugs in previous commit.
Fix 'broken' ifdefs.
icc does not support profiling yet so remove unfinished code which was
supposed to help.

Submitted by: netchild (original version)
Reviewed by: ru


# 126890 12-Mar-2004 trhodes

This are the build infrastructure changes to allow to use the
Intel C/C++ compiler (lang/icc) to build the kernel.

The icc CPUTYPE CFLAGS use icc v7 syntax, icc v8 moans about them, but
doesn't abort. They also produce CPU specific code (new instructions
of the CPU, not only CPU specific scheduling), so if you get coredumps
with signal 4 (SIGILL, illegal instruction) you've used the wrong
CPUTYPE.

Incarnations of this patch survive gcc compiles and my make universe.
I use it on my desktop.

To use it update share/mk, add
/usr/local/intel/compiler70/ia32/bin (icc v7, works)
or
/usr/local/intel_cc_80/bin (icc v8, doesn't work)
to your PATH, make sure you have a new kernel compile directory
(e.g. MYKERNEL_icc) and run
CFLAGS="-O2 -ip" CC=icc make depend
CFLAGS="-O2 -ip" CC=icc make
in it.

Don't compile with -ipo, the build infrastructure uses ld directly to
link the kernel and the modules, but -ipo needs the link step to be
performed with Intel's linker.

Problems with icc v8:
- panic: npx0 cannot be emulated on an SMP system
- UP: first start of /bin/sh results in a FP exception

Parts of this commit contains suggestions or submissions from
Marius Strobl <marius@alchemy.franken.de>.

Reviewed by: silence on -arch
Submitted by: netchild


# 126263 26-Feb-2004 mlaier

Tweak existing header and other build infrastructure to be able to build
pf/pflog/pfsync as modules. Do not list them in NOTES or modules/Makefile
(i.e. do not connect it to any (automatic) builds - yet).

Approved by: bms(mentor)


# 125772 13-Feb-2004 ru

Reduce the number of knobs controlling the build of debug modules
to one, DEBUG_FLAGS, which is also compatible with <bsd.prog.mk>.
Previously one had to set both DEBUG and DEBUG_FLAGS to build the
.ko.debug with debugging symbols which was boring when doing this
manually.


# 124834 22-Jan-2004 ru

Only enforce -fno-strict-aliasing for optimization levels that
imply -fstrict-aliasing.

Reviewed by: bde


# 123989 30-Dec-2003 bde

Backed out a small part of rev.1.15. -Winline now works better, so
there is no need turn it off when compiling with -finstrument-functions.

Having -Winline turned off mainly broke checking for bogus inlines in
kernels configured with high resolution profiling, e.g., LINT. Not
turning it off unbreaks the warnings for bogus inlines in istallion.c,
but at least the i386 LINT still builds because istallion.c is compiled
without -Werror due to other bugs in it.


# 123966 29-Dec-2003 bde

Garbage-collected some vestiges of objformat support (mainly ${FMT}).


# 122116 05-Nov-2003 bde

Moved $FreeBSD$ to the beginning of the file.

Don't put the name of the file in a comment. $FreeBSD$ gives more than
enough about the file's pathname.

Fixed misdescription of the file. It isn't the whole unified Makefile...

Moved the settings of WERROR and of the standard extra CFLAGS
-finline-limit and -fno-strict-aliasing to a less wrong place. They
were in the section for profiling.


# 122085 04-Nov-2003 peter

Move the inline limit default variable to a per-arch place. For example,
the amd64 implementation of the pcpu macros is even more verbose than on
i386 and that causes gcc to way overestimate the complexity of this
2-instruction macro. The other platforms can probably lower their
default values.


# 121613 27-Oct-2003 harti

Allow building the NgATM SAAL layer directly into the kernel.


# 119307 22-Aug-2003 imp

Now that the pci include file location migration has been completed,
remove the -I$S/dev and -I@/dev which were there only for pci.

# If I've broken something, please let me know.


# 118229 30-Jul-2003 scottl

Enforce -fno-strict-aliasing to override the converse that is implied by
-O2 and -Os.

Reviewed by: peter


# 118038 26-Jul-2003 peter

Turn -Werror back on again. I've tested with/without
invariants/witness/etc on i386, sparc64, amd64 and alpha for GENERIC.
Lint probably still needs fixing, as do a couple of other drivers
that have broken recently and not been noticed.


# 118036 26-Jul-2003 peter

Change the inline limit switch to something that exists in gcc-3.2.
Unfortunately, it has different units.


# 117941 23-Jul-2003 peter

Turn -Werror back off again. Leaving out the invariants options causes
more trouble than I expected.


# 117932 23-Jul-2003 peter

Turn -Werror back on.


# 117930 23-Jul-2003 peter

Provide a knob for raising the inline instruction estimate threshold and
set an initial value. This is aimed at getting us closer to being able to
turn -Werror back on and we can adjust the settings later on. Yes, we
could turn off -Wno-inline instead, but that would hide the effect of
gcc's bogo-estimator ignoring inline (either rightly or wrongly).


# 117432 11-Jul-2003 kan

Temporarily switch off -Werror until new GCC warning have been dealt with.


# 116817 25-Jun-2003 sam

config+build glue for Atheros support


# 116341 14-Jun-2003 markm

Some glue to allow lint(1) to work on the kernel. This is not
complete without some config(8) work. Config(8) needs to provide
some ${NORMAL_LINT} rules to make foo.ln files.


# 111684 28-Feb-2003 ru

Standardize handling of locore.[sS] etc. files.

Submitted by: jake, bde, ru


# 111606 27-Feb-2003 phk

Add necessary awk magic to create a table of major numbers allocated
in conf/majors so we can avoid autoallocating them in the kernel.


# 111211 21-Feb-2003 ru

Overhaul the targets and hope this is now much more readable.

This adds some orthodox kernel-* and modules-* targets and
retires harmful ``clobber''.

Now, do we really want to keep the ``modules'' target here?


# 105489 19-Oct-2002 mux

Put back NORMAL_C_NOWERROR, it was actually used.

Pointy hat to: mux


# 105462 19-Oct-2002 mux

- Remove ${NORMAL_C_NOWERROR}, it is not used anymore. To build
without -Werror, we do "make WERROR=", which doesn't need this
variable.
- Use ${.IMPSRC} instead of $< in ${NORMAL_M} for consistency with
the rest of the file.
- Add ${WERROR} for the ${NORMAL_M} case.

Tested on: i386, sparc64


# 103471 17-Sep-2002 peter

The previous commit also removed the addition of userland include files to
the kernel #include path. While this was not ready at the time (sorry
folks!), it is a good thing. I think all the loose ends have been tied up
on at least for i386 (LINT compiles) and alpha.


# 103436 16-Sep-2002 peter

Initiate deorbit burn for the i386-only a.out related support. Moves are
under way to move the remnants of the a.out toolchain to ports. As the
comment in src/Makefile said, this stuff is deprecated and one should not
expect this to remain beyond 4.0-REL. It has already lasted WAY beyond
that.

Notable exceptions:
gcc - I have not touched the a.out generation stuff there.
ldd/ldconfig - still have some code to interface with a.out rtld.
old as/ld/etc - I have not removed these yet, pending their move to ports.
some includes - necessary for ldd/ldconfig for now.

Tested on: i386 (extensively), alpha


# 101877 14-Aug-2002 jmallett

Spell kenrel as 'kernel' for consistency with the rest of the universe.

Inspired by: bde


# 100475 21-Jul-2002 peter

The transition time for -Werror has been gone for a while. We are now
sufficiently clean that we can fix any new problems or mark individual
files as not being ready for -Werror.


# 99932 13-Jul-2002 bde

Quick fix for high resolution kernel profiling on i386's. Use
-finstrument-functions instead of -mprofiler-epilogue. The former
works essentially the same as the latter but has a higher overhead
(about 22 more bytes per function for passing unused args to the
profiling functions).

Removed all traces of the IDENT Makefile variable, which had been
reduced to just a place for holding profiling's contribution to CFLAGS
(the IDENT that gives the kernel identity was renamed to KERN_IDENT).


# 99923 13-Jul-2002 bde

Moved the setting of all profiling-related variables except the key one
(PROFLEVEL) to kern.pre.mk so that it is easier to manage. Bumped config
version to match.

Moved the check for cputype being configured to a less bogus place in
mkmakefile.c.


# 98295 16-Jun-2002 mux

Removed a duplicate -ffreestanding. It's already set in bsd.kern.mk.

Approved by: bde


# 96461 12-May-2002 bde

Translated -malign-functions=4 to -falign-functions=16 for the new gcc.


# 95844 01-May-2002 obrien

Use makeobjops.awk rather than makeobjops.pl.
(with big thanks to Oliver Fromme <olli@fromme.com>)


# 93109 24-Mar-2002 obrien

Remove the setting of 'FMT'. We now do ELF by default, so only bother
to increase the lenght of the command line if needed. The setting of FMT
also gets in the cross bootstrapping way for new platforms.


# 91512 28-Feb-2002 obrien

Use vnode_if.awk rather than vnode_if.pl


# 91255 25-Feb-2002 peter

Turn on -Werror by default. This is is easily turned off, by either:
- fix the warnings, they are there for a reason!
- add -DNO_ERROR to your make(1) command.
- add 'makeoptions NO_WERROR=true' to your kernel config.
- add 'nowerror' to conf/files* that have warnings that should be fixed
due to tracking 3rd party vendor code.
- add 'nowerror' to conf/files* where the warning is false due to a
compiler bug and fixing it with brute force would be too expensive.

There are some very sloppy warnings in our kernel build, come on folks!

'make release' uses -DNO_WERROR intentionally.


# 91002 20-Feb-2002 peter

Commit some infrastructure for turning on -Werror for kernel compiles.
It doesn't actually do it yet though. This adds a flag to config so
that we can exclude certain vendor files from this even when the rest
of the kernel has it on. make -DNO_WERROR would also bypass all of it.


# 90789 17-Feb-2002 phk

Always build all modules for LINT


# 89180 10-Jan-2002 msmith

Eliminate the use of commons in the kernel and modules,
simplifying the module linking process and eliminating the risks
associated with doubly-defined variables.

Cases where commons were legitimately used (detection of
compiled-in subsystems) have been converted to use sysinits, and
any new code should use this or an equivalent practice as a
matter of course.

Modules can override this behaviour by substituting -fno-common
out of ${CFLAGS} in cases where commons are necessary
(eg. third-party object modules). Commons will be resolved and
allocated space when the kld is linked as part of the module
build process, so they will not pose a risk to the kernel or
other modules.

Provide a mechanism for controlling the export of symbols from
the module namespace. The EXPORT_SYMS variable may be set in the
Makefile to NO (export no symbols), a list of symbols to export,
or the name of a file containing a newline-seperated list of
symbols to be exported. Non-exported symbols are converted to
local symbols. If EXPORT_SYMS is not set, all global symbols are
currently exported. This behaviour is expected to change (to
exporting no symbols) once modules have been converted.

Reviewed by: peter (in principle)
Obtained from: green (kmod_syms.awk)


# 88893 05-Jan-2002 imp

Move initialization of the MKMODULESENV envorinoment to kern.pre.mk
from kern.post.mk so port makefiles can augment it.

Submitted by: nyan


# 87451 06-Dec-2001 obrien

Compile all kernels with "-ffreestanding":

Assert that compilation takes place in a freestanding environment. This
implies `-fno-builtin'. A freestanding environment is one in which the
standard library may not exist, and program startup may not necessarily be
at main. The most obvious example is an OS kernel. This is equivalent to
`-fno-hosted'.


# 86253 11-Nov-2001 imp

Move all: target to kern.pre.mk so it matters less where you include
kern.post.mk.

# this should allow us to move kern.post.mk to the last line of the makefiles,
# but I'll do that slowly as I verify that one can do that w/o breaking things.

Submitted by: naddy


# 85909 02-Nov-2001 imp

Factor the common parts of the Makefile.foo files. This introduces two
new files: kern.pre.mk, which contains most of the definitions, and
kern.post.mk, which contains most of the rules.

I've tested this on i386 and pc98. I have had feedback on the sparc64
port, but no reports from anybody on alpha, ia64 or powerpc. I
appologize in advance if I've broken you.

Reviewed by: jake, jhb, arch@