This improves buildworld, toolchain, kernel-toolchain, and universe targets.
See r300354 or src.conf(5) for more details.
Approved by: re (gjb)
Relnotes: yes (r300354)
Sponsored by: EMC / Isilon Storage Division
kgzldr.o is installed into /usr/lib but using bsd.prog.mk. Add
/usr/lib to the base system directory list so that debug files are
installed into /usr/lib/debug/usr/lib, not /usr/lib/.debug .
Approved by: re (gjb)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
The DPADD data in .depend will be redundant with what is in the .meta file.
Also extend NO_EXTRADEPEND support to bsd.prog.mk.
Approved by: re (blanket, META_MODE)
Sponsored by: EMC / Isilon Storage Division
This is mostly fixing META_MODE with realinstall wanting a .meta
file when it does not need one. These targets really should
always run though since they have _SUBDIR on them.
Approved by: re (implicit)
Sponsored by: EMC / Isilon Storage Division
- This was broken by r300350 and r300885.
- Add some comments around the external GCC logic since it is spread out
and in need of some cleanup.
- The problem was that X_COMPILER_TYPE is always defined from CC->XCC's
default, so if /usr/bin/cc is GCC (as it is on native powerpc64) then
X_COMPILER_TYPE was getting GCC and triggering the external logic in
Makefile.libcompat. It was intended to always provide -isystem with
GCC since --sysroot is used into the lib32 sysroot which won't modify
the header path without the -isystem. The use of the libc++/std=c++11
override was only intended to be used for external compilers though
(more accurately GCC 4.8+ but that's a separate assumption to
cleanup). Apply the same logic from Makefile.inc1 to Makefile.libcompat
to only add the libc++ override when needed for external compilers.
Pointyhat to: bdrewery
Tested with: native ppc64 (swills), universe, ppc64 xtoolchain,
amd64 xtoolchain, sparc64 cross-build of ppc64 (host GCC 4.2)
Reported by: andreast, swills
Approved by: re (gjb)
Sponsored by: EMC / Isilon Storage Division
Due to META_MODE being passed into the environment it tends
to keep growing with the defaults.
Approved by: re (implicit)
Sponsored by: EMC / Isilon Storage Division
This is a follow-up to r300343.
This is important for the OBJS_DEPEND_GUESS usage in
gnu/usr.bin/cc/cc_tools.
See comments for more details.
Approved by: re (implicit)
Sponsored by: EMC / Isilon Storage Division
This is important to allow a Makefile to override OBJS_DEPEND_GUESS for
handling in META_MODE when its depend files are missing.
Approved by: re (implicit)
Sponsored by: EMC / Isilon Storage Division
This will print a set of variables from make on error using
MAKE_PRINT_VAR_ON_ERROR. It is already enabled for the DIRDEPS_BUILD.
It may make sense to enable this in the non-meta mode as well once
people are more used to its more verbose error output.
This makes it much simpler to see which .meta file is used when a
command files so that it may be inspected for the build command.
Suggested by: sjg
Approved by: re (implicit)
Sponsored by: EMC / Isilon Storage Division
- Move the sys.mk filemon requirement to bsd.init.mk as a warning.
This is intended only to show when building directly in a subdirectory
without filemon loaded.
- Move the error into Makefile and only apply it when building
from the META_TGT_WHITELIST target list.
-DNO_FILEMON can be used to suppress both the warning and the error but
makes WITH_META_MODE less useful. It will only compare build commands
in this mode rather than track all dependencies.
This fixes installing from a jail which doesn't need filemon in this
phase [1].
Reported by: Nikolai Lifanov <lifanov@mail.lifanov.com> [1]
Approved by: re (implicit)
Sponsored by: EMC / Isilon Storage Division
Using -B already sets .MAKE.MODE=compat but it was leaving
MK_META_MODE set which could still cause other MK_META_MODE==yes
checks to trigger.
Approved by: re (implicit)
Sponsored by: EMC / Isilon Storage Division
A simplified example of the library targets with WITH_DEBUG_FILES is:
libgeom.so.5: libgeom.so.5.full
cp libgeom.so.5.full libgeom.so.5
libgeom.so.5.full:
ln -s libgeom.so.5 libgeom.so
cc -o libgeom.so.5.full *.o
Before, or without, WITH_DEBUG_FILES it is:
libgeom.so.5:
ln -s libgeom.so.5 libgeom.so
cc -o libgeom.so.5 *.o
The problem is that bmake considers the link source for the libgeom.so
link in the libgeom.so.5.full target as being a dependency for
libgeom.so.5.full. That resolves to libgeom.so.5. Thus a cyclic
dependency is created. The result of this is that if libgeom.so.5 is
created with a newer timestamp than libgeom.so.5.full, then
libgeom.so.5.full will be rebuilt on the next build. This causes a
chain reaction of everything in the build relinking, or hitting the
problem itself.
Moving the link creation to the target that actually creates
libgeom.so.5 fixes the problem. The simplest fix here is to just
duplicate the logic.
Submitted by: sjg
Approved by: re (implicit)
The WITH_META_MODE build is intended to be a working incremental build.
It spies on the build command to see if things should be rebuilt if the
command changes. If you run buildworld, it builds a cross-compiler,
then do installworld and buildworld again it will invoke the
WITH_SYSTEM_COMPILER logic. This then adds on -target/--sysroot, etc,
and causes rebuilds due to the changed build command even though the
compiler used is technically the same revision. Since the incremental
build is not cleaning anything by default then there is much
less risk to rebuilding the already-existing cross-compiler. Just
disable the combined logic and always use and build the cross-compiler.
An alternative to this would be to always pass -target/--sysroot. Doing
so may occur in the future.
Sponsored by: EMC / Isilon Storage Division
Using buildworld, installworld, buildworld. It is expected that nothing
should rebuild. However any host tool used could have its timestamp
updated. Any library used by dynamic tools could have its timestamp
updated. The filemon(4) data in the .meta files captures all reads to
these files. This causes the 2nd buildworld to rebuild everything since
host tools and files have been updated.
Because the build is self-reliant and bootstraps itself, it should be
safe to ignore mtime changes on host files used during the build. Host
files should only impact the build of legacy, build-tools, bootstrap-tools,
cross-tools, but those are already intended to be reproducible from its
own bootstrapping. It is possible in a rare case that a bug in a host
file does produce a broken build tool. If that happens it will just
have to be communicated properly.
An alternative solution would be to update the mtime of all files in the
object directory after installworld so that the host files are not newer
than the object files. That also requires special care for read-only
obj directories and special care to not mess with any intended timestamps in
the build, such as done for reproducibility.
Reported by: many
Sponsored by: EMC / Isilon Storage Division
Ccache will not affect the output of the objects, so just ignore it for
meta mode handling. This avoids having everything rebuild if ccache is
updated.
Sponsored by: EMC / Isilon Storage Division
The first file in these lists will generate everything else so only
it should be getting a .meta file. With bmake's missing=yes meta
feature these would otherwise cause a rebuild without the
.NOMETA hint.
Sponsored by: EMC / Isilon Storage Division
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.
for the CONFS issue with dma.conf and ppp.conf.
Thank you very much to Bryan Drewery for looking into the
problem and providing this fix.
Pointyhat: gjb
Sponsored by: The FreeBSD Foundation
Since META_MODE is being sold and used as a working incremental build, it won't
make much sense if filemon data is excluded. There is no way to recover
from that in a subsequent build.
Sponsored by: EMC / Isilon Storage Division
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
The C++ header files must be searched before /usr/include.
The original code in Makefile.inc1 did this before the change in r297271 to
use -isystem. The libc++ import in r300770 fixed the bug introduced in
r297271 by swapping XCFLAGS and XCXXFLAGS ordering in CROSSENV.
Moving the code from Makefile.inc1 to bsd.sys.mk in r300886 also made it
more difficult to control the order of the flags. CXXFLAGS is based on
CFLAGS, so any additions to it will come after CFLAGS. The CROSSENV
code from Makefile.inc1 was such that it was ensured the CXXFLAGS came
first by setting them directly in CXX. Using CXXFLAGS+=-I would work
here, but instead continue to use -isystem by adding it to CXX so it
comes before CFLAGS.
Reported by: dim
Add zfsd, which deals with hard drive faults in ZFS pools. It manages
hotspares and replements in drive slots that publish physical paths.
cddl/usr.sbin/zfsd
Add zfsd(8) and its unit tests
cddl/usr.sbin/Makefile
Add zfsd to the build
lib/libdevdctl
A C++ library that helps devd clients process events
lib/Makefile
share/mk/bsd.libnames.mk
share/mk/src.libnames.mk
Add libdevdctl to the build. It's a private library, unusable by
out-of-tree software.
etc/defaults/rc.conf
By default, set zfsd_enable to NO
etc/mtree/BSD.include.dist
Add a directory for libdevdctl's include files
etc/mtree/BSD.tests.dist
Add a directory for zfsd's unit tests
etc/mtree/BSD.var.dist
Add /var/db/zfsd/cases, where zfsd stores case files while it's shut
down.
etc/rc.d/Makefile
etc/rc.d/zfsd
Add zfsd's rc script
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
Fix the resource.fs.zfs.statechange message. It had a number of
problems:
It was only being emitted on a transition to the HEALTHY state.
That made it impossible for zfsd to take actions based on drives
getting sicker.
It compared the new state to vdev_prevstate, which is the state that
the vdev had the last time it was opened. That doesn't make sense,
because a vdev can change state multiple times without being
reopened.
vdev_set_state contains logic that will change the device's new
state based on various conditions. However, the statechange event
was being posted _before_ that logic took effect. Now it's being
posted after.
Submitted by: gibbs, asomers, mav, allanjude
Reviewed by: mav, delphij
Relnotes: yes
Sponsored by: Spectra Logic Corp, iX Systems
Differential Revision: https://reviews.freebsd.org/D6564
This fixes CROSS_TOOLCHAIN builds after r300886 since it
relies on X_COMPILER_TYPE being set.
The X_* vars will only represent the external compiler
being used.
Sponsored by: EMC / Isilon Storage Division
This allows respecting -nostdinc, -nostdinc++ and -nostdlib before
making the decision to add in -isystem, etc. The -isystem flags
are problematic for building lib/libc++ and lib/libcxxrt which wants
to only use its own headers.
More information the need of these flags can be found at
https://gcc.gnu.org/ml/gcc/2016-03/msg00219.html
This also reverts r300873.
Sponsored by: EMC / Isilon Storage Division
Passing MAKEOBJDIRPREFIX to the main prog build (rescue) would confuse
WITH_AUTO_OBJ and cause it to create a recursed object directory that
then broke the actual prog build. This is normally not a problem since
we do not call 'make -f prog.mk obj' before building anything in it.
Crunchgen(1) also assumes that if -o is not passed then if an object
directory does not already exist then it should build in the source
directories. The normal buildworld process will have already ran 'make
obj' in each of the component directories so this is not a problem.
With WITH_AUTO_OBJ though this is not the case. So we must tell
crunchgen(1) that MK_AUTO_OBJ=yes will create the directory and to not
require it be present before generating its Makefile.
Sponsored by: EMC / Isilon Storage Division
This would otherwise disallow using meta files from a foreign build that
spread them around in directories outside our own .OBJDIR.
Sponsored by: EMC / Isilon Storage Division
The main prog has a dependency on the submake targets to ensure they are
built. From bsd.crunchgen.mk though we already have our own dependency
on 'make objs' so there is no need for another one. Crunchgen(1) is
doing the right thing here so it is not modified.
This also prevents the CC fix tainting the submake environment with
META_MODE and causing rebuilds. The CC passed is is only intended for
the main prog itself.
Sponsored by: EMC / Isilon Storage Division
This fixes --sysroot and other CFLAGS/LDFLAGS not being respected
in the crunchgen build since it is not including bsd.sys.mk and
other files. For example, this fixes building rescue itself without
--sysroot and other CFLAGS.
Sponsored by: EMC / Isilon Storage Division
Since multiple files are generated from one build command, only
the first to run will actually generate a .meta file. This fix
prevents 'required but missing' rebuilds on each target.
Sponsored by: EMC / Isilon Storage Division
Because bmake defaults to .../share/mk now, this code was not doing anything
to help objdir builds (such as the rescue build). Export the same default.
Sponsored by: EMC / Isilon Storage Division
It turns out we need to leave this in place for a while so that people
running self-hosting armv6hf systems can do the builds necessary to update
to armv6 (which is now hardfloat by default).
This will still build the compiler for the target but will not build the
bootstrap cross-compiler in the cross-tools phase. Other toolchain
bootstrapping, such as elftoolchan and binutils, currently still occurs.
This will utilize the default CC (cc, /usr/bin/cc) as an external compiler.
This is planned to be on-by-default eventually.
This will utilize the __FreeBSD_cc_version compiler macro defined in the
source tree and compare it to CC's version. If they match then the
cross-compiler is skipped. If [X]CC is an external compiler (absolute
path) or WITHOUT_CROSS_COMPILER is already set, then this logic is skipped.
If the expected bootstrap compiler type no longer matches the found CC
compiler type (clang vs gcc), then the logic is skipped. As an extra
safety check the version number is also compared from the compiler to
the tree version.
Clang:
The macro FREEBSD_CC_VERSION is defined in:
lib/clang/include/clang/Basic/Version.inc
For clang -target will be used if TARGET_ARCH != MACHINE_ARCH. This
is from the current external toolchain logic. There is currently an
assumption that the host compiler can build the TARGET_ARCH. This
will usually be the case since we don't conditionalize target arch
support in clang, but it will break when introducing new
architectures. This problem is mitigated by incrementing the version
when adding new architectures.
GCC:
The macro FBSD_CC_VER is defined in:
gnu/usr.bin/cc/cc_tools/freebsd-native.h
For GCC there is no simple -target support when TARGET_ARCH !=
MACHINE_ARCH. In this case the opportunistic skip is not done. If we
add proper support for this case in external toolchain logic then it
will be fine to enable.
This relies on the macros being incremented whenever any change occurs
to these compilers that warrant rebuilding files. It also should never
repeat earlier values.
Reviewed by: brooks, bapt, imp
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D6357