Commit Graph

1376 Commits

Author SHA1 Message Date
Dimitry Andric
8422e09e55 Follow-up to r321684 (Don't use libc++ when cross-building for gcc
arches), and handle two more cases where libc++ includes could be
incorrectly enabled, in case the host compiler is clang 5.0.0, and the
target (cross) compiler is gcc 4.2.1.

Noted by:	bdrewery
MFC after:	3 days
X-MFC-With:	321684
2017-08-07 16:23:53 +00:00
Bryan Drewery
91234af7d8 CCACHE_BUILD: Follow-up r321880: Fix some PATH issues with buildworld.
- bsd.compiler.mk: Must ensure that the CCACHE_WRAPPER_PATH comes first
  in PATH.
- Makefile.inc1: Must prepend the CCACHE_WRAPPER_PATH into BPATH as it
  overrides the PATH set in bsd.compiler.mk in sub-makes.  The PATH
  set in bsd.compiler.mk is not exported and doing so would cause it to
  then override the BPATH set from environment.  The only sane solution
  is to prepend into BPATH as needed.
CCACHE_PATH could possibly be used for some of this as well.

Sponsored by:	Dell EMC Isilon
2017-08-01 18:26:20 +00:00
Bryan Drewery
5aa73fa259 NO_CLEAN: No need to run delete-old if the directories don't exist.
X-MFC-With:	r321443
MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2017-08-01 16:41:17 +00:00
Ian Lepore
dca576be69 In xdev-links, when installing symlinks to the cross-compiler pieces that
includes the OS version (armv6-freebsd12.0-cc, etc), use the OS version of
the compiler/world source code, not the version of the build host machine.
2017-08-01 14:54:25 +00:00
Dimitry Andric
1681d1de13 Don't use libc++ when cross-building for gcc arches
Since we imported clang 5.0.0, the version check in Makefile.inc1 which
checks whether to use libc++ fires even when the compiler for the target
architecture is gcc 4.2.1.  This is because only X_COMPILER_VERSION is
checked.  Also check X_COMPILER_TYPE, so it will only use libc++ when an
external gcc toolchain is used.

Reviewed by:	emaste, rpokala
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D11776
2017-07-29 12:22:29 +00:00
Bryan Drewery
18388aa44a NO_CLEAN: Hide delete-old output.
It is full of distracting noise about UPDATING and may confuse
the user about what is actually being deleted.  It is also
possible to have directories removed on every run with
use of WITHOUT_ knobs that the mtree files do not
account for and for which the directories are incorrectly
in OLD_DIRS currently.

X-MFC-With:	r321443
MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2017-07-25 20:51:06 +00:00
Bryan Drewery
b7c6a063fe Only build libzfs_core in 'make libraries' if needed.
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-07-25 20:43:37 +00:00
Bryan Drewery
63c534e716 Remove unneeded dependency for libzfs.
This dependency does nothing since cddl/lib/libzfs is never
added into the 'make libraries' dependency chain
directly.

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-07-25 20:43:26 +00:00
Bryan Drewery
1ae1311d9c NO_CLEAN: Utilize delete-old to remove old orphaned libraries/headers in WORLDTMP.
This prevents situations with -DNO_CLEAN from finding stale headers or
libraries in places that no longer exist or have moved.  It avoids
the need to remove all of WORLDTMP by reusing what we already know
is obsolete.

MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2017-07-24 23:32:46 +00:00
Bryan Drewery
dc75d44eca The .depend.obj cleanup hacks are only needed with -DNO_CLEAN.
Sponsored by:	Dell EMC Isilon
2017-07-24 23:32:43 +00:00
Bryan Drewery
cd2831005b Move llvm Options.inc hack from r321433 for NO_CLEAN to lib/clang/libllvm.
The files are only ever generated to .OBJDIR, not to WORLDTMP (as a
sysroot) and are only ever included from a compilation.  So using
a beforebuild target here removes the file before the compilation
tries to include it.

MFC after:	2 months
X-MFC-With:	r321369
2017-07-24 23:32:24 +00:00
Dimitry Andric
edcc769f3f Cleanup stale Options.inc files from the previous libllvm build for
clang 4.0.0.  Otherwise, these can get included before the two newly
generated ones (which are different) for clang 5.0.0.

Reported by:	Mark Millard
MFC after:	2 months
X-MFC-With:	r321369
2017-07-24 18:52:40 +00:00
Bryan Drewery
0f827d7a96 makeman: Don't show META_MODE ABI rebuild warnings.
Reported by:	dim
Sponsored by:	Dell EMC Isilon
2017-07-08 17:53:00 +00:00
Bryan Drewery
9bb3819b32 SYSTEM_COMPILER: Ensure there is not a stale compiler in WORLDTMP.
In a scenario of cross-building it is possible that an OBJDIR's WORLDTMP
contains an older compiler in WORLDTMP/usr/bin/cc that is not rebuilt
if SYSTEM_COMPILER logic is triggered.  This compiler was still
incorrectly used.  Address this by removing WORLDTMP/usr/bin/cc and all
of the hardlinked files associated with it.  Also do this for c++ for
GCC builds.

Sponsored by:	Dell EMC Isilon
MFC after:	1 week
2017-07-08 16:39:55 +00:00
Bryan Drewery
f45c780573 Fix create-kernel-packages with multiple BUILDKERNELS after r320284
Submitted by:	Kyle Evans <kevans91@ksu.edu>
Reviewed by:	ngie
2017-07-05 19:24:38 +00:00
Ed Maste
a28412b0db Clean up stale dependencies after r320278
Our current approach to dependency tracking cannot cope with switching
generated asm syscall stubs into C wrappers. Perpetuate the hack in
Makefile.inc1 to paper over the problem until we can take a holistic
approach to fixing dependency problems.

Differential Revision:	https://reviews.freebsd.org/D11344
2017-06-24 18:37:51 +00:00
Bryan Drewery
0369270f71 NO_ROOT: Remove excessive // when DESTDIR/DISTDIR are empty.
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-06-23 19:03:31 +00:00
Bryan Drewery
2d5cc53891 compiler-metadata: Properly handle cross-build OBJDIR.
MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-06-23 18:27:03 +00:00
Bryan Drewery
275219cfe7 Expose only the create-packages-* targets since they set needed DEST/DIRDIR.
The other targets just fail confusingly otherwise.

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-06-23 18:27:00 +00:00
Bryan Drewery
10c935294b packages: Parallelize individual kernel packaging.
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-06-23 18:26:57 +00:00
Bryan Drewery
f77b03aa2b packages: Allow actually building individual world packages in parallel.
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-06-23 18:26:54 +00:00
Bryan Drewery
48c22674a8 packages: Allow creating kernel/world packages in parallel.
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-06-23 18:26:51 +00:00
Bryan Drewery
00c44825d6 packages: Allow staging world/kernel in parallel.
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-06-23 18:26:47 +00:00
Bryan Drewery
dd7b4c153a packages: Allow stageworld/stagekernel to run with make jobs.
The -B was originally added in projects/release-pkg r289381 as a copy
of what 'make world' did at the time.  The -B was removed from
the 'installworld' call in 'world' in r303844 though.  The staging
of files is safe to run in parallel.

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-06-23 18:26:33 +00:00
Bryan Drewery
d20bd9e42b Set compiler metadata for stageworld/distributeworld.
This fixes LD errors during 'make packages' but also for the unlikely case of
'buildworld' on 1 system and 'packages' on another [1].

PR:		212877 [1]
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-06-23 16:38:46 +00:00
Bryan Drewery
81b4423f05 Pass along LINKER_* vars during installworld and show in test-system-compiler.
Sponsored by:	Dell EMC Isilon
2017-06-22 21:03:30 +00:00
Bryan Drewery
817366f1c1 buildworld: Pass which world phase the build is in down to submakes.
This is useful for having directories behave differently depending
on the phase - such as enabling SUBDIR_PARALLEL or disabling
redundant building of library directories already done by
earlier 'make _libraries'.

Sponsored by:	Dell EMC Isilon
2017-06-20 22:08:02 +00:00
Bryan Drewery
35fb812adf buildworld: Define SYSROOT to WORLDTMP.
This is to allow downstream Makefiles to know for sure they are building
against a sysroot rather than only depending on ${DESTDIR} or other
assumptions.

This also exports it into buildenv.

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-06-19 18:08:20 +00:00
Ed Maste
ff6c17c94e remove stale dependencies for utimens* wrappers removed in r319663
Use a similar approach to r318957 (which was for ptrace dependencies):
grep the .depend file for the old source file and delete the stale
dependency if found.

Reviewed by:	bdrewery
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D11091
2017-06-12 19:45:05 +00:00
Baptiste Daroussin
69db934679 Fix src.conf.5 generation
When makeman is generating src.conf(5) it tries to test all variation of options
including WITH_DIRDEPS_BUILD. it results in an error when filemon(4) is not
loaded.

Export variables that are needed to prevent this behaviour.

Helped by:	sjg
2017-06-08 00:41:25 +00:00
Bryan Drewery
c8fab231f1 META_MODE: Force a host tool rebuild for ino64 in r318736.
Sponsored by:	Dell EMC Isilon
2017-06-05 05:17:42 +00:00
Bryan Drewery
1a9cc831dd META_MODE: Add framework to force rebuilding for major ABI changes.
Normally META_MODE ignores host files for "meta mode" decisions on whether a
file should be rebuilt or not.  This is because a simple installworld can
update timestamps and cause the next build to rebuild all host tools, when the
previous ones may not have any changes in the source tree.  These tools are
normally still ABI compatible.  They are only rebuilt if NO_META_IGNORE_HOST is
set from the workaround/hack in r301467.

One of the major problems with this is when a host tool has objects spread
across many revisions that have mixed-ABI.  For example, if struct stat were to
change on the host, some objects for a tool may have different ideas of that
struct's definition.  If just 1 source file were modified and rebuilt and
linked into the tool, then that toll will have mixed-ABI objects and crash.
This exact thing happened with the ino64 commit in r301467 followed by a
trivial update to libbfd in r318750.  The resulting binary would crash in
buildworld.

Sponsored by:	Dell EMC Isilon
2017-06-05 05:17:39 +00:00
Bryan Drewery
86f2d54ff0 native-xtools: Connect makewhatis.
This speeds up some port staging, namely perl.
2017-06-03 23:13:46 +00:00
Bryan Drewery
9f68573426 native-xtools: Connect lld.
This will ensure that aarch64 gets a working native /usr/bin/ld rather
than requiring the aarch64-binutils hack in Poudriere, or emulating
the aarch64 lld.

PR:		217189
Reported by:	swills, jbeich
2017-06-02 00:57:59 +00:00
Ed Maste
bd1c3bad76 add a rescue/sh sanity check before installworld on the running system
FreeBSD does not guarantee kernel forward compatibility (that is,
running a newer userland on an older kernel).  The documented upgrade
procedure specifies that installkernel should be performed, followed by
a reboot and then installworld.  As a sanity check when installing onto
the running system (DESTDIR is / or unset), attempt to run "sh echo OK"
using rescue from the objdir.  If rescue fails (e.g., because the system
has not been rebooted and the "old" kernel lacks a system call required
by the to-be-installed world), abort the installation.

This should avoid ino64 foot-shooting when the proper upgrade procedure
is not followed.

Reviewed by:	allanjude, gjb, kib
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D10987
2017-05-30 15:51:48 +00:00
Ed Maste
55b87d4621 rm stale ptrace dependencies after r305012
This is similar to r318912, except that ptrace.[sS] was previously a
file in the source tree, not a generated assembly wrapper.

Check for the existence of ptrace.[sS] in the .depend file to determine
if we have to clean it up.  This is a bit hackish and will not be left
in place indefinitely, but provides a useful example case when
investigating a better solution in bmake.

Reviewed by:	bdrewery
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D10930
2017-05-26 16:03:28 +00:00
Ed Maste
90d4415d20 libc: rm stale generated files which are no longer syscalls
This is an attempt to help -DNO_CLEAN builds after r302092 (which
removed the pipe libc syscall wrapper) and r318736 (which removed
getdents, lstat, mknod, and stat).

Dependencies cannot cope with certain source tree changes,
particularly with respect to removing source files and replacing
generated files.  Handle these cases from _worldtmp in an ad-hoc
fashion.

Reviewed by:	bdrewery, cem
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D10876
2017-05-26 00:51:05 +00:00
Baptiste Daroussin
ac4ef3f9a9 Now that roff documentation has been disconnected from the build, it is no
longer necessary to have groff(1) as a bootstrap tool
2017-05-25 16:31:53 +00:00
Bryan Drewery
c596c2876f Add a -DNO_LIBS to skip building the libraries phase as well.
This is useful for cases where -DWORLDFAST is useful.

Sponsored by:	Dell EMC Isilon
2017-05-09 23:58:07 +00:00
Bryan Drewery
16892c7713 Support -DWORLDFAST to skip all build steps up to 'libraries' and 'everything'.
This allows for building the world against the already-created
host/sysroot environment.  It is not overly useful outside of cases of
large-impact changes such as a testing a new compiler.  It will
allow quickly getting back to an error in the target-phases of the
build where a new compiler is being used.

Sponsored by:	Dell EMC Isilon
2017-05-09 20:21:58 +00:00
Bryan Drewery
6d75a7a852 Support skipping 'make obj' tree-walk.
This is part of a larger effort for WITH_AUTO_OBJ and a WORLDFAST
option.

Sponsored by:	Dell EMC Isilon
2017-05-09 20:21:38 +00:00
John Baldwin
d5392a4191 Honor WITHOUT_LIB32 on mips64.
The closing paren for the list of architectures that should enable LIB32
by default was in the wrong place resulting in LIB32 always be enabled on
mips64 regardless of WITH_LIB32/WITHOUT_LIB32.

Submitted by:	Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
Obtained from:	CheriBSD
Sponsored by:	DARPA / AFRL
2017-05-08 18:51:13 +00:00
Baptiste Daroussin
a17665bcef Replace again GNU diff with BSD diff
After a firts failed attempt, BSD diff is now good enough to replace
GNU diff.

Relnotes:	yes
2017-04-20 19:24:51 +00:00
Glen Barber
5e50a31863 Use relative symlink for 'latest' to allow repo to work after being
moved.

Submitted by:	woodsb02
MFC after:	3 days
PR:		217197
Sponsored by:	The FreeBSD Foundation
2017-04-18 19:44:34 +00:00
Bryan Drewery
848d5e929b Cache compiler metadata and reuse it at installworld time.
Right after cross-tools, a compiler-metadata.mk file is created that
stores all of the bsd.compiler.mk metadata.  It is then read in
with a fail-safe during installworld time.

The file is explicitly removed when invoking cross-tools to ensure that
a stale file is not left around from odd manual 'make _cross-tools' ->
'make installworld' invocations.

This fixes several issues:
    - With WITH_SYSTEM_COMPILER (default yes on head and no on releng/11.0):
      If you build on a system where the bootstrap compiler does not
      build due to the host compiler matching the in-tree one, but then
      installworld on another system where that logic fails (a
      bootstrap compiler is needed), the installworld immediately fails
      with:
           sh: cc: not found
      Note that fixing this logic may then hit a case where a rebuild is
      attempted in installworld.  Normally cc would be ran with
      'CFLAGS+=ERROR-tried-to-rebuild-during-make-install' to cause an
      error such as:
          cc: error: no such file or directory: 'ERROR-tried-to-rebuild-during-make-install'
      However, now it will just fail with the 'cc: not found' error.
      Inspection of the compile line will show
      'ERROR-tried-to-rebuild-during-make-install';  It's not useful to
      set CC to anything other than 'cc' during install as it is more
      helpful to see the attempted compile rather than some other bogus
      error.
    - This now avoids running bsd.compiler.mk (cc executions) even more
      during installworld.  There are compiler-dependent SUBDIR in the
      tree which required having a compiler during install.

There is at least 1 case where CC is still executed in the install,
such as from a LOOKUP!= in secure/lib/libcrypto/Makefile.inc checking
for 'vzeroall' support.  This is not significant for installworld
as the lookup has a fallback (and hides its error) and only modifies CFLAGS,
thus it's not worth fixing.

PR:		212877
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-04-13 22:07:34 +00:00
Bryan Drewery
d5b29b60f8 Pass COMPILER_FEATURES down to submakes for installworld.
This is for WITH_SYSTEM_COMPILER, WITHOUT_CROSS_COMPILER, external
compiler, etc.

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-04-13 19:27:46 +00:00
Ed Maste
ffe63c8bf0 Introduce LLD_BOOTSTRAP to control lld as bootstrap linker
Add WITH_LLD_BOOTSTRAP and WITHOUT_LLD_BOOTSTRAP knobs, similar to the
Clang bootstrap knobs.

Reviewed by:	dim
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D10249
2017-04-09 01:35:19 +00:00
Ed Maste
1bf5e133cb do not require binutils port when using lld as ld
r279908 added logic to Makefile.inc1 to automatically set
CROSS_BINUTILS_PREFIX for architectures not supported by the in-tree
binutils: arm64 when first introduced, and later riscv64 as well.

LLVM's LLD linker is now included in the base system, and is enabled by
default for arm64 and capable of linking world and kernel. Thus, avoid
automatically setting CROSS_BINUTILS_PREFIX and requiring the binutils
port if WITH_LLD_IS_LD is true.

Reviewed by:	kan
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D10310
2017-04-07 23:37:22 +00:00
Bryan Drewery
dbbb03c244 META_MODE: Fix build-tools still sometimes rebuilding during target build.
In a cross-build, the build-tools are native host binaries.  We do not
want to rebuild them when building for the target.  Bmake previously
did not support checking .NOMETA on an existing target, so .NOMETA_CMP
was used here.  However, .NOMETA_CMP still triggers meta mode conditions
if the number of commands or the command changes.  In r312467 the paths
to build ncurses files were modified and thus triggered meta mode to
rebuild the build tools (make_keys, make_hash) in ncurses during the
target build.  Bmake 20160604 committed in r301462 changed .NOMETA to
also skip meta mode logic for an existing .meta file as well, thus it
is now the proper fix here.

I explored moving the build-tools output to WORLDTMP/tools with
relatively good success, but have concerns that doing so would be
problematic for downstream vendors who use LOCAL_TOOL_DIRS and
expect the tools to be in current OBJDIR for the target.  It also
adds more complexity into finding the tools during target build
and handling of where they are for rescue/rescue and
mkcsmapper_static/mkesdb_static which should really not be connected in
build-tools anyway.

MFC after:	2 weeks
Reported by:	many
Sponsored by:	Dell EMC Isilon
2017-04-06 18:21:59 +00:00
Bryan Drewery
3507006763 Rename _cc to _gcc to be more clear.
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-21 22:09:00 +00:00