Commit Graph

3238 Commits

Author SHA1 Message Date
Ed Maste
89257265fb Disable LLD_BOOTSTRAP under WITHOUT_CROSS_COMPILER
LLD is a cross toolchain component. It shouldn't be built when
requesting a build without building a cross compiler.

(CROSS_COMPILER is somewhat unfortunately named; in any case, lld
should be treated as GNU binutils here.)

Submitted by:	Dan McGregor <dan.mcgregor at usask.ca>
MFC after:	1 week
2018-03-07 17:33:41 +00:00
Bryan Drewery
743ab0187f Ignore MAKEOBJDIRPREFIX from src-env.conf in sub-makes.
A sub-make, such as in 'make buildworld', may want to override MAKEOBJDIRPREFIX
but is unable to do so if src-env.conf is forcing it to another value.  Without
using '?=' the sub-make may use the wrong .OBJDIR.

Reported by:	eadler
Sponsored by:	Dell EMC
2018-03-03 23:23:01 +00:00
Warner Losh
f86dd99686 Create LOADER_UBOOT, and LOADER_OFW. Move these options out of
Makefile.${MACHINE_ARCH} and remove the now-empty files. Generate the
*32 directories on the necessary architectures (well, currently only
amd64) on the fly. Remove LOADER_EFI variable and co-locate it with
EFI.

Differential Review: https://reviews.freebsd.org/D14546
2018-03-01 19:50:55 +00:00
Bryan Drewery
a12a1b473b Allow overriding .MAKE.MAKEFILE_PREFERENCE.
This will be utilized by Ports tools to avoid some extra
stat(2) calls.

MFC after:	3 days
2018-02-28 20:06:03 +00:00
Warner Losh
c1593b9ef2 Doc __DEFAULT_YES_OPTIONS, __DEFAULT_NO_OPTIONS and BROKEN_OPTIONS
in one paragraph to highlight the relationship between them.

Suggested by: kevans@
2018-02-27 17:36:01 +00:00
Warner Losh
9e74797f30 Move EFI up to common makefile. There's no need for all these .if's
based on architecture.

Sponsored by: Netflix
2018-02-27 17:35:29 +00:00
Alan Somers
b8f7774edf tests: require ksh93 in the Kyuafiles for all atf-ksh93 test programs 2018-02-24 15:13:20 +00:00
Bryan Drewery
fc287c10fb Fix installation with read-only OBJDIR.
Reported by:	npn
Sponsored by:	Dell EMC
2018-02-24 01:33:17 +00:00
Alan Somers
2fae26bd8b Add the ZFS test suite
It was originally written by Sun as part of the STF (Solaris test framework).
They open sourced it in OpenSolaris, then HighCloud partially ported it to
FreeBSD, and Spectra Logic finished the port.  We also added many testcases,
fixed many broken ones, and converted them all to the ATF framework.  We've had
help along the way from avg, araujo, smh, and brd.

By default most of the tests are disabled.  Set the disks Kyua variable to
enable them.

Submitted by:	asomers, will, justing, ken, brd, avg, araujo, smh
Sponsored by:	Spectra Logic Corp, HighCloud
2018-02-23 16:31:00 +00:00
Bryan Drewery
49a1108ae7 Move SVNVERSION_CMD into the one place that uses it.
This code, which is basically `svnversion || svnliteversion`, generates
2 fstatat(2) for every directory in PATH for every Makefile parsed that
includes bsd.own.mk.  This can add up for things like generating a Ports
index (Poudriere) or building a dependency graph for base.

Sponsored by:	Dell EMC
MFC after:	2 weeks
2018-02-20 21:48:16 +00:00
Warner Losh
fcdb1f0317 Eliminate bsd.stand.mk and -fPIC 32-bit intel builds
OK. We don't really need a bsd.stand.mk, and it was causing a -fPIC
for the toolchain to be added (bogusly) when building on amd64. Pull
all relevant defs back into defs.mk and delete bsd.stand.mk.

This saves about 15-20k on i386 loader and zfsloader which when
combined with Lua give us a lot more stack space in those constrained
environments.
2018-02-16 00:17:32 +00:00
Warner Losh
7cafeaa1fd Add Lua as a scripting langauge to /boot/loader
liblua glues the lua run time into the boot loader. It implements all
the runtime routines that lua expects. In addition, it has a few
standard 'C' headers that nueter various aspects of the LUA build that
are too specific to lua to be in libsa. Many refinements from the
original code to improve implementation and the number of included lua
libraries. Use int64_t for lua_Number. Have "/boot/lua" be the default
module path. Numerous cleanups from the original GSoC project,
including hacking libsa to allow lua to be built with only one change
outside luaconf.h.

Add the final bit of lua glue to bring in liblua and plug into the
multiple interpreter framework, previously committed.

Add LOADER_LUA option, currently off by default.

Presently, this is an experimental option. One must opt-in to using
this by defining WITH_LOADER_LUA and WITHOUT_FORTH. It's been
lightly tested, so keep a backup copy of your old loader handy.
The menu code, coming in the next commit, hasn't been exhaustively
tested. A LUA boot loader is 60k larger than a FORTH one, which is
80k larger than a no-interpreter one. Subtle changes in size
may tip things past some subtle limit (the binary is ~430k now
when built with LUA). A future version may offer coexistance.

Bump FreeBSD version to 1200058 to mark the milestone.

Pedro Souza's 2014 Summer of Code project. Rui Paulo, Pedro Arthur,
Zakary Nafziger and Wojciech A. Koszek also contributed. Warner Losh
reworked it extensively into its current form.

Obtained from: https://wiki.freebsd.org/SummerOfCode2014/LuaLoader
Sponsored by: Google Summer of Code
Relnotes: Yes
MFC After: 1 month
Differential Review: https://reviews.freebsd.org/D14295
2018-02-12 15:31:53 +00:00
Ed Maste
1b49115a40 Promote llvm-cov to a standalone option
Introduce WITH_/WITHOUT_LLVM_COV to match GCC's WITH_/WITHOUT_GCOV.
It is intended to provide a superset of the interface and functionality
of gcov.

It is enabled by default when building Clang, similarly to gcov and GCC.

This change moves one file in libllvm to be compiled unconditionally.
Previously it was included only when WITH_CLANG_EXTRAS was set, but the
complexity of a new special case for (CLANG_EXTRAS | LLVM_COV) is not
worth avoiding a tiny increase in build time.

Reviewed by:	dim, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D142645
2018-02-10 00:22:35 +00:00
Ed Maste
4816408016 add retpoline compiler and linker feature flags
These features indicate that the compiler and linker support the
retpoline speculative execution vulnerability (CVE-2017-5715)
mitigation.

Reviewed by:	dim, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D14228
2018-02-07 14:50:06 +00:00
Baptiste Daroussin
8134347f26 Remove libreadline from the source tree, all consumers but gdb
has been switched to libedit long ago, libreadline was built as an
internallib for a while and kept only for gdbtui which was broken using
libreadline.

Since gdb has been mostly deorbitted in all arches, gdbtui was only installed
on arm and sparc64, given it has been removed, gdb has been switched to use
libedit, no consumers are left for libreadline. Thus this removal
2018-02-06 12:22:42 +00:00
Alex Richardson
875b18b520 Revert r326375 since the warning has been turned off by default in clang
See https://reviews.llvm.org/D41512 and https://reviews.llvm.org/rL322901

Approved By:	brooks (mentor)

Differential Revision: https://reviews.freebsd.org/D14171
2018-02-02 22:09:36 +00:00
Kyle Evans
b37f6c9805 Add libregex, connect it to the build
libregex is a regex(3) implementation intended to feature GNU extensions and
any other non-POSIX compliant extensions that are deemed worthy.

These extensions are separated out into a separate library for the sake of
not cluttering up libc further with them as well as not deteriorating the
speed (or lack thereof) of the libc implementation.

libregex is implemented as a build of the libc implementation with LIBREGEX
defined to distinguish this from a libc build. The reasons for
implementation like this are two-fold:

1.) Maintenance- This reduces the overhead induced by adding yet another
regex implementation to base.

2.) Ease of use- Flipping on GNU extensions will be as simple as linking
against libregex, and POSIX-compliant compilations can be guaranteed with a
REG_POSIX cflag that should be ignored by libc/regex and disables extensions
in libregex. It is also easier to keep REG_POSIX sane and POSIX pure when
implemented in this fashion.

Tests are added for future functionality, but left disconnected for the time
being while other testing is done.

Reviewed by:	cem (previous version)
Differential Revision:	https://reviews.freebsd.org/D12934
2018-01-22 02:44:41 +00:00
Ed Maste
1383b97864 Revert r327823, Enable ld.lld as bootstrap linker by default on i386
There's a report of some regression in ports.  Revert for now for an
exp run for this change in isolation (previous lld exp run also included
switching the linker used for ports to lld).

Also revert the src.conf.5 regeneration in r327824.

Reported by:	antoine
Sponsored by:	The FreeBSD Foundation
2018-01-13 04:00:55 +00:00
Bryan Drewery
2e07e232a2 Add a hack to disable AUTO_OBJ for 'old style' kernel builds.
Another solution would be to extend the Makefile.sys.inc idea, or a .no_obj
file, to more places but I would rather keep that limited to the top-level
build for now to not impact performance (statting a file in every make call)
or to bring unintended side-effects.

Reported by:	jhb, imp
Sponsored by:	Dell EMC Isilon
2018-01-12 01:09:41 +00:00
Ed Maste
973c4efb9d Enable ld.lld as bootstrap linker by default on i386
Akin to r327783 for amd64.  lld has been usable for amd64 for quite some
time, but a couple of issues remained that affected i386.  These were
recently addressed upstream in lld and merged into FreeBSD (r326831,
r326879, r326897, r326957), so we can now use ld.lld on i386 as well.

Similarly to amd64 this change enables lld only as the bootstrap linker
(used to link the kernel and userland libraries and executables), while
GNU ld.bfd is still installed as /usr/bin/ld and used for ports builds.

The ports collection is essentially ready to use lld as the system
linker for amd64, but many ports still have trouble with lld on i386,
because lld defaults to -ztext, disallowing relocations against readonly
segments.  Thus switching the system linker (WITH_LLD_IS_LD) will happen
later on a per-arch basis.

Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
2018-01-11 14:03:05 +00:00
Ed Maste
93b7a1c153 Enable ld.lld as bootstrap linker by default on amd64
For some time we have been planning to migrate to LLVM's lld linker.
Having a man page was the last blocking issue for using ld.lld to link
the base system kernel + userland, now addressed by r327770.  Link the
kernel and userland libraries and binaries with ld.lld by default, for
additional test coverage.

This has been a long time in the making.  On 2013-04-13 I submitted an
upstream tracking issue in LLVM PR 23214: [META] Using LLD as FreeBSD's
system linker.  Since then 85 individual issues were identified, and
submitted as dependencies.  These have been addressed along with two
and a half years of other lld development and improvement.

I'd like to express deep gratitude to upstream lld developers Rui
Ueyama, Rafael Espindola, George Rimar and Davide Italiano.  They put in
substantial effort in addressing the issues we found affecting
FreeBSD/amd64.

To revert to using ld.bfd as the bootstrap linker, in /etc/src.conf set

    WITHOUT_LLD_BOOTSTRAP=yes

If you need to set this, please follow up with a PR or post to the
freebsd-toolchain mailing list explaining how default WITH_LLD_BOOTSTRAP
failed for your use case.

Note that GNU ld.bfd is still installed as /usr/bin/ld, and will still
be used for linking ports.  ld.lld can be installed as /usr/bin/ld by
setting in /etc/src.conf

    WITH_LLD_IS_LLD=yes

A followup commit will set WITH_LLD_IS_LD by default, possibly after
Clang/LLVM/lld 6.0 is merged to FreeBSD.

Release notes:	Yes
Sponsored by:	The FreeBSD Foundation
2018-01-10 20:28:01 +00:00
Dimitry Andric
dd5c0d9d4b Follow-up to r326375, by moving the block that disables errors on the
new clang 6.0.0 -Wtautological-constant-compare warning to the WARNS <=
6 level.  (This warning is still being worked on upstream to reduce
false positives, but it is currently still too trigger happy.)
2017-12-24 16:34:54 +00:00
Warner Losh
6e050ee62a Note GELI-enabled zfsboot issues have been solved. Flip the switch
back to enabling GELI in boot and loader builds.

Sponsored by: Netflix
2017-12-15 23:19:49 +00:00
Warner Losh
86375a7ea9 Turn loader GELI support in the boot loaders off by default as a
temporary workaround. This fixes zfs booting generally, but breaks all
GELI booting by default. Add note to UPDATING to this effect. When the
GELI issues are resolved, this will be reverted.
2017-12-14 17:00:24 +00:00
Bryan Drewery
8f2246242e Look for libraries in OBJDIR when building outside of buildworld.
This allows build testing more easily without establishing a sysroot
or installing the files.

Sponsored by:	Dell EMC
2017-12-07 16:37:19 +00:00
Bryan Drewery
b00a5bd558 AUTO_OBJ: Don't create nested OBJDIRS with print-dir or make -n.
Sponsored by:	Dell EMC
2017-12-06 21:00:41 +00:00
Bryan Drewery
154733e844 Deal with bmake-20170301 no longer resolving -C like it used to.
Several checks assume .CURDIR is resolved, such as for determining RELDIR from
SRCTOP/.CURDIR.  If -C is used then the path is no longer resolved like it was
before which is problematic for symlinked source trees.  A similar change was
also made to ports post bmake-20170301.

This fixes 'make -C <symlinked path> buildworld' using the wrong OBJDIR.

Reported by:	rstone
Sponsored by:	Dell EMC
2017-12-05 21:30:22 +00:00
Bryan Drewery
302bf4c180 Handle writable-but-not-a-directory cases for writable OBJDIR check.
Sponsored by:	Dell EMC
2017-12-05 21:30:17 +00:00
Bryan Drewery
e22224a5c2 AUTO_OBJ: For all top-level targets enforce using an OBJDIR.
This will cause an error if the wanted OBJDIR is not writable.  Previously it
would cause the files to generate to the source tree.  This was too obscure and
things like buildworld really expect a proper OBJDIR layout.

Sponsored by:	Dell EMC
2017-12-05 21:29:47 +00:00
Bryan Drewery
a854949ff1 Fix DPSRCS not getting .depend.* files.
Reported by:	jhb
MFC after:	2 weeks
Sponsored by:	Dell EMC
2017-12-05 02:23:33 +00:00
Bryan Drewery
649fed8e37 Allow Makefiles to append to DEPENDSRCS.
Sponsored by:	Dell EMC
2017-12-05 02:23:30 +00:00
Alex Richardson
97a4e58919 Don't fail the build due to clang integer constant range warnings
This warning checks whether a constant is out of range of the integer
type. An example is `comparison of 'u_int' > 4294967295 is always false`
and in this case the warning makes sense.
However, when the type is a typedef that can be either 64 or 32 bits the
if condition is only tautological in some configurations so this should
not be a warning that fails the build.

Reviewed by:	dim
Approved by:	jhb (mentor)
Differential Revision: https://reviews.freebsd.org/D12912
2017-11-29 21:16:14 +00:00
Pedro F. Giffuni
f0cfa1b168 share and pc-sysinstall: adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Commit these apart because compile testing doesn't guarantee I didn't made
some nasty mistake. No functional change intended.
2017-11-27 15:28:26 +00:00
Hans Petter Selasky
82725ba9bf Merge ^/head r325999 through r326131. 2017-11-23 14:28:14 +00:00
Warner Losh
ca50d6799d Add -mno-avx2 for clang as well as -mno-avx. We don't want either of
them when asking for no SIMD.

Reviewed by: emaste@
Sponsored by: Netflix
2017-11-20 22:41:22 +00:00
Hans Petter Selasky
937d37fc6c Merge ^/head r325842 through r325998. 2017-11-19 12:36:03 +00:00
Bryan Drewery
4a76893d57 Remove unneeded special case for .OBJDIR=.CURDIR.
The else statement is already handling this by ensuring a safe .OBJDIR is used.

Sponsored by:	Dell
2017-11-18 21:27:33 +00:00
Bryan Drewery
f70bac6449 Evaluate options after including src-env.conf and before Makefile.sys.inc.
Fixes top-level breakage in r325974.

Pointyhat to:	bdrewery
Sponsored by:	Dell
2017-11-18 20:10:36 +00:00
Bryan Drewery
7e0aabd961 Fix top-level targets with read-only OBJDIR.
This also makes it so that top-level build targets do not immediately create
the OBJDIR.  Only sub-make targets will do so.  This avoids creating object
directories for targets like 'make check-old' or creating unneeded
MACHINE.MACHINE_ARCH directories during 'make tinderbox'.

Reported by:	npn, lifanov
Tested by:	npn, Mark Millard
Sponsored by:	Dell
2017-11-18 20:01:15 +00:00
Bryan Drewery
f778955213 Include Makefile.sys.inc if possible for top-level only.
This will allow disabling some things like AUTO_OBJ early if not needed for the
directory/targets, without putting special logic into share/mk/*.sys.mk.

Sponsored by:	Dell
2017-11-18 20:01:09 +00:00
Warner Losh
1cbb58886a Remove build system support for lint.
Differential Revision: https://reviews.freebsd.org/D13124
2017-11-17 18:16:46 +00:00
Hans Petter Selasky
55b1c6e7e4 Merge ^/head r325663 through r325841. 2017-11-15 11:28:11 +00:00
Alex Richardson
ed617948c4 Remove -fuse-ld= when creating _LDFLAGS from LDFLAGS
The -fuse-ld flag is only meant to be passed to the compiler driver so
direct linker invocations should not include it.

Reviewed by:	emaste, jhb
Approved by:	jhb (mentor)
Differential Revision:	https://reviews.freebsd.org/D12910
2017-11-13 19:44:33 +00:00
Hans Petter Selasky
e110d0774b Fix OFED library dependencies.
Sponsored by:	Mellanox Technologies
2017-11-13 12:36:36 +00:00
Hans Petter Selasky
8dee9a7a44 Remove no longer supported mthca driver.
Sponsored by:	Mellanox Technologies
2017-11-13 10:59:38 +00:00
Mariusz Zaborski
7b4fce76cc Introduce syslog service for Casper.
syslog in libc secretly reconnects to the daemon.
Another issue is that we don't have any information from openlog(3) if we
succeeded to open log or not so we don't know if we are ready
to enter cabability mode.
Because all of that we decided we need a syslog service for Caspser.

Reviewed by:	bapt@
Differential Revision:	https://reviews.freebsd.org/D12824
2017-11-12 08:34:25 +00:00
Bryan Drewery
de2b0e0318 DIRDEPS_BUILD: Fix after r325417.
DIRDEPS_BUILD works just fine without defining __objdir or dealing with any of
this logic.  It handles its own TARGET_SPEC in local.meta.sys.mk as well.  Just
let it do its own thing.

Sponsored by:	Dell EMC Isilon
2017-11-11 01:11:00 +00:00
Bryan Drewery
5edf5dc29f Don't work out of a TARGET. directory if TARGET_ARCH is not defined.
This fixes 'TARGET=<target> make universe_kernels' creating an empty TARGET.
directory and showing it in SIGINFO.

Sponsored by:	Dell EMC Isilon
2017-11-11 01:10:55 +00:00
Bryan Drewery
f82493cc3a Handle MAKEOBJDIRPREFIX when already inside of .OBJDIR.
This can happen in obscure cases with things like the kernel build.

Sponsored by:	Dell EMC Isilon
2017-11-11 01:10:41 +00:00
Warner Losh
4728f534ff Move LOADER_{NO,}_GELI_SUPPORT to MK_LOADER_GELI
Transition to WITH/WITHOUT_LOADER_GELI to flag support or not of GELI
in the boot loaders. Add HAVE_GELI so components can flag they need
support (since it's too large to include everywhere). Add temporary
warnings for the old forms to ease transition.

Also, update test script to build without GELI on x86.

Sponsored by: Netflix
2017-11-10 23:54:48 +00:00
Warner Losh
a179cd9114 Replace LOADER_FIREWIRE_SUPPORT variable
Rename LOADER_FIREWIRE_SUPPORT to MK_LOADER_FIREWIRE. Only build
libfirewire when this is "yes". Add note to updating. Fix build script
to build this for x86 so the option doesn't decay. sparc64 supports
ZFS, so also build it MK_ZFS=no.

Sponsored by: Netflix
2017-11-10 23:54:41 +00:00
Bryan Drewery
42b16bca0c AUTO_OBJ: Don't create .OBJDIR with 'make -n'.
Sponsored by:	Dell EMC Isilon
2017-11-10 20:10:05 +00:00
Bryan Drewery
068306e969 Allow consuming Makefiles to add to DEPENDFILES.
Sponsored by:	Dell EMC Isilon
2017-11-10 20:09:11 +00:00
Bryan Drewery
4a398ab3dc No need to run 'make depend' with FAST_DEPEND logic in-tree.
Sponsored by:	Dell EMC Isilon
2017-11-10 19:53:17 +00:00
Bryan Drewery
4120775275 AUTO_OBJ: No need to tree-walk with 'make obj' here.
Sponsored by:	Dell EMC Isilon
2017-11-10 19:53:14 +00:00
Bryan Drewery
f633c2fcda Pass down any PROG-specific buildopts for forwarded targets.
This currently has no impact.

Sponsored by:	Dell EMC Isilon
2017-11-10 19:53:11 +00:00
Bryan Drewery
2f1b940805 Don't append TARGET.TARGET_ARCH if OBJTOP is already set.
This avoids flipping the expected TARGET.TARGET_ARCH suffix / OBJTOP when it is
already set by a parent make which wants to control it more such as in
something like 'make native-xtools'.

Sponsored by:	Dell EMC Isilon
2017-11-10 19:52:31 +00:00
Bryan Drewery
a2f16e5356 Add some missed OBJS_SRCS_FILTER from r323637.
Sponsored by:	Dell EMC Isilon
2017-11-10 08:00:09 +00:00
Bryan Drewery
ff87c77cac Add support for CRUNCH_LIBS_ for specifying a lib only for 1 prog.
Sponsored by:	Dell EMC Isilon
2017-11-10 07:52:46 +00:00
Bryan Drewery
fa65e3a53d Handle some .OBJDIR == .CURDIR cases.
- If OBJROOT is SRCTOP then don't add on TARGET.TARGET_ARCH.  This
  only happens at the top-level, and for sub-directories when the
  user is clever with MAKEOBJDIRPREFIX=/.
- Don't bother checking 'test -w' on .CURDIR.
- Properly set OBJTOP/OBJROOT to SRCTOP in various needed cases.
- Check if the OBJDIR is writable even for *clean* targets since it
  determines which .OBJDIR the user gets;  If they cannot write to an
  existing eligible .OBJDIR then it needs to clean in .CURDIR instead.
- Add guard to cleanworld/cleanuniverse from removing SRCTOP.
- Ensure OBJTOP is proper for .OBJDIR=.CURDIR which fixes finding
  libraries since src.libnames.mk is based on OBJTOP.
- Avoid some chdir(2) for modifying .OBJDIR

Sponsored by:	Dell EMC Isilon
2017-11-10 02:09:33 +00:00
Bryan Drewery
13ea077996 Mark targets .PHONY.
This avoids the obvious of not running the target when expected, but
also avoids META_MODE from showing 'Building'.  This is mostly only
a problem when directly including bsd.obj.mk as many of these targets
were already .PHONY via bsd.sys.mk.

Sponsored by:	Dell EMC Isilon
2017-11-09 22:08:07 +00:00
Bryan Drewery
2a8176cb61 META_MODE: Bmake 20171028 in r325340 simplifies the meta filename.
Now if the meta file is in the objdir, the objdir is stripped away
from the meta filename.

Sponsored by:	Dell EMC Isilon
2017-11-08 18:02:01 +00:00
Bryan Drewery
e1b7ce1fa0 AUTO_OBJ: Hide 'creating dirs' output with 'make -s'.
Reported by:	garga
Sponsored by:	Dell EMC Isilon
2017-11-08 16:03:58 +00:00
Bryan Drewery
502304ef16 Reenable AUTO_OBJ by default.
The problem with it was a bogus .OBJDIR in some cases where creation of
object directories were purposely not attempted, such as for 'make cleandir'
and in etc/ sub-directories.  In these cases bmake would start with a
bogus .OBJDIR like etc/ due to MAKEOBJDIR being a dynamic value based on
.CURDIR, SRCTOP, and OBJTOP.  OBJTOP would not yet be defined but is
during early src.sys.obj.mk.  That file and auto.obj.mk both were not
modifying .OBJDIR unless they expected to create the objdir.  Thus in
these cases the .OBJDIR was left as etc/* rather than fixed to the
proper .CURDIR.

The issues were fixed in r325404 and r325416.  An assertion to avoid the
bad .OBJDIR was added in r325405.

Sponsored by:	Dell EMC Isilon
2017-11-07 18:20:08 +00:00
Bryan Drewery
2f445a5314 Reapply r295227: Stop hiding link install commands.
This was lost in the release-pkg merge in r298107.

Sponsored by:	Dell EMC Isilon
2017-11-06 19:33:50 +00:00
Enji Cooper
c9c9774c70 Revert r325443
Despite the fact that it's a working solution, it doesn't follow the design
philosophy of only doing TARGET_* in Makefile.inc1 and special locations in
the source tree.

PR:		222925
Requested by:	imp
2017-11-05 20:01:00 +00:00
Enji Cooper
571e134eea Fix paths for cross-built versions of lib/libclang_rt and hardfloat arm variants
- Define TARGET_CPUARCH and use in libclang_rt as the basis for CRTARCH

  When cross-compiling, the wrong architecture was being embedded in the
  libclang_rt binary filenames. It should be based on TARGET_ARCH (target), not
  MACHINE_ARCH (host).

  If TARGET_ARCH isn't defined (host-builds), fallback to MACHINE_ARCH.

- Define CRTARCH to armhf when TARGET/TARGET_ARCH are set to arm/armv[67]

  TARGET_ABI/TARGET_CPU in Makefile.inc1 sets the ABI to gnueabihf, which
  affects the clang lookup path per `getArchNameForCompilerRTLib(..)` in
  contrib/llvm/tools/clang/lib/Driver/ToolChain.cpp, so chase clang and
  Linux's assumed naming convention for hard-float arm architectures.

  CROSSENV (in Makefile.inc1) sets CPUTYPE/MACHINE(_ARCH)? to the
  TARGET*-relevant values when building the `libraries` target, so test
  those variables instead.

- Add OLD_FILES/OLD_LIBS entries for TARGET/TARGET_ARCH == arm/armv[67]. This
  impacts only arm/armv6 and arm/armv7.

PR:	222925
2017-11-05 19:38:51 +00:00
Bryan Drewery
c6d98d62e2 Follow-up r325405: Fix assertion still for kernel module builds.
Apparently they have SRCTOP set, but won't have RELDIR set since they are
not in-tree.

Pointyhat to:	bdrewery
Reported by:	O. Hartmann <ohartmann@walstatt.org>, dhw
Tested by:	dhw
Sponsored by:	Dell EMC Isilon
2017-11-05 16:28:05 +00:00
Enji Cooper
cc5f0ba05b .S.ppico should omit ${_COV_FLAG}, not .S.pico 2017-11-05 05:08:16 +00:00
Enji Cooper
8e7d6bc8e3 Omit _COV_FLAG from PO_C(XX)FLAGS and from .S.ppico static targets 2017-11-05 04:28:05 +00:00
Enji Cooper
254d2760ce MFhead@r325422 2017-11-05 04:08:00 +00:00
Bryan Drewery
b91ed584d4 Avoid trying to remove a fullpath directory in CLEANDIRS.
Let CLEANDIRS work relative since make is already in .OBJDIR.

MFC after:	2 weeks
X-MFC-With:	r322511
Sponsored by:	Dell EMC Isilon
2017-11-05 00:26:28 +00:00
Bryan Drewery
b284f32266 AUTO_OBJ: Allow 'make cleandir obj all' combinations.
The cleanobj target will not really remove the OBJDIR in this case,
it will only remove the OBJDIR if only clean targets are ran.

Sponsored by:	Dell EMC Isilon
2017-11-05 00:12:12 +00:00
Bryan Drewery
3407406588 Set the expected __objdir for auto.obj.mk to try.
This avoids some future discrepency that might cause auto.obj.mk to use the
wrong OBJDIR.

Sponsored by:	Dell EMC Isilon
2017-11-05 00:12:09 +00:00
Bryan Drewery
00428a515c Always try to set .OBJDIR, even if AUTO_OBJ is enabled, and fallback to .CURDIR.
When AUTO_OBJ is enabled this change becomes redundant with the auto.obj.mk
check added in r325404.  However, it is possible that new code is added
at some point between src.sys.obj.mk and auto.obj.mk that disables AUTO_OBJ.
That could leave make with a bogus and unsafe .OBJDIR in some cases.

Sponsored by:	Dell EMC Isilon
2017-11-05 00:12:05 +00:00
Bryan Drewery
dea21cf465 Validate MAKEOBJDIR after the MAKEOBJDIRPREFIX override.
Sponsored by:	Dell EMC Isilon
2017-11-05 00:12:02 +00:00
Bryan Drewery
aba77ddd8a AUTO_OBJ: Set .OBJDIR=.CURDIR earlier for NO_OBJ Makefiles.
auto.obj.mk is loaded before the Makefile which may have NO_OBJ set inside of
it.  In that case we can't avoid creating the OBJDIR but we do need to avoid
using it.  Fixing .OBJDIR in bsd.init.mk at least fixes all of the build .mk
files to have a proper .OBJDIR.  It does not fix the Makefile itself but
usually if they have NO_OBJ set they are not inspecting ${.OBJDIR} anyhow.

It is ideal to only have this in bsd.init.mk and to remove it from bsd.obj.mk,
but then bsd.obj.mk would need to include bsd.init.mk.  Doing something like
that would require more testing.  It has been proposed that bsd.obj.mk not be
included directly but it has been possible for too long to do so to change it
at this point.

Note too that it may make sense to fix .OBJDIR even when AUTO_OBJ is not
enabled but the historical behavior has always been that NO_OBJ just avoids
running 'make obj', so .OBJDIR should already be .CURDIR.

Also while NO_OBJ seems like it should be removed at this point, it is not
always possible to fix Makefiles to properly use an .OBJDIR.  The cost of
keeping NO_OBJ support is minimal.

Sponsored by:	Dell EMC Isilon
2017-11-05 00:11:58 +00:00
Bryan Drewery
d949e92a9c Follow-up r325405: Only enable assertion for in-tree src builds.
Pointyhat to:	bdrewery
Reported by:	O. Hartmann <ohartmann@walstatt.org>
Sponsored by:	Dell EMC Isilon
2017-11-04 21:59:54 +00:00
Bryan Drewery
914a5ffcbd AUTO_OBJ: Revert r325351 now that the fix is in auto.obj.mk in r325404.
Forcing MK_AUTO_OBJ to no is not really needed since bsd.obj.mk is protected
against 'rm -rf ${.CURDIR}' already.  It was also flawed as if MK_AUTO_OBJ=yes
was in the .MAKEOVERRIDES already then it just remained on.

Sponsored by:	Dell EMC Isilon
2017-11-04 21:06:39 +00:00
Bryan Drewery
968be8a7a0 Add an assertion to avoid the 'rm -rf /etc' case from cleanobj fixed in r325404.
Sponsored by:	Dell EMC Isilon
2017-11-04 21:05:03 +00:00
Simon J. Gerraty
5abdb50e57 Ensure .OBJDIR has known value
If for any reason we cannot set .OBJDIR==_objdir as desired
use .CURDIR so that at least the classic
.if ${.OBJDIR} != ${.CURDIR}
works and dangerous misstakes can be avoided.

Reviewed by: bdrewery
2017-11-04 21:02:26 +00:00
Enji Cooper
f6e116eea9 MFhead@r325383 2017-11-04 07:05:21 +00:00
Bryan Drewery
40a54c51c9 AUTO_OBJ: If the wanted .OBJDIR was not used then disable the feature.
This is to prevent downstream checks from assuming they can trust .OBJDIR when
MK_AUTO_OBJ is yes, such as the bsd.obj.mk checks.

Pointyhat to:	bdrewery
Sponsored by:	Dell EMC Isilon
2017-11-03 01:09:35 +00:00
Bryan Drewery
5fecb1f1d6 AUTO_OBJ is unsafe at the moment as it is for some reason removing /etc with _cleanobj. 2017-11-02 23:00:04 +00:00
Bryan Drewery
89bd07e927 DIRDEPS_BUILD: Cleanup leftover WORLDTMP files.
This will force any existing objects to rebuild if their .meta
files reference files from WORLDTMP.  This is a problem after
the UNIFIED_OBJDIR effort caused buildworld and DIRDEPS_BUILD
to share an OBJDIR.  Without cleaning these files the
Makefile.depend files end up with odd tmp/legacy/... entries
since some bootstrap-tools linger from there and otherwise
don't rebuild.  Removing the files causes anything having
used WORLDTMP to rebuild.

Sponsored by:	Dell EMC Isilon
2017-11-02 20:45:04 +00:00
Bryan Drewery
615a1e70b0 Enable AUTO_OBJ by default if the OBJDIR is writable, only for in-tree builds.
This can be disabled by putting WITHOUT_AUTO_OBJ=yes in /etc/src-env.conf, not
/etc/src.conf, or passing it in the environment.

The purpose of this rather than simply flipping the default of AUTO_OBJ to yes
is to avoid hassling users with auto.obj.mk failures if the wanted OBJDIR is
not writable. It will fallback to writing to the source directory like it does
today if MAKEOBJDIRPREFIX is not writable.

The act of enabling MK_AUTO_OBJ disables all 'make obj' treewalks since
previous work has made those not run if MK_AUTO_OBJ==yes in Makefile.inc1.

Relnotes:	yes
Reviewed by:	sjg
Discussed at:	https://lists.freebsd.org/pipermail/freebsd-arch/2016-May/017805.html
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D12841
2017-11-02 18:09:07 +00:00
Bryan Drewery
fbb74b0ee7 Don't propagate MAKEOBJDIRPREFIX changes to environment.
A makefile may use this variable later for its own reasons,
don't infect sub-makes with that value.

Sponsored by:	Dell EMC Isilon
2017-11-02 04:05:03 +00:00
Bryan Drewery
718edb1577 META_MODE: Respect make -s.
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-11-01 21:22:19 +00:00
Bryan Drewery
f8b15066f2 make obj: Skip treewalk if AUTO_OBJ is enabled.
Sponsored by:	Dell EMC Isilon
2017-11-01 21:22:16 +00:00
Bryan Drewery
dfa099890c Add option UNIFIED_OBJDIR, on by default, which moves the default build OBJDIR.
This changes the build OBJDIR from the older style of /usr/obj/<srcdir> for
native builds, and /usr/obj/<target>.<target_arch>/<srcdir> for cross builds to
a new simpler format of /usr/obj/<srcdir>/<target>.<target_arch>.  This
new format is used regardless of cross or native build.  It allows
easier management of multiple source tree object directories.

The UNIFIED_OBJDIR option will be removed and its feature made permanent
for the 12.0 release.

Relnotes:	yes (don't note UNIFIED_OBJDIR option since it will be removed)
Prior work:	D3711 D874
Reviewed by:	gjb, sjg
Discussed at:	https://lists.freebsd.org/pipermail/freebsd-arch/2016-May/017805.html
Discussed with:	emaste
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D12840
2017-11-01 21:22:05 +00:00
Enji Cooper
b9a2bf88a3 Checkpoint work to integrate coverage and make check together 2017-10-31 07:16:18 +00:00
Enji Cooper
7c008e4270 Add MK_MAKE_CHECK_WITH_COVERAGE, reliant on MK_COVERAGE and MK_MAKE_CHECK_USE_SANDBOX 2017-10-31 06:16:40 +00:00
Enji Cooper
75aaeb57f6 Don't override MK_COVERAGE from bsd.opts.mk in the CLANG_IS_CC case 2017-10-31 03:14:35 +00:00
Enji Cooper
1633af78ab Shuffle MK_COVERAGE conditionals around 2017-10-31 02:52:59 +00:00
Enji Cooper
076777cc29 MFhead@r325199 2017-10-31 02:46:36 +00:00
Bryan Drewery
bec340c8f8 This check is not ready here yet.
Keeping for blame purposes, it will be enabled soon.
2017-10-31 02:25:47 +00:00
Bryan Drewery
32e7d9d0d9 AUTO_OBJ can work for crunchgen build-tools.
Sponsored by:	Dell EMC Isilon
2017-10-31 02:12:13 +00:00
Bryan Drewery
579deb45c1 Disable MK_AUTO_OBJ as a make argument like r325078.
This avoids needlessly trying to enable it opportunistically.

Sponsored by:	Dell EMC Isilon
2017-10-31 02:12:09 +00:00
Bryan Drewery
0dd60f15a5 Move some objdir handling (OBJROOT/OBJTOP) out of DIRDEPS_BUILD-only files.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:26:42 +00:00
Bryan Drewery
95137b228e Add RELOBJTOP and RELSRCTOP for relative paths.
RELSRCTOP is likely not as useful since make will always be running from
inside of .OBJDIR and using something like ${.CURDIR}/${RELSRCTOP} is
not redundant for ${SRCTOP}.

Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:41 +00:00
Bryan Drewery
a160cbfa07 DIRDEPS_BUILD: libgcc now depends on MK_LLVM_LIBUNWIND
The dependency on gnu/lib/libgcc or lib/libgcc* is determined
at 'make dirdeps' time.

Sponsored by:	Dell EMC Isilon
2017-10-31 00:03:36 +00:00
Bryan Drewery
83f4f35130 Follow-up r320149: Enable GPL_DTC if we're using GCC as the cross-compiler.
This fixes object files landing in the source tree in gnu/usr.bin/dtc
for GCC platforms.

We cannot reliably detect if an external compiler is used here, and the
default YES option does include GCC_BOOTSTRAP which implies that GCC may
be used for the build.

The problem manifests when not using an external compiler, and the host
compiler is clang.  When a fresh build is done (no OBJDIR yet) the
'make obj' treewalk is done before 'make cross-tools', so
COMPILER_FEATURES at this point contains 'c++11' since the host compiler
was used for COMPILER_FEATURES.  Once cross-tools builds the GCC
bootstrap compiler and then descends into 'make everything',
COMPILER_FEATURES no longer contains 'c++11' and MK_GPL_DTC defaults to
enabled.  Now it builds in gnu/usr.bin/dtc without an OBJDIR preset and
drops files into the source tree.

The COMPILER_FEATURES check here is useful for knowing if we can *bootstrap*
C++11 things.  Indeed we do bootstrap dtc as a build tool so it is
useful for enabling the BSD dtc for the build, but we end up needing the
GPL dtc for installation anyway.

Reviewed by:	manu, emaste
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D12817
2017-10-31 00:03:32 +00:00
Enji Cooper
3b25158cf8 Throwing something else at the wall, seeing if it will stick 2017-10-30 10:08:53 +00:00
Enji Cooper
bbc1fc6664 Let's see if the dependent relationship between MK_COVERAGE and MK_DEBUG_FILES
I added is the source of my knob grief
2017-10-30 09:24:20 +00:00
Enji Cooper
77611dcbd2 Sort for consistency with bsd.prog.mk 2017-10-30 09:21:56 +00:00
Enji Cooper
547553fe72 Remove redundant DEFAULT_NO_OPTIONS specification for MK_COVERAGE
bsd.opts.mk is already handling it
2017-10-30 09:19:28 +00:00
Enji Cooper
3c5ab8c1cc MFhead@r325119 2017-10-30 05:52:26 +00:00
Bryan Drewery
49c9ea8fe5 AUTO_OBJ: auto.obj.mk mkdir -p simplification
Sponsored by:	Dell EMC Isilon
2017-10-29 01:21:36 +00:00
Bryan Drewery
d3e478c4c3 MAKEOBJDIR should be an absolute path, not any path with a slash.
Using MAKEOBJDIR=foo did not work but MAKEOBJDIR=foo/ did, but
really it needs to be absolute.

Sponsored by:	Dell EMC Isilon
2017-10-29 01:21:12 +00:00
Enji Cooper
5ff880dc0f MFhead@r325004 2017-10-26 03:34:17 +00:00
Ruslan Bukin
d27927f731 Extract a set of pmcstat functions and interfaces to the new internal
library -- libpmcstat.

This includes PMC logging module, symbols lookup functions,
ELF parsing, process management, PMC attachment, etc.

This allows to reuse code while building new hwpmc(4)-based applications.

Also add pmcstat_symbol_search_by_name() function that allows to find
mapped IP range for a given function name.

Reviewed by:	kib
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D12718
2017-10-24 16:28:00 +00:00
Enji Cooper
532979fa28 Don't require ${DESTDIR}${_gcno_dir} until install 2017-10-23 16:50:33 +00:00
Enji Cooper
0ab79c3cc3 Move MK_COVERAGE fu before .include <bsd.mkopt.mk> so it's actually usable 2017-10-23 16:02:05 +00:00
Enji Cooper
7785423900 MFhead@r324914
Once more on to the MFC, my dear friends
2017-10-23 08:06:57 +00:00
Enji Cooper
dc404c7302 Fix tabs before the style police nags me 2017-10-23 08:04:56 +00:00
Enji Cooper
eb5c1cb298 Every day I'm shuffling (comments) to diff reduce 2017-10-23 08:03:59 +00:00
Enji Cooper
2e5ab5865f In the search of a perfect knob pairing
Why in the heck is it so dang complicated now?
2017-10-23 08:02:03 +00:00
Enji Cooper
0c095a65a1 Fix an omission in a comment
Soft float API support applies to armv7 too after r324340
2017-10-23 07:56:56 +00:00
Enji Cooper
e48a1f9cee Congrats riscv* : you unlike millions of americans will have coverage, even
if the ACA is repealed
2017-10-23 07:52:16 +00:00
Enji Cooper
45c85b6113 Die. Die. Die. Tinderbox failures on mips/powerpc 2017-10-23 07:30:52 +00:00
Enji Cooper
6f2b0ca7ac mips, you cause me too much grief with make tinderbox. Try this instead 2017-10-23 07:07:44 +00:00
Enji Cooper
171e4ce895 Use BROKEN_OPTIONS for MK_COVERAGE=no so it will be documented in src.conf(5) 2017-10-23 06:31:00 +00:00
Enji Cooper
2d19fcb30e Let's just nip gcc 4.2.1 in the bud and say MK_COVERAGE=no
Reasoning: gcc 4.2.1 lacks -fprofile-dir support
2017-10-23 05:36:39 +00:00
Enji Cooper
1375d29aad Fix typo in previous commit
My brain was remembering the spelling of the C++ variable, not the option.
2017-10-23 05:26:21 +00:00
Enji Cooper
6da44d7324 Use -fprofile_dir=${COVERAGEDIR} with --coverage
This option implies that it will automatically prefix .gcda files, when
created, thus allowing for the desired prefixing I've added in via bsd.cov.mk .

This option is only available in clang and later versions of gcc, so I'll
likely have to mark MK_COVERAGE broken from a "fully-fledged feature"
perspective, as I don't want to go through the annoyance of implementing the
feature in gcc and testing it.
2017-10-23 05:19:40 +00:00
Enji Cooper
88d87eb638 Handle host builds
If TARGET_ARCH isn't defined, fallback to MACHINE_ARCH.

This is a followup to r324873.

PR:		222925
2017-10-23 04:20:11 +00:00
Enji Cooper
b28b665cbe Need to make all of the variables immediate, or the last value for _gcno_dir wins
This is particularly fun when relative paths are embedded in SRCS, like
lib/libclang_rt does (which I argue is ripe for corruption via parallel
builds).
2017-10-23 00:56:59 +00:00
Enji Cooper
2d457ca3c7 Restore gcc 4.8 version check
I accidentally broke it when making changes
2017-10-22 23:36:43 +00:00
Enji Cooper
875ad66bca Remove BROKEN_OPTIONS/MK_COVERAGE=no for gcc cross-toolchain reliant archs
The cross-toolchain gcc toolchains aren't installing libgcov.a, but the host
toolchain variants are. Don't hack around broken packages in the base system.

PR:		223174
2017-10-22 21:39:58 +00:00
Enji Cooper
69735ece08 Define TARGET_CPUARCH and use in libclang_rt as the basis for CRTARCH
When cross-compiling, the wrong architecture was being embedded in the
libclang_rt binary filenames. It should be based on TARGET_ARCH (target), not
MACHINE_ARCH (host).

This is a draft commit against my project branch. Will fix on ^/head soon.

PR:	222925
2017-10-22 21:34:37 +00:00
Enji Cooper
48c54cbc90 Create GCNOS directories at install time if needed
Add GCNOS{GRP,MODE,OWN} for parity with FILES{GRP,MODE,OWN}. The defaults are
based on BIN{GRP,MODE,OWN}.

GCNOSDIRMODE is added, strictly for configurability, if need be.
2017-10-22 21:00:59 +00:00
Enji Cooper
66d0c18afc Only try handling mutating GCNOS if SRCS is not empty
This should cure the logspam in certain directory about SRCS:M not evaluating
properly, e.g., etc/
2017-10-22 11:45:51 +00:00
Enji Cooper
174694331c Do direct comparisons with TARGET for armv6/armv7
This simplifies the conditionals
2017-10-22 11:21:31 +00:00
Enji Cooper
051c9c6839 It _was_ .gcno's, not .gcda's that get produced with cc --coverage
Try to install them instead of the .gcda's, since the .gcda's likely won't exist.

TODO: verify that installworld does indeed do the right thing.

Ref: gcc(1) -ftest-coverage description; --coverage (option in use) is an alias
     for -fprofile-arcs -ftest-coverage
2017-10-22 07:12:55 +00:00
Enji Cooper
71ae7bc6a2 Have to evaluate GCDAS immediately b/c I .undef'ed the _GCDAS_SRCS var later.
Otherwise GCDAS will be empty. Womp womp.
2017-10-22 00:10:18 +00:00
Enji Cooper
0a8f81bc28 MFhead@r324837
While here, diff reduce some of the changes in sys/boot by moving
MK_COVERAGE=no to sys/boot/Makefile.inc .
2017-10-21 23:40:52 +00:00
Enji Cooper
cfe42233f8 Fix typo in prior commit with stray colon after :M 2017-10-21 23:37:41 +00:00
Enji Cooper
b0c7b002ca Mark MK_COVERAGE broken for arm64/arm* 2017-10-21 23:27:20 +00:00
Jonathan Anderson
4f2fac3759 Improve computation of {BC,LL}OBJS.
Now that OBJS has grown an OBJS_SRCS_FILTER variable, use this variable
in the computation of BCOBJS and LLOBJS too. Also move BCOBJS and LLOBJS
computation to be next to the OBJS computation: this should both make
the parallel structure clearer and serve to remind people changing OBJS
that parallel changes are required in BCOBJS and LLOBJS.

A side effect of this change is that BCOBJS and LLOBJS will be available
even when LLVM_LINK has not been defined, but that seems like a positive
change: there's no reason we can't ask "what bitcode files would you
generate" just because we can't link those files together into a
complete bitcode representation of a binary or library.

Reviewed by:	sjg
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D12701
2017-10-18 00:33:20 +00:00
Jonathan Anderson
6f6b66a827 Improve logic of CLEANFILES+=${PROG_FULL}.{bc,ll}.
The build rule describing how to create ${PROG_FULL}.{bc,ll} is only
dependent on LLVM_LINK being defined, not on MK_DEBUG_FILES being "yes".
Move the addition of ${PROG_FULL}.{bc,ll} out of the conditional block
under `.if ${MK_DEBUG_FILES} != "no"` and up next to where the build
rules for ${PROG_FULL}.{bc,ll} are defined.

Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D12703
2017-10-18 00:30:15 +00:00
Jonathan Anderson
fd8103ed43 Add LLVM IR libraries to CLEANFILES.
We previously taught the build system how to create files like libfoo.bc,
but neglected to teach it about cleaning such files up. Rectify this now.

MFC after:	1 week
Sponsored by:	DARPA, AFRL
2017-10-17 16:29:50 +00:00
Enji Cooper
98be998591 Add appropriate safety belts for riscv so it compiles out of the box when MK_COVERAGE ==yes 2017-10-10 08:07:05 +00:00
Enji Cooper
50896984cd MFhead@r324482 2017-10-10 06:26:12 +00:00
Enji Cooper
aefcb745d8 Per r324481, remove MK_COVERAGE_SUPPORT 2017-10-10 06:20:55 +00:00
Warner Losh
c8550231ef Disconnect libstand from the build.
Remove libstand from the src/lib build. Remove LIBSTAND from
bsd.libnames.mk. Add affected files to the obsolete files list.

Sponsored by: Netflix
2017-10-09 22:12:57 +00:00
Enji Cooper
01f06122f9 Add MK_COVERAGE_SUPPORT
This is being done for reasons parallel to MK_TESTS_SUPPORT's addition in
^/head@r273449

Unlike ^/head@r273449 though, we do want binaries to be built with coverage
support in the libraries phase, but not in the cross-tools phase.
2017-10-09 01:17:12 +00:00
Jeremie Le Hen
e415aa2846 Remove rcmds.
If they are still needed, you can find them in the net/bsdrcmds port.

This was proposed June, 20th and approved by various committers [1].
They have been marked as deprecated on CURRENT in r320644 [2] on July, 4th.
Both stable/11 and release/11.1 contain the deprecation notice (thanks to
allanjude@).

Note that ruptime(1)/rwho(1)/rwhod(8) were initially thought to be part of
rcmds but this was a mistake and those are therefore NOT removed.

[1] https://lists.freebsd.org/pipermail/freebsd-arch/2017-June/018239.html
[2] https://svnweb.freebsd.org/base?view=revision&revision=320644

Reviewed by:	bapt, brooks
Differential Revision:	https://reviews.freebsd.org/D12573
2017-10-06 08:43:14 +00:00
Warner Losh
0b972ac92e Support armv7 builds for userland
Make armv7 as a new MACHINE_ARCH.

Copy all the places we do armv6 and add armv7 as basically an
alias. clang appears to generate code for armv7 by default. armv7 hard
float isn't supported by the the in-tree gcc, so it hasn't been
updated to have a new default.

Support armv7 as a new valid MACHINE_ARCH (and by extension
TARGET_ARCH).

Add armv7 to the universe build.

Differential Revision: https://reviews.freebsd.org/D12010
2017-10-05 23:01:33 +00:00
Enji Cooper
e31df75228 Fix .gcda to .pico (bsd.lib.mk) and .o (bsd.prog.mk) dependency mapping
The logic wasn't using a filtered version of SRCS -- it was using the
unfiltered version. This was causing some hilarity with unnecessary
dependencies, like headers and the like in lib/libc/... .

Also use .pico with bsd.lib.mk, not .o -- .o doesn't use SHARED_C*FLAGS,
which doesn't contain _COV_FLAG, which means that the .gcda's would have
relied on objects that didn't build them as a side-effect.
2017-10-05 07:10:28 +00:00
Andriy Voskoboinyk
9e63610e82 Mark libifconfig as private library in src.libnames.mk (completes r305700) 2017-10-01 12:54:40 +00:00
Enji Cooper
13bd47158e Use a pattern for GCDAS that actually works 2017-10-01 05:25:55 +00:00
Enji Cooper
25311a8015 Use a simpler pattern than what I used in r324150 2017-10-01 05:16:19 +00:00
Enji Cooper
d1335b630e Make the dependency relationship between .gcda and .o files explicit 2017-10-01 02:39:07 +00:00
Enji Cooper
d5db4328ad MFhead@r324148 2017-10-01 02:28:16 +00:00
Wojciech Macek
76541eb0a7 Compile loader as Little-Endian on PPC64/POWER8
Add flag to the makefile to allow loader compilation as
  Little-Endian 32-bit executable.
  Usage:

  make WITH_LOADER_FORCE_LE=yes -C sys/boot all

Submitted by:          Wojciech Macek <wma@freebsd.org>
Reviewed by:           imp, nwhitehorn
Obtained from:         Semihalf
Sponsored by:          QCM Technologies
Differential revision: https://reviews.freebsd.org/D12421
2017-09-29 06:36:19 +00:00
Enji Cooper
1bf78a6fe1 Unbreak pic library link/compilation when MK_COVERAGE == no
Use a separate variable (PIC_OBJS) for the objects that should be in a
pic-enabled static library.

This unbreaks libexec/rtld-elf compilation when MK_COVERAGE == no.
2017-09-24 20:16:38 +00:00
Enji Cooper
1207267e5c MFhead@r323974 2017-09-24 19:48:46 +00:00
Enji Cooper
95a55bd8cd Fix logic errors and simplify installation process
.gcda files should be installed, not .gcno files. It's easier to
formulate which .gcda's to install based on the SRCS and their
extension in bsd.{lib,prog}.mk .
2017-09-17 03:08:00 +00:00
Enji Cooper
b78bcbac59 MFhead@r323646 2017-09-16 16:37:18 +00:00
Simon J. Gerraty
2506d70010 Use OBJS_SRCS_FILTER to control setting OBJS from SRCS
Some makefiles do reachover builds.
In some cases it is convenient to list subdirs of the distribution
in SRCS.

It is not very convenient, or always even desirable to have corresponding
subdirs in .OBJDIR, so OBJS_SRCS_FILTER allows the makefile to choose.
The default value 'R' matches existing practice.

But a makefile can set OBJS_SRCS_FILTER= T (the R gets added by
bsd.init.mk) to avoid the need for subdirs in .OBJDIR

Differential Revision:	https://reviews.freebsd.org/D12218
Reviewed by:	bdrewery
2017-09-16 05:42:27 +00:00
Enji Cooper
8fcbcc2d74 MFhead@r323635 2017-09-16 03:54:20 +00:00
Kyle Evans
bf51ff5670 bsdgrep: disable TRE implementation by default
Start the phasing out of TRE by disabling it by default. r317254 introduced
a BSD_GREP_FASTMATCH knob (defaulting to on) for testing of bsdgrep with and
without TRE enabled. More bugs have cropped up since then, and
WITHOUT_BSD_GREP_FASTMATCH has shown in testing to be more stable than its
counterpart.

Approved by:	emaste (mentor)
Differential Revision:	https://reviews.freebsd.org/D12381
2017-09-15 15:57:15 +00:00
Ryan Libby
edaa206d08 gcc builds: reenable -Wstrict-overflow for bsd.sys.mk
This effectively reverts r304877, after having relegated the warning
suppression to the zic(8) makefile in r323572.

Reviewed by:	emaste
Sponsored by:	Dell EMC Isilon
X-Differential Revision:	https://reviews.freebsd.org/D12284
2017-09-14 03:41:49 +00:00
Enji Cooper
bed74aeeaf Chase recent changes to ^/head/share/mk/bsd.lib.mk
Doesn't compile with libexec/rtld-elf when WITH_LIB32 == yes for some
reason.. but it's a WiP.
2017-09-11 19:57:04 +00:00
Enji Cooper
5be4ad9e80 MFhead@r323343 2017-09-09 05:42:23 +00:00
Bryan Drewery
5179958a28 Tweak comment for install -S usage since it does not impact the build.
The -S flag is currently ignored for builds since we filter through
tools/install.sh that is intended for both non-root and cross-builds.

Sponsored by:	Dell EMC Isilon
X-MFC-With:	r322565
2017-09-08 19:20:42 +00:00
Enji Cooper
9a1f7ce50c Revert change (r322952) that was not yet destined for ^/head
This unbreaks the build.

This happened because of a botched "svn switch".

Reported by:	cem
2017-08-27 17:08:08 +00:00
Enji Cooper
b5197de15e Try and rebase the bsd.lib.mk changes after ^/head@r322824 was merged in
Unfortunately the snippet's now broken -- need to get the matching expressions to
work properly.
2017-08-27 16:46:51 +00:00
Enji Cooper
1be4c195db MFhead@r322870 2017-08-25 02:48:31 +00:00
John Baldwin
de6feefdb7 Improve the coverage of debug symbols for MK_DEBUG_FILES.
- Include debug symbols in static libraries.  This permits binaries
  to include debug symbols for functions obtained from static libraries.
- Permit the C/C++ compiler flags added for MK_DEBUG_FILES to be
  overridden by setting DEBUG_FILES_CFLAGS.  Use this to limit the debug
  information for llvm libraries and binaries.

Reviewed by:	emaste
Sponsored by:	DARPA / AFRL
Differential Revision:	https://reviews.freebsd.org/D12025
2017-08-23 23:30:25 +00:00
Enji Cooper
9efc32ad99 Only populate GCNOS if running clean or install targets 2017-08-23 03:54:34 +00:00
Enji Cooper
1a2361e50e Need to account for SRCS that don't get compiled with --coverage, e.g., .S files 2017-08-20 07:06:13 +00:00
Enji Cooper
0623f2fd61 Don't grok SOBJS directly -- only refer to the .pico files 2017-08-19 19:06:40 +00:00
Enji Cooper
de9c083936 Apparently SOBJS, etc, can have duplicates 2017-08-19 18:57:43 +00:00
Enji Cooper
e3b52b5eac Don't override COVERAGEDIR in bsd.own.mk 2017-08-19 18:52:43 +00:00
Enji Cooper
1ed13d2ea8 Use proper spelling for the directory variable
It's GCNOSDIR_foo:T, not GCNOS_foo:TDIR.
2017-08-19 18:52:13 +00:00
Enji Cooper
66e5cab5c0 Complete bsd.cov.mk integration
Pass through appropriate objects via COV_OBJS in bsd.lib.mk (based on
SOBJS), and appropriate objects via bsd.prog.mk (OBJS).

While here, do more intelligent things in terms of iterating over COV_OBJS,
building lists of items to install with the GCNOS variable/adding GCNOS to
FILESGROUPS, etc. This reduces the 2 unrolled .for loops into 1.
2017-08-19 18:31:00 +00:00
Enji Cooper
a451e71162 MFhead@r322675 2017-08-18 21:37:26 +00:00
Enji Cooper
611dfac360 - Only pass --coverage if NO_SHARED != yes (it doesn't work with static
libraries).
- Fix typo (${PROGNAME}.full should be ${PROG_FULL} -- this fixes installing
  usr.sbin/xinstall).
- Pass through appropriate sentinel for determining whether or not the program
  should be compiled with debug symbols, and hence whether or not --coverage
  should be enabled.
2017-08-17 20:10:30 +00:00
Enji Cooper
2e9742c123 Handle .ppico suffixed shared object files 2017-08-17 20:05:27 +00:00
Enji Cooper
d2258f7071 Fix libc_pic.a
In order to support coverage binaries and non-coverage binaries with libraries,
separate libraries need to be created which don't have coverage symbols (and
dependent symbols on libc) in them. libc_pic.a for instance will not link with
binaries if it's compiled with --coverage.

This allows buildworld to complete, minus rtld-elf -- it's a special snowflake
that needs to be resolved with a solution that I don't yet possess.
2017-08-17 20:04:17 +00:00
Bryan Drewery
96dd05dd7d Quote ${MAKE} when passing in env in case it contains spaces.
Downstream we are wrapping MAKE with a limits(1) call which
interferes with these non-quoted cases.

Sponsored by:	Dell EMC Isilon
2017-08-16 17:54:24 +00:00
Bryan Drewery
04594feee5 Use -S for library installations except for -DNO_ROOT builds.
Also disable this if NO_SAFE_LIBINSTALL is defined.

There is little harm in always using -S and it fixes several issues:
- A race during 'make libraries' where, for example, libgcc_s is being
  installed while another library is trying to link against it.  This is
  possible because libgcc_s is connected in both _prereq_libs and
  _startup_libs.  The first build (_prereq_libs) sets MK_PROFILE=no
  while the 2nd pass (_startup_libs) enables MK_PROFILE.  Thus the
  libgcc_s library *is* present in WORLDTMP for other libraries to
  link to, so serializing further items in _startup_libs is not
  required.  Just ensuring that libgcc_s is installed atomically (via
  rename(2)) is enough. [1]
- Installation to a running system where some library that cannot be
  detected, copied and used from the temporary INSTALLTMP with LD_LIBRARY_PATH
  that the build itself uses for installation.  Such an example is having the
  install an NSS module for user lookups that install(1) uses while
  concurrently installing the module in another process.  This is not
  a problem for the FreeBSD base build but can be for downstream
  vendors.  While this is a very specific case, installation to a
  running system with non-atomic library installation is prone to many
  problems.  A further step still is to install in proper dependency
  ordering.

Reported by:	dhw many times [1]
Sponsored by:	Dell EMC Isilon
MFC after:	2 weeks
2017-08-16 05:02:31 +00:00
Enji Cooper
82baa8db5e MFhead@r322515 2017-08-14 19:28:49 +00:00
Enji Cooper
38f8fddf05 Add limited sandbox capability to "make check"
== Rationale ==

r295380 introduced "make check" and consolidated means for running
test code in an attempt to simplify running tests. One could either
install files/libraries/programs and run "make check", or run "make check"
with an explicit CHECKDIR, e.g., `make check CHECKDIR=$(make -V.OBJDIR)``.

One criticism that was received is that "make check" should be run with
the intent of making dev->test->commit easier, which means that the target
audience's workflow should be developers. One developer pattern available
in other opensource projects is to run test code from a developer sandbox,
instead of installing to a system.

== Method ==

This approach is slightly different from the standard approach, in the sense
that it builds and installs into a deterministic directory under .OBJDIR (as I call it,
the "sandbox"), then runs "make check" against that. In the event the test
run is successful, the deterministic directory is removed to save space.

== Approach ==

bsd.lib.mk, bsd.prog.mk:

To support this functionality, a new variable `HAS_TESTS` is being added.

HAS_TESTS enables appropriate behavior with bsd.lib.mk and bsd.prog.mk, as
follows:
- Add "make check" as an available target from the directory.
- Pass down appropriate variables via ${TESTS_ENV}, i.e.,
  ${TESTS_LD_LIBRARY_PATH} and ${TESTS_PATH}.

One should add "HAS_TESTS" to directories containing tests in them, e.g. from
bin/sh/Makefile,

  HAS_TESTS=
  SUBDIR.${MK_TESTS}+= tests

HAS_TESTS doesn't automatically add the tests subdirectory for flexibility
reasons.

bsd.opts.mk, src.opts.mk:
- The knob ${MK_MAKE_CHECK_USE_SANDBOX} has been added, both to explicitly
  direct (internally) when to set a deterministic ${DESTDIR} and to also allow
  users to disable this behavior globally, i.e., via src.conf.
- MK_TESTS has been promoted from src.opts.mk to bsd.opts.mk to leverage
  syntactic sugar for having MK_TESTS be a dependency for
  MK_MAKE_CHECK_USE_SANDBOX, but to also ensure that src.opts.mk isn't required
  to use suite.test.mk (which is a dependency of bsd.test.mk).

suite.test.mk:
- beforecheck behavior (when MK_MAKE_CHECK_USE_SANDBOX is enabled) is modified
  from a no-op to:
-- Build.
-- Run "make hierarchy" on the sandbox dir.
-- Install the tests/files to the sandbox dir.
- aftercheck behavior (when MK_MAKE_CHECK_USE_SANDBOX is enabled) is modified
  from a no-op to:
-- Remove the sandbox dir.

Again, because the dependency order set in bsd.test.mk is
beforecheck -> check -> aftercheck, "make check" will not be run unless
"beforecheck" completes successfully, and "aftercheck" will not be run unless
"beforecheck" and "check" complete successfully.

== Caveats ==

- This target must either be run with MK_INSTALL_AS_USER or as root. Otherwise
  it will fail when running "make install" as the default user/group for many
  makefiles when calling INSTALL is root/wheel.
- This target must be run from a suitable top-level directory. For example,
  running tests from `tests/sys/fs/tmpfs` won't work, but `tests/sys/fs` will,
  because `tests/sys/fs/tmpfs` relies on files installed by `tests/sys/fs`.
- Running MK_INSTALL_AS_USER may introduce determinism issues. However, using
  it could identify deficiences in tests in terms of needing to be run as
  root, which are not properly articulated in the test requirements.
- The doesn't negate the need for running "make installworld" and
  "make checkworld", etc. Again, this just is intended to simplify the
  dev->test->commit workflow.

== Cleanup done ==
- CHECKDIR is removed; one can use "MK_MAKE_CHECK_USE_SANDBOX=no" to enable
  "legacy" (r295380) behavior.

MFC after:	2 months
Relnotes:	yes (CHECKDIR removed; "make check" behavior changed)
Requested by:	jhb
Reviewed by:	arch (silence), testing (silence)
Differential Revision:	D11905
2017-08-14 19:03:05 +00:00
Warner Losh
06d0095e71 We don't use ARM_ARCH_6 in the tree, and haven't for a long long
time. Remove it from here. As far as I could tell, nothing in ports
use it (either __ARM_ARCH or __ARM_ARCH_6__ is used in all the
apatches). We do have a define for _ARM_ARCH_6, but it's mostly unused
(and will remain, since it isn't in this file).
2017-08-13 04:10:47 +00:00
Enji Cooper
083c8ded05 MFhead@r322451 2017-08-13 01:23:13 +00:00
Enji Cooper
7a6fd8dc6b Delete trailing whitespace
MFC after:	1 month
2017-08-12 21:26:46 +00:00
Li-Wen Hsu
229d577fe8 Re-remove excess / for installing SYMLINKS
This excess / was introduced in r280129, and fixed in r295230, but got
re-introduced while merging another branch in r298107.

Approved by:	gjb
Differential Revision:	https://reviews.freebsd.org/D11995
2017-08-12 18:11:41 +00:00
Warner Losh
9208cbbd0e arm*hf is no longer a thing, remove it from the conversion now that it's easy.
Submitted by: andyt@
2017-08-12 17:07:32 +00:00
Warner Losh
7709b2ae16 Make _TO_CPUARCH macro for ARCH to CPUARCH conversions
Consolidate all the regular expressions to convert from MACHINE_ARCH
to MACHINE_CPUARCH into a variable and use that variable in preference
to the almost identical copies in the tree (which should have been
identical).

Differential Revision: https://reviews.freebsd.org/D11986
2017-08-12 17:07:27 +00:00
Ed Maste
056dd75b27 lldb: enable on i386
It is functional on FreeBSD/i386 as of r322326.

Sponsored by:	The FreeBSD Foundation
2017-08-11 20:11:43 +00:00
Glen Barber
ebd2eeb3f8 Add SVNVERSION_CMD to bsd.own.mk, adding the capability to include
svnversion metadata to the runtime and kernel packages.

Instead of traversing src/sys, as is done by newvers.sh for uname(1),
a full tree walk is done to prevent userland and/or modifications
from not being reflected in a modified tree (M).

MFC after:	5 days
Sponsored by:	The FreeBSD Foundation
2017-08-11 19:21:40 +00:00
Ruslan Bukin
af19cc59ca Support for v1.10 (latest) of RISC-V privilege specification.
New version is not compatible on supervisor mode with v1.9.1
(previous version).

Highlights:
    o BBL (Berkeley Boot Loader) provides no initial page tables
      anymore allowing us to choose VM, to build page tables manually
      and enable MMU in S-mode.
    o SBI interface changed.
    o GENERIC kernel.
      FDT is now chosen standard for RISC-V hardware description.
      DTB is now provided by Spike (golden model simulator). This
      allows us to introduce GENERIC kernel. However, description
      for console and timer devices is not provided in DTB, so move
      these devices temporary to nexus bus.
    o Supervisor can't access userspace by default. Solution is to
      set SUM (permit Supervisor User Memory access) bit in sstatus
      register.
    o Compressed extension is now turned on by default.
    o External GCC 7.1 compiler used.
    o _gp renamed to __global_pointer$
    o Compiler -march= string is now in use allowing us to choose
      required extensions (compressed, FPU, atomic, etc).

Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D11800
2017-08-10 14:18:09 +00:00
Ed Maste
2427dc7d95 Mark PROFILE option as broken when targetting mips64
The assembly in sys/mips/include/profile.h will only work for o32 ABI.

Submitted by:	Alexander Richardson
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D11950
2017-08-10 13:01:19 +00:00
Enji Cooper
d59ead01d8 MFhead@r321970 2017-08-03 05:30:11 +00:00
Enji Cooper
ba25b1ca42 Delete comment above "__DEFAULT_DEPENDENT_OPTIONS" related to "meta mode options"
src.conf(5) should document which knobs are which and the dependency between each;
remove the comment so the variable can apply to non-"meta mode options".

MFC after:	2 weeks
2017-08-02 21:49:37 +00:00
Enji Cooper
edb58145c8 Allowing MK_NLS_CATALOGS to be enabled if MK_NLS == no doesn't make a whole lot
of sense. Anchor MK_NLS_CATALOGS being enabled off of MK_NLS.

MFC after:	1 month
2017-08-02 21:38:15 +00:00
Enji Cooper
f117e4e1df Some minor doc fixups
- Tweak a sentence by placing the modifier before an adjective to make it flow
  better.
- Fix a typo.

MFC after:	3 days
2017-08-02 21:31:46 +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