Commit Graph

321 Commits

Author SHA1 Message Date
Bryan Drewery
ec4047ade2 Reduce duplicated logic from r291744.
Sponsored by:	EMC / Isilon Storage Division
2016-03-12 22:21:14 +00:00
Dimitry Andric
82aa34e6fa Merge ^/head r296007 through r296368. 2016-03-03 23:15:46 +00:00
Bryan Drewery
88fe1f7ab3 Add guessed dependencies to OBJS after bsd.dep.mk in case of it adding to SRCS.
This was a regression in r295985.

bsd.dep.mk adds to SRCS for dtrace probes, yacc grammars and some
others.

The code that is moving is planned to be removed once FAST_DEPEND is
default (and the only option) though since FAST_DEPEND doesn't use this.

Pointyhat to:	bdrewery
Sponsored by:	EMC / Isilon Storage Division
2016-03-02 21:03:42 +00:00
Bryan Drewery
aae63957af Import bsd.clang-analyze.mk based on NetBSD's version.
This allows 'make analyze' or 'make OBJ.clang-analyzer' to run the
Clang static analyzer and present results on stdout.

Obtained from:	NetBSD (CVS Rev. 1.3)
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D5449
2016-02-26 22:14:00 +00:00
Dimitry Andric
14e9c9161c Merge ^/head r295902 through r296006. 2016-02-24 21:38:51 +00:00
Bryan Drewery
d7beff082b FAST_DEPEND: Rework how guessed dependencies are handled.
Rather than depend on .depend not existing, check the actual
.depend.OBJ file that will be used for that object.  If it doesn't
exist then use the guessed dependencies.

FAST_DEPEND may never have a .depend file.  Not having one means all of the
previous logic would over-depend all object files on all headers which is not
what we wanted.  It also means that if a .depend is generated before a build
is done for _EXTRADEPEND (such as for PROG or LIB) then all of these
dependencies would not be used since the .depend wasn't generated from mkdep
and the real .depend.* files are not generated until the build.

Sponsored by:	EMC / Isilon Storage Division
2016-02-24 17:19:05 +00:00
Bryan Drewery
de1a3bd97e Remove ilinks in cleandepend directly via CLEANDEPENDFILES.
The 'cleanilinks' target is kept since it may still be useful as added in
r200178, though never documented.

Sponsored by:	EMC / Isilon Storage Division
2016-02-24 17:18:58 +00:00
Dimitry Andric
9893f787ec Merge ^/head r295601 through r295844. 2016-02-21 13:49:26 +00:00
Bryan Drewery
1bd4272fb9 Consolidate common beforebuild logic.
Sponsored by:	EMC / Isilon Storage Division
2016-02-16 02:09:48 +00:00
Dimitry Andric
4156ce4fed Merge ^/head r295351 through r295543. 2016-02-11 20:07:09 +00:00
Bryan Drewery
68d969232c kmod.mk: Ensure ILINKS are created before building.
This allows skipping 'make depend' or running 'make clean all' without
getting a flip-flopping dependency due to the exists() just below.
Otherwise an error is encountered, such as:
  fatal error: 'machine/endian.h' file not found.

Sponsored by:	EMC / Isilon Storage Division
2016-02-08 20:58:52 +00:00
Bryan Drewery
bbc7e0d690 kmod.mk: Support a beforebuild target such as bsd.prog.mk has.
Sponsored by:	EMC / Isilon Storage Division
2016-02-08 20:57:12 +00:00
Bryan Drewery
620a9cdf4f Revert r294352.
Further research showed it was the wrong fix and revealed a bigger
problem with the goal of skipping 'make depend'.
2016-01-19 23:25:25 +00:00
Bryan Drewery
d0d3ff23f7 FAST_DEPEND: Add header dependency missed in r290629.
Sponsored by:	EMC / Isilon Storage Division
2016-01-19 22:42:01 +00:00
Dimitry Andric
67e3484f3d For clang 3.8.0 and higher targeting arm, use the new -mno-movt flag to
disable emitting movt instructions.
2016-01-07 22:44:58 +00:00
Dag-Erling Smørgrav
93bffaf2cd In the unload target, check that the module is loaded first.
Add a reload target which unloads and then loads the module.
2016-01-01 03:59:09 +00:00
Warner Losh
23df2d677f Revert this change. It broke the trampoline build. Until I'm sure
nothing else is broken, I'm reverting.
2015-12-21 20:36:01 +00:00
Warner Losh
01c616982b Move some MIPS specific flags to be more congruent with other
architectures.
2015-12-19 19:20:48 +00:00
Mark Johnston
11f1d284a4 Consistently use ${AWK} instead of hard-coding the program name.
MFC after:	3 days
2015-12-17 00:02:53 +00:00
Bryan Drewery
3c9c5b15fc Calculate MPATH for sys/modules to save 92% time in a basic 'obj' tree-walk.
Sponsored by:	EMC / Isilon Storage Division
2015-12-04 04:27:21 +00:00
John Baldwin
2cd2ff0e26 Restore cleaning of auto-generated kobj files after the recent MFILES
changes.  Use the list of MFILES found by find to identify the set of
possible auto-generated files and add the intersection of this set and
SRCS to CLEANFILES.

Submitted by:	imp (previous version), sbruno
Differential Revision:	https://reviews.freebsd.org/D4336
2015-12-01 21:19:16 +00:00
Bryan Drewery
0ed70e428d Do as r289391 did for share/mk and make installing to a non-existent directory
an error.

Most of these do a 'mkdir -p' or 'install -d' before installing, but add
the trailing / here for consistency with the userland install.

MFC after:	2 weeks
X-MFC-With:	r289391
Sponsored by:	EMC / Isilon Storage Division
2015-10-17 05:49:07 +00:00
Konstantin Belousov
8598392cd1 Build changes that allow the modules on arm64.
- Move the required kernel compiler flags from Makefile.arm64 to kern.mk.
- Build arm64 modules as PIC; non-PIC relocations in .o for shared object
  output cannot be handled.
- Do not try to install aarch64 symlink.
- A hack for arm64 to avoid ld -r stage.  See the comment for the explanation.
  Some functionality is lost, like ctf handling, but hopefully will be
  restored after newer linker is available.

Reviewed by:	andrew, emaste
Tested by:	andrew (on real hardware)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3796
2015-10-08 17:42:08 +00:00
Ed Maste
05117b57a5 Install kernel debug data under /usr/lib/debug
This avoids needing a large boot partition / file system in order to
accommodate multiple kernels, and provides consistency with userland
debug. This also simplifies the process of moving kernel debug files
to a separate package and installing them on demand.

In addition, change kernel debug file extension to .debug, to match
userland debug files.

When using the supported kernel installation method the
/usr/lib/debug/boot/kernel directory will be renamed (to kernel.old)
as is done with /boot/kernel.

Developers wishing to maintain the historical behavior of installing
debug files in /boot/kernel/ can set KERN_DEBUGDIR="" in src.conf(5).

Reviewed by:	bdrewery, brooks, imp, markj
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D1006
2015-09-24 16:55:22 +00:00
Warner Losh
fd449cdf1e Comment out cleaning files, since it cleans too much. 2015-08-28 16:29:38 +00:00
Warner Losh
160c44fe95 Fix cleaning of files generated from .m sources. 2015-08-28 13:57:30 +00:00
Warner Losh
8cad626fbb Cache _MPATH and pass it down into the modules build. Some NFS setups
make the find it does extremely expensive, so compute it only
once. Also make sure the 'traditional' module building method works at
the expense of a bit of duplicated code.
2015-07-04 05:43:45 +00:00
Warner Losh
12f05b8446 Kill MFILES and find things automatically. It turned out to be only
lightly used. Find the proper .m file when we depend on *_if.[ch] in
the srcs line, with seat-belts for false positive matches.  This uses
make's path mechanism. A further refinement would be to calculate this
once, and then pass the resulting _MPATH to modules submakes.

Differential Revision: https://reviews.freebsd.org/D2327
2015-07-03 01:50:26 +00:00
Simon J. Gerraty
8cf80600ef Don't use ${.OBJDIR}/ to qualify target that isn't specified that way 2015-06-15 18:43:32 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
John Baldwin
f3bb925153 Create a separate kobj interface for leaf-driver PCI IOV methods.
Leaf drivers should not import the PCI bus interface to add IOV handling.
Instead, move the IOV client methods to a separate kobj interface.

Differential Revision:	https://reviews.freebsd.org/D2584
Reviewed by:	rstone
2015-05-28 22:01:50 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Ed Maste
7dd824c370 Fix kernel build ${MACHINE} path
$M should be the kernel machine src directory, ${MACHINE}. In most cases
${MACHINE} and ${MACHINE_CPUARCH} are the same, but this is not true for
pc98 and arm64.

It appears we previously set M=${MACHINE_CPUARCH} as a workaround to
accommodate pc98, where MACHINE_CPUARCH is pc98 but it uses
sys/i386/i386/genassym.c.

arm64 relies on this being set correctly, so update $M and add explicit
workarounds for pc98.

Differential Revision:	https://reviews.freebsd.org/D2307
Reviewed by:	andrew, imp
Sponsored by:	The FreeBSD Foundation
2015-04-16 22:34:10 +00:00
Gleb Smirnoff
772e66a6fc Move ALTQ from contrib to net/altq. The ALTQ code is for many years
discontinued by its initial authors. In FreeBSD the code was already
slightly edited during the pf(4) SMP project. It is about to be edited
more in the projects/ifnet. Moving out of contrib also allows to remove
several hacks to the make glue.

Reviewed by:	net@
2015-04-16 20:22:40 +00:00
Andrew Turner
1b23f9b9c3 Allow the ARM unwinder to work through modules. This will be used to add
support for unwinding from dtrace.

Tested by:	gnn (with dtrace)
Sponsored by:	ABT Systems Ltd
2015-02-19 12:06:57 +00:00
Warner Losh
35c4406d4c Populate new KERN_OPTS from all the opt_*.h files in
KERNBUILDDIR. Come up with some sensible defaults (though listing them
in kmod.mk may be unwise -- we have no easy way to know what are the
best sensible defaults for everything so we just catch the big stuff).
Append SRCS.${opt} for each option in KERN_OPTS to SRCS to allow easy
conditional compilation. Append any notion of KERN_OPTS_EXTRA to the
list of kernel opts.

Differential Revision:    https://reviews.freebsd.org/D1530
2015-02-18 15:25:19 +00:00
Gleb Smirnoff
cc4a90c445 Globally enable -fms-extensions when building kernel with gcc, and remove
this option from all modules that enable it theirselves.
  In C mode -fms-extensions option enables anonymous structs and unions,
allowing us to use this C11 feature in kernel. Of course, clang supports
it without any extra options.

Reviewed by:	dim
2015-02-17 19:27:14 +00:00
Oleksandr Tymoshenko
701fd0c9c2 Add dev/mbox/mbox_if.m to MFILES list so we can use it in kernel modules 2015-01-07 21:40:23 +00:00
Ian Lepore
c6f7b90092 Don't allow clang to use fpu instructions or registers in kernel modules.
Submitted by:	Keith White <kwhite@site.uottawa.ca>
2015-01-04 00:12:30 +00:00
Ian Lepore
b54c389fbc Put in a workaround for bug 196407 (arm modules cause crashes & panics).
When we started compiling the kernel with -march=armv7 the compiler
started emitting new types of relocation info which are incompatible with
the shared-lib file format used by .ko modules.  This workaround prevents
the compiler from emitting the instruction sequences that require the
new relocs.  This amounts to using an undocumented internal compiler
flag, so this is just a temporary workaround while we look for a good fix.

PR:		196407
2015-01-02 03:20:13 +00:00
Warner Losh
faa5d16da2 Move more of the warnings into kern.mk, as well as centralize that as
the place where the C dialect is selected. Have a fairly long list
of newly requires warning suppression for clang 3.5.0, also
centralized in kern.mk. Survive the fallout of the removal of
bsd.sys.mk from bsd.kmod.mk.
2015-01-01 08:18:08 +00:00
Simon J. Gerraty
9268022b74 Merge from head@274682 2014-11-19 01:07:58 +00:00
Warner Losh
528013d5a8 Retire the '@' symlink. It isn't really needed and causes more
problems than it solves. SYSDIR is already defined almost always and
can be used instead. Working around the one case where it isn't is
much easier than working around the fact that @ may not exist in 18
other places.

Differential Revision: https://reviews.freebsd.org/D1100
2014-11-06 16:48:37 +00:00
Warner Losh
0c0fde953f Don't depend on @ or machine for assym.s or genassym.o. That's a
vestige of a time when we needed to do that, but it is all handled by
beforedepend now. When we depend on the symlink, bmake will cause the
file to be rebuilt always.

With this change, dtrace.ko doesn't rebuild every time through a
KERNFAST run.

Sponsored by: Netfix
2014-10-17 04:36:48 +00:00
Simon J. Gerraty
ee7b0571c2 Merge head from 7/28 2014-08-19 06:50:54 +00:00
Warner Losh
aeaed50898 Move most of the 15 variations on generating opt_inet.h and
opt_inet6.h into kmod.mk by forcing almost everybody to eat the same
dogfood. While at it, consolidate the opt_bpf.h and opt_mroute.h
targets here too.
2014-08-04 22:37:02 +00:00
Warner Losh
b0a8d404e5 Include the kernel options after bsd.init.mk so that when we're
compiling on older systems that define all the MK variables in
bsd.own.mk we don't get the multiply defined error for options that
live in both.
2014-08-04 22:34:56 +00:00
Simon J. Gerraty
5b6dc2efc9 Reviewed by: imp
LDFLAGS is supposed to be given to CC not LD.
Define _LDFLAGS as a filtered version of LDFLAGS safe to give to LD
2014-07-26 04:38:09 +00:00
Sean Bruno
31a01497f2 Clean symlinks created in sys/modules dirs when a make clean is invoked.
Phabric:	https://phabric.freebsd.org/D474
Reviewed by:	grehan sjg
2014-07-24 00:25:25 +00:00
Warner Losh
1f4e0ed969 The time is not yet ripe to break the lack of dependencies between
src/sys and the rest of the tree for builds.
o eliminate including bsd.mkopts.mk for the moment in kern.opts.mk
o No need to include src.opts.mk at all anymore. The reasons for it
  are now coverted in sys.mk and src.sys.mk.
2014-05-17 20:31:34 +00:00