Commit Graph

3110 Commits

Author SHA1 Message Date
Ed Maste
1069f41bb8 Force WITHOUT_FREEBSD_UPDATE when WITHOUT_PORTSNAP is set
freebsd-update depends on phttpget from portsnap. We could move phttpget
out of portsnap and build it as long as WITHOUT_FREEBSD_UPDATE and
WITHOUT_PORTSNAP are not both set, but for now just make the dependency
explicit.

PR:		228220
Reported by:	Dries Michiels
Sponsored by:	The FreeBSD Foundation
2018-05-16 01:33:48 +00:00
Bryan Drewery
b3a8db007a Fix stale dependencies on libcasper libraries.
Libcasper and its modules have no static libraries so don't define
paths to them.  This fixes LIBADD automatically adding DPADD
entries for casper.

Reported by:	sbruno
Sponsored by:	Dell EMC Isilon
2018-05-15 23:46:49 +00:00
Ed Maste
ff8f1e8332 Error out on attempt to link amd64 kernel with old binutils linker
As of r333461 we require ifunc support to link a working amd64 kernel.
The default in-tree bootstrap linker is lld and it has the required
support, as does any modern out-of-tree binutils linker.  The in-tree
GNU ld is from binutils 2.17.50 and it does not have ifunc support,
so produce an error rather than a broken kernel.

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D15378
2018-05-10 20:10:02 +00:00
John Baldwin
806b3bbe97 Recognize the base/gcc compiler as GCC.
The existing patterns for 'cc --version' output do not work for GCC
built from the base/gcc port.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D15357
2018-05-09 15:20:39 +00:00
Brad Davis
c74ace92a4 Enable directory creation with FILESDIR.
This is part of packaging base work.

Reviewed by:	will
Approved by:	bapt (mentor), allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D15130
2018-05-09 13:44:54 +00:00
Konstantin Belousov
db08bfce2f Created static libc PIC/no-SSP library to be used by rtld.
Rtld is not compatible with SSP, and since we link libc_pic.a to rtld
to have the basic support like memory and string copy functions, we
have to both carefully limit libc use, and to provide the ssp support
shims.  This change makes the libc use in rtld more straighforward but
still limited, and allows to remove the shims, to be done in the next
commit.

Submitted by:	Luis Pires
Reviewed by:	bdrewery, brooks
Differential revision:	https://reviews.freebsd.org/D15283
2018-05-09 10:28:24 +00:00
Sean Bruno
608cdf904b Remove accidentally committed debug statement that induced the following
warning:

make[3]: "/usr/src/share/mk/bsd.prog.mk" line 274: warning: duplicate
script for target "_scriptsinstall" ignored
make[3]: "/usr/src/share/mk/bsd.prog.mk" line 274: warning: using
previous script for "_scriptsinstall" defined here

Reviewed by:	kevans
2018-05-05 18:39:54 +00:00
Kyle Evans
a2584d1b34 bsdgrep: annihilate our in-tree TRE, previously disabled by default
It was an old TRE that had plenty of bugs and no performance gain over
regex(3). I disabled it by default in r323615, and there was some confusion
about what the knob does- likely due to poor naming on my part- to the tune
of "well, it sounds like it should speed things up" (mentioned by multiple
people).

To compound this, I have no intention of maintaining a second regex
implementation. If someone would like to step up and volunteer to maintain a
lean-and-mean implementation for grep, this is OK, but we have very few
volunteers to maintain even our primary regex implementation.
2018-05-04 03:13:25 +00:00
Ed Maste
2dce6bfbb2 Build lld as long as we have a C++11 host compiler
As with Clang, build our toolchain components by default when the host
compiler is capable of doing so, to make them available for testing and
experimentation.

Sponsored by:	The FreeBSD Foundation
2018-05-02 23:43:33 +00:00
Ed Maste
b25a46f7f7 Add support for linker-type-specific flags
r332090 added a LINKER_TYPE test to add the --no-rosegment flag when
linking the i386 loader components with lld.  Instead, introduce a
general mechanism for setting LDFLAGS for a specific linker type,
and use it for --no-rosegment.

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D14998
2018-04-19 20:58:09 +00:00
Ruslan Bukin
3783c1b196 Set correct float abi (float abi double) for hard-float build, so
__riscv_float_abi_double macro will be defined by compiler.

The options are:
o lp64  __riscv_float_abi_soft
o lp64f __riscv_float_abi_single
o lp64d __riscv_float_abi_double

Sponsored by:	DARPA, AFRL
2018-04-18 13:58:42 +00:00
Bryan Drewery
4f6de62991 Use known SRCTOP if possible to determine SYSDIR.
Suggested by:	sjg
Sponsored by:	Dell EMC
2018-04-12 20:48:17 +00:00
Bryan Drewery
711c77093c Fix using wrong SYSDIR after r331683.
This was inadvertently overriding the first found SYSDIR with the last
of /usr/src which could result in the wrong headers being used if not
building from /usr/src.

SYSDIR?= is not used here to avoid evaluating the exists() when unneeded.

Reported by:	rgrimes, sjg, Mark Millard
Pointyhat to:	bdrewery
Sponsored by:	Dell EMC
2018-04-12 20:27:57 +00:00
Kyle Evans
54095bf428 Re-sort LOADER options
These have become unsorted from everything else. This is desync'd from
stable/11 due to some hand-merging that was done there, so the MFC of this
will look slightly different.

MFC after:	3 days
2018-04-06 19:49:57 +00:00
Ruslan Bukin
cde6fa2857 Add new shared library -- libopencsd.
OpenCSD is an ARM CoreSight(tm) trace packets decoder.

- Connect libopencsd to the arm64 build.
- Install opencsd headers to /usr/include/opencsd/

Sponsored by:	DARPA, AFRL
2018-04-04 14:31:56 +00:00
Jung-uk Kim
9ef029b045 Catch up with Clang 6.0.
MFC after:	3 days
2018-04-03 23:11:08 +00:00
Bryan Drewery
7d9f50a4ba Avoid looping if SYSDIR already known.
Sponsored by:	Dell EMC
2018-03-28 16:28:24 +00:00
Bryan Drewery
ffae081b1e Avoid upwards directory walk in kernel build for finding known SYSDIR.
Sponsored by:	Dell EMC
2018-03-28 16:28:20 +00:00
Emmanuel Vadot
c2f5940db3 Add dtb overlays support
DTB Overlays are useful to change/add nodes to a dtb without the need to
modify it.
Add support for building dtbo during buildkernel.
The goal of DTBO present in the FreeBSD source tree is to fill a gap in
time when we submit changes upstream (Linux). Instead of waiting 2 to 4 months
we can add a DTBO in tree in the meantime.
This is not for adding DTBO for capes/hat/addon boards, those will be
better to put in a ports.
This is also not for enabling a i2c/spi/pwm controller on certain pins,
each user have a different use case for those (which pins to use etc ...)
and we cannot have all possible configuration.

Add a dtbo for sun8i-h3-sid which add the SID node missing in upstream dts.

Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D14782
2018-03-24 21:30:24 +00:00
Ruslan Bukin
30b3274fff Add new shared library -- libipt.
libipt is the Intel Processor Trace (Intel PT) packets decoder.

- Include libipt to amd64 build.
- Install libipt headers to /usr/include/libipt/

Sponsored by:	DARPA, AFRL
2018-03-21 14:37:04 +00:00
John Baldwin
1e18e7d203 Add support for MIPS to LLVM's libunwind.
This is originally based on a patch from David Chisnall for soft-float
N64 but has since been updated to support O32, N32, and hard-float ABIs.
The soft-float O32, N32, and N64 support has been committed upstream.
The hard-float changes are still in review upstream.

Enable LLVM_LIBUNWIND on mips when building with a suitable (C+11-capable)
toolchain.  This has been tested with external GCC for all ABIs and
O32 and N64 with clang.

Reviewed by:	emaste
Obtained from:	CheriBSD (original N64 patch)
Sponsored by:	DARPA / AFRL
Differential Revision:	https://reviews.freebsd.org/D14701
2018-03-20 15:44:17 +00:00
Hans Petter Selasky
e808190a59 Add kernel and userspace code to dump the firmware state of supported
ConnectX-4/5 devices in mlx5core.

The dump is obtained by reading a predefined register map from the
non-destructive crspace, accessible by the vendor-specific PCIe
capability (VSC). The dump is stored in preallocated kernel memory and
managed by the mlx5tool(8), which communicates with the driver using a
character device node.

The utility allows to store the dump in format
    <address> <value>
into a file, to reset the dump content, and to manually initiate the
dump.

A call to mlx5_fwdump() should be added at the places where a dump
must be fetched automatically. The most likely place is right before a
firmware reset request.

Submitted by:	kib@
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2018-03-08 15:21:56 +00:00
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