Commit Graph

350 Commits

Author SHA1 Message Date
Ed Maste
1dd50172b0 Always pass -m to ld for converting binary files to kernel ELF objects
This is in preparation for linking with LLVM's lld, which does not have
a compiled-in default output emulation. lld requires that it is
specified via the -m option, or obtained from the object file(s) being
linked.

This will also allow all build targets to share a common linker binary.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7837
2016-09-20 17:07:14 +00:00
Bryan Drewery
5852ae2d99 Revert r301079.
This breaks cross-building with WITH_META_MODE since it will rebuild
'build-tools' during the 'everything' phase.

A more proper fix is coming to bmake to implicitly require .META unless
.NOMETA (and other restrictions) are in place.
2016-06-03 19:25:36 +00:00
Ruslan Bukin
8dbd4f302f Build riscv modules as PIC.
Submitted by:	Yukishige Shibata <y-shibat@mtd.biglobe.ne.jp>
2016-06-01 14:05:32 +00:00
Bryan Drewery
292c5292b6 WITH_META_MDE: Fix machine/include and x86/include issues.
- Fixes 'ln: File exists' errors.
- Fixes creating include directories in the source directory as well.

Sponsored by:	EMC / Isilon Storage Division
2016-05-31 23:40:21 +00:00
Bryan Drewery
5d4447e0b7 Define SYSDIR earlier since the defined(FIRMWS) block depends on it.
It uses it in a dependency, which won't work if it is not yet defined.

Sponsored by:	EMC / Isilon Storage Division
2016-05-31 23:14:15 +00:00
Bryan Drewery
2dcffa9cb7 WITH_META_MODE: Resolve SYSDIR to avoid changed build commands.
Sponsored by:	EMC / Isilon Storage Division
2016-05-31 23:08:43 +00:00
Bryan Drewery
28849c57d6 WITH_META_MODE: Mitigate switching from without to with META_MODE.
Adding .META to targets-to-build will ensure that they will rebuild if there
is no .meta file.

Adding it to all SUFFIXES and objects ensures that at least objects will
rebuild if there is no .meta file.

This will be reverted if bmake's behavior changes to rebuild on missing .meta
files.

Sponsored by:	EMC / Isilon Storage Division
2016-05-31 21:22:19 +00:00
Bryan Drewery
4977354760 Add some missing .PHONY.
These are relevant for WITH_META_MODE to ensure they are
always reran and don't generate a .meta file.

Sponsored by:	EMC / Isilon Storage Division
2016-05-26 23:20:14 +00:00
Dimitry Andric
16fba18fc0 After r299241, which added bhnd(4), use sh to run the shell scripts for
generating nvram maps, to allow a noexec-mounted source directory.

Reported by:	Johan Hendriks <joh.hendriks@gmail.com>
PR:		209435
2016-05-13 16:35:37 +00:00
John Baldwin
d9eed6f42e Don't store generated firmware object files in the source directory.
Trim the leading directory of a firmware source file from the resulting
target object file name so the object file is stored in the object
directory. Previously, using 'FIRMWS= /path/to/fw.bin:fw.bin' would
store the generated 'fw.bin.fwo' file in the /path/to directory. Now
it stores it in the object directory of the kernel module being built.

Reviewed by:	bdrewery
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D6285
2016-05-10 03:34:20 +00:00
Adrian Chadd
e83ce34035 [bhnd] Initial bhnd(4) SPROM/NVRAM support.
This adds support for the NVRAM handling and the basic SPROM
hardware used on siba(4) and bcma(4) devices, including:

* SPROM directly attached to the PCI core, accessible via PCI configuration
  space.
* SPROM attached to later ChipCommon cores.
* SPROM variables vended from the parent SoC bus (e.g. via a directly-attached
  flash device).

Additional improvements to the NVRAM/SPROM interface will
be required, but this changeset stands alone as working
checkpoint.

Submitted by:	Landon Fuller <landonf@landonf.org>
Reviewed by:	Michael Zhilin <mizkha@gmail.com> (Broadcom MIPS support)
Differential Revision:	https://reviews.freebsd.org/D6196
2016-05-08 19:14:05 +00:00
Glen Barber
d60840138f MFH
Sponsored by:	The FreeBSD Foundation
2016-04-04 23:55:32 +00:00
Bryan Drewery
497e80911e Remove the old depend (mkdep) code and make FAST_DEPEND the one true way.
Reviewed by:	emaste, hselasky (partial), brooks (brief)
Discussed on:	arch@
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D5742
2016-03-30 23:50:23 +00:00
Glen Barber
538354481e MFH
Sponsored by:	The FreeBSD Foundation
2016-03-14 18:54:29 +00:00
Bryan Drewery
ec4047ade2 Reduce duplicated logic from r291744.
Sponsored by:	EMC / Isilon Storage Division
2016-03-12 22:21:14 +00:00
Glen Barber
b655ec9752 MFH
Sponsored by:	The FreeBSD Foundation
2016-03-06 04:13:17 +00:00
Dimitry Andric
82aa34e6fa Merge ^/head r296007 through r296368. 2016-03-03 23:15:46 +00:00
Glen Barber
42d27ee343 MFH
Sponsored by:	The FreeBSD Foundation
2016-03-02 23:53:08 +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
Glen Barber
52259a98ad MFH
Sponsored by:	The FreeBSD Foundation
2016-03-02 16:14:46 +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
Glen Barber
72c3aa02dc MFH
Sponsored by:	The FreeBSD Foundation
2016-02-18 00:37:58 +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
Glen Barber
acbbf33c47 MFH
Sponsored by:	The FreeBSD Foundation
2016-02-09 01:42:51 +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
Glen Barber
b626f5a73a MFH r289384-r293170
Sponsored by:	The FreeBSD Foundation
2016-01-04 19:19:48 +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
Baptiste Daroussin
9be27fdc00 Merge from head 2015-10-09 22:45:54 +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
Baptiste Daroussin
5a2b666ce5 Merge from head 2015-10-01 09:36:43 +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
Baptiste Daroussin
f94594b37a Finish merging from head, messed up in previous attempt 2015-09-12 12:03:02 +00:00
Baptiste Daroussin
b5ff185e19 Merge from head 2015-09-12 11:41:31 +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