Commit Graph

3464 Commits

Author SHA1 Message Date
Kyle Evans
879ce458f4 userland build: replace -fno-common with ${CFCOMMONFLAG}
This change allows any downstream or otherwise consumer to easily override
the new -fno-common default on a temporary basis without having to hack into
src.sys.mk, and also makes it a bit easier to search for these specific
cases where -fno-common must be overridden with -fcommon or else the build
will fail.

The gdb build, the only program requiring -fcommon on head/, is switched
over as an example usage. It will need it on all branches, so this does not
harm future mergability.

MFC after:	3 days
2020-04-10 14:01:07 +00:00
Xin LI
f5b7695d2d Always install backward compatibility timezones, as they are installed
on all major Linux distributions as well as NetBSD and OpenBSD.

Remove the undocumented ZONEINFO_OLD_TIMEZONES_SUPPORT and the deprecated
OLDTIMEZONES knobs as they are now the default.

Reviewed by:		ngie, rgrimes
MFC after:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D24306
2020-04-09 05:11:18 +00:00
Bryan Drewery
33ae1ff723 NO_OBJ: Always fix .OBJDIR regardless of AUTO_OBJ.
Sponsored by:	Dell EMC
MFC after:	2 weeks
2020-04-07 17:07:04 +00:00
Kyle Evans
8eb1a0ce56 Add -fno-common to all userland/kernel src builds
-fno-common will become the default in GCC10/LLVM11. Plenty of work has been
put in to make sure our world builds are no -fno-common clean, so let's slap
the build with this until it becomes the compiler default to ensure we don't
regress.

At this time, we will not be enforcing -fno-common on ports builds. I
suspect most ports will be or quickly become -fno-common clean as they're
naturally built against compilers that default to it, so this will hopefully
become a non-issue in due time. The exception to this, which is actually the
status quo, is that kmods built from ports will continue to build with
-fno-common.

As of the time of writing, I intend to also make stable/12 -fno-common
clean. What's been done will be MFC'd to stable/11 if it's easily applicable
and/or not much work to massage it into being functional, but I anticipate
adding -fcommon to stable/11 builds to maintain its ability to be built with
newer compilers for the rest of its lifetime instead of putting in a third
branch's worth of effort.
2020-04-07 17:04:24 +00:00
Kyle Evans
cddd13a4f4 Fix port/kernel builds after r359681
Submitted by:	bdrewery
Reported by:	bdrewery, sobomax, antoine
2020-04-07 15:10:04 +00:00
Maxim Sobolev
a8b8edb25e Normalize deployment tools usage and definitions by putting into one place
instead of sprinkling them out over many disjoint files. This is a follow-up
to achieve the same goal in an incomplete rev.348521.

Approved by:	imp
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D20520
2020-04-07 02:46:22 +00:00
Brooks Davis
f382bac49b Fix compilation with upstream clang builtin headers.
By using -nobuiltininc and adding the clang builtin headers resource dir
to the end of the compiler header search path, we can still find headers
such as immintrin.h but find the FreeBSD version of stddef.h/stdarg.h/..
first.

This is a workaround until we are able to settle on and complete a plan
to harmonize guard macros with LLVM.  We've mostly worked out this on
FreeBSD systems by removing select headers from the installed set of
devel/llvm*, but that isn't a good solution for cross build.

Submitted by:	arichardson
Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D17002
2020-04-06 23:38:46 +00:00
Kyle Evans
147d7b567f llvm: add a build knob for enabling assertions
For head/, this will remain eternally default-on to maintain the status quo.
For stable/ branches, it should be flipped to default-off to maintain the
status quo.

There's value in being able to flip it one way or the other easily on head
or stable branches, whether you want to gain some performance back on head/
(for machines there's little chance you'll actually hit an assertion) or
potentially diagnose a problem with the version of llvm on an older branch.

Currently, stable branches get the CFLAGS+= -ndebug line uncommented; going
forward, they will instead have the default of LLVM_ASSERTIONS flipped.

Reviewed by:	dim, emaste, re (gjb)
MFC after:	1 week
MFC note:	flip the default of LLVM_ASSERTIONS
Differential Revision:	https://reviews.freebsd.org/D24264
2020-04-06 01:27:17 +00:00
Simon J. Gerraty
5ea556d98c Do not claim libbearssl et al are INTERNALLIB
If INTERNALLIB is defined we need PIE and bsd.incs.mk is
not included.

PR:		245189
Reviewed by:	emaste
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org//D24233
2020-04-01 05:45:12 +00:00
Simon J. Gerraty
64b522da27 Include ${.CURDIR}/local.init.mk if it exists
This is handy for making local hacks to an app
(eg to build it as tool for non-BSD host)
without making a mess of the code base.

Reviewed by:	bdrewery
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org//D24101
2020-03-31 15:59:29 +00:00
Ed Maste
a52b0bb1d2 drop GDB_LIBEXEC option (now always true)
In-tree gdb is essentially obsolete.  We kept it for sparc64 (because
gdb in ports lacked sparc64 support) and as a fallback for crashinfo.
gdb was installed to /libexec on all archs other than sparc64, where the
WITHOUT_GDB_LIBEXEC option was default, with gdb installed to /usr/bin.
With sparc64's retirement WITH_GDB_LIBEXEC became the default for all
architectures, but it was still possible to set it off and install gdb
into /usr/bin.

As the next step in gdb's retirement, remove the option and install gdb
only into /libexec as the crashinfo fallback. We expect users to install
the gdb port or package for debugging. The in-tree gdb lacks support for
a number of supported architectures and does not support contemporary
DWARF debug info.

Reviewed by:	jhb (earlier)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D24227
2020-03-30 20:05:09 +00:00
Justin Hibbits
90be917249 powerpc: --secure-plt only needs to pass to ld.bfd, not ld.lld
ld.lld only supports secure-plt for powerpc, so no need to pass the argument
in.
2020-03-30 16:24:05 +00:00
Brandon Bergren
4d94781b4d [PowerPC] Fix LIB32WMAKEFLAGS definition
When I modified the LIB32WMAKEFLAGS= definition, I trimmed too much off.
-m is meant to be a parameter to LD.

Reported by:	arichardson
2020-03-27 18:20:36 +00:00
Brandon Bergren
a04ec978b3 [PowerPC] Switch powerpc and powerpcspe to lld
Now that LLD 10 is out, and required patches have landed, we are now ready
to finally switch away from the ancient in-tree ld.bfd.

Special thanks to Fangrui Song for many hours of work on getting the
32-bit powerpc lld ready for prime-time.

Reviewed by:	emaste (earlier revision), jhibbits
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D24111
2020-03-27 01:00:03 +00:00
Emmanuel Vadot
970d1bbf71 Re-apply r359267 now that tools are using the proper include path
Original commit message:
bsd.lib.mk: Do not include bsd.incs.mk for INTERNALLIB

f we're building an internal lib do not bother including bsd.incs.mk so we
will not install the headers.
This also "solves" a problem with pkgbase where a libXXX-development package
is created and due to how packages are created we add a dependency to a
libXXX package that doesn't exists.
2020-03-25 01:35:13 +00:00
Emmanuel Vadot
7dc05244c5 Revert r359267.
This is not the correct solution and I should have done a clean buildworld.
2020-03-24 01:29:18 +00:00
Emmanuel Vadot
1c93dede42 bsd.lib.mk: Do not include bsd.incs.mk for INTERNALLIB
If we're building an internal lib do not bother including bsd.incs.mk so we
will not install the headers.
This also "solves" a problem with pkgbase where a libXXX-development package
is created and due to how packages are created we add a dependency to a
libXXX package that doesn't exists.

Reported by:	pizzamig
Reviewed by:	pizzamig bapt emaste
Differential Revision:	https://reviews.freebsd.org/D24166
2020-03-24 01:09:04 +00:00
Brooks Davis
e2d6edeb99 Improve LIBADD/_DP_* for kyua libraries.
This fixes build with ld.bfd as the linker (e.g. on powerpc).

This corrects a bug in D24103.

Sponsored by:	DARPA
2020-03-23 21:21:38 +00:00
Brooks Davis
b0d29bc47d Import the kyua test framework.
Having kyua in the base system will simplify automated testing in CI and
eliminates bootstrapping issues on new platforms.

The build of kyua is controlled by WITH(OUT)_TESTS_SUPPORT.

Reviewed by:	emaste
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D24103
2020-03-23 19:01:23 +00:00
Brooks Davis
c697fb7f7c Add liblutok a lightweight C++ API for lua.
It is added an INTERNALLIB and not installed.  It will be used by kyua.

This is a preparatory commit for D24103.

Reviewed by:	emaste
Obtained from:	CheriBSD
Sponsored by:	DARPA
2020-03-23 18:26:23 +00:00
Alex Richardson
4a4c9a0f9e Use Clang and LLD as the default toolchain for MIPS
Now that we have updated the in-tree version of LLVM to 10.0, we have all the
necessary LLVM changes to use Clang+LLD as the default toolchain for MIPS.

Relnotes:	yes
Reviewed By:	emaste, jhb, brooks, kevans
Differential Revision: https://reviews.freebsd.org/D23204
2020-03-23 10:36:32 +00:00
Warner Losh
980bae6980 Redo r359164 now that it's baked : Eliminate misuse of $MACHINE for userland things.
Use TARGET_ARCH and/or MACHINE_ARCH exclusively. Change all __TT uses to __T
with appropriate translations. MACHINE/TARGET is to be used only for kernel
things, and this fixes the last few stragglers.
2020-03-21 00:01:06 +00:00
Warner Losh
5e029bd788 Revert r359164.
This was in my staging tree by mistake when I pushed. Revert until it's ready.
2020-03-20 16:00:26 +00:00
Warner Losh
6f7bbb2661 Eliminate misuse of $MACHINE for userland things.
Use TARGET_ARCH and/or MACHINE_ARCH exclusively. Change all __TT uses to __T
with appropriate translations. MACHINE/TARGET is to be used only for kernel
things.
2020-03-20 15:07:21 +00:00
Warner Losh
3b7fd87cbf Remove sparc support from clang build infrastructure. Any remaining sparc files
will be mopped up in future imports.

Differential Revision: https://reviews.freebsd.org/D24128
2020-03-20 15:07:15 +00:00
Ed Maste
5236e8d427 src.opts.mk: remove remaining support for pre-C++11 C++ compilers
Delete the conditions that forcibly disabled GOOGLETEST and LLDB for
pre-C++11 C++ compilers, since we no longer support such compilers.

Also delete the complicated method of defaulting LIBCPLUSPLUS to YES.

Prodded by:	kevans
Sponsored by:	The FreeBSD Foundation
2020-03-18 21:28:55 +00:00
Ed Maste
d64b2df932 src.opts.mk: drop C++11 compiler conditional from OPENMP
We no longer support older C++ compilers, so do not need to explicitly
test for C++11 support.

After r339946 we stopped running `cc --version` during cleandir/obj
stages, so stopped setting COMPILER_FEATURES.  This in turn meant
lib/libomp was excluded from the clean stage in a normal buildworld
(i.e., one without -DNO_CLEAN), and this is what caused recent build
failures with errors about missing ittnotify_static.c.

This commit should obviate the need for the workaround committed in
r359083.  Thanks to bdrewery for the insight and for pushing for a
correct fix.  There are more cleanups to be done, but this change is
a simplification and an improvement over r359083.

Sponsored by:	The FreeBSD Foundation
2020-03-18 21:15:45 +00:00
Brooks Davis
2e1dfb346f Support SUBDIR.${MK_FOO}.${MK_BAR} expresssions.
This allows simplification of Makefiles where some SUBDIR entries depend
on two things (e.g. something that depends on C++ and some other knob).

Discussed with:	imp, jhb
Obtained from:	CheriBSD
MFC after:	3 days
Sponsored by:	DARPA
2020-03-17 18:17:32 +00:00
Brooks Davis
564b9ff2a7 Add an internal liblua and use it in flua.
The new liblua will be used in a forthcoming import of kyua.

Reviewed by:	kevans
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D24090
2020-03-17 17:28:12 +00:00
Jung-uk Kim
e754c10d23 Add "tigerlake" CPUTYPE for x86 to catch up with Clang 10.0. 2020-03-10 23:12:55 +00:00
Dimitry Andric
16b9056593 Merge ^/head r358731 through r358831. 2020-03-10 07:04:05 +00:00
Ed Maste
5b51d0c01c Remove WITH_AMD option, missed in r358821 2020-03-09 20:49:06 +00:00
Simon J. Gerraty
afc571b1a6 veloader use vectx API for kernel and modules
The vectx API, computes the hash for verifying a file as it is read.
This avoids the overhead of reading files twice - once to verify, then
again to load.

For doing an install via loader, avoiding the need to rewind
large files is critical.

This API is only used for modules, kernel and mdimage as these are the
biggest files read by the loader.
The reduction in boot time depends on how expensive the I/O is
on any given platform.  On a fast VM we see 6% improvement.

For install via loader the first file to be verified is likely to be the
kernel, so some of the prep work (finding manifest etc) done by
verify_file() needs to be factored so it can be reused for
vectx_open().

For missing or unrecognized fingerprint entries, we fail
in vectx_open() unless verifying is disabled.

Otherwise fingerprint check happens in vectx_close() and
since this API is only used for files which must be verified
(VE_MUST) we panic if we get an incorrect hash.

Reviewed by:	imp,tsoome
MFC after:	1 week
Sponsored by:	Juniper Networks
Differential Revision:	https://reviews.freebsd.org//D23827
2020-03-08 17:42:42 +00:00
Dimitry Andric
2ac6b71f31 Merge ^/head r358712 through r358730. 2020-03-07 15:09:45 +00:00
Justin Hibbits
dc0a7e1390 compat: Allow explicit overriding of COMPAT_ARCH and COMPAT_CPUTYPE
Summary:
Allow src.conf to override the inferred COMPAT_ARCH and COMPAT_CPUTYPE
variables, such that a different CPU target can be specified explicitly
for the general target vs the compat target.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D23992
2020-03-07 03:58:58 +00:00
Dimitry Andric
e43d33d286 Merge ^/head r358466 through r358677. 2020-03-05 17:55:36 +00:00
Ed Maste
134b378392 retire in-tree GPL dtc devicetree compiler
Now that we no longer have GCC 4.2.1 in the tree and can assume FreeBSD
is being built with a C++11 compiler available, we can use BSDL dtc
unconditionally and retire the GPL dtc.

GPL dtc now has FreeBSD CI support via Cirrus-CI to help ensure it
continues to build/work on FreeBSD and is available in the ports tree
if needed.

The copy of (copyfree licensed) libfdt that we actually use is in
sys/contrib/libfdt so the extra copy under contrib/dtc/libfdt can be
removed along with the rest of the GPL dtc.

Reviewed by:	kevans, ian, imp, manu, theraven
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D23192
2020-02-29 17:10:54 +00:00
Dimitry Andric
91019ea7d4 Merge ^/head r358400 through r358465. 2020-02-29 15:08:14 +00:00
Ed Maste
83a08b7c09 src.opts.mk: simplify Clang and lld bootstrap defaults
With the retirement of GCC 4.2.1 we can assume the host compiler supports
C++11, and can simplify the Clang and LLD defaults.  Clang and lld are now
enabled by default everywhere, and are used as the bootstrap compiler and
linker for all targets except MIPS.

Sponsored by:	The FreeBSD Foundation
2020-02-29 13:15:01 +00:00
Ed Maste
c45018041d retire the LLVM_LIBUNWIND option
LLVM's libunwind is used on all FreeBSD-supported CPU architectures and
is a required component.

Reviewed by:	brooks (earlier)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D23123
2020-02-29 12:43:43 +00:00
Ed Maste
57f804675e remove GCC 4.2.1 build infrastructure
As described in Warner's email message[1] to the FreeBSD-arch mailing
list we have reached GCC 4.2.1's retirement date.  At this time all
supported architectures either use in-tree Clang, or rely on external
toolchain (i.e., a contemporary GCC version from ports).

GCC 4.2.1 was released July 18, 2007 and was imported into FreeBSD later
that year, in r171825.  GCC has served us well, but version 4.2.1 is
obsolete and not used by default on any architecture in FreeBSD.  It
does not support modern C and does not support arm64 or RISC-V.

Thanks to everyone responsible for maintaining, updating, and testing
GCC in the FreeBSD base system over the years.

So long, and thanks for all the fish.

[1] https://lists.freebsd.org/pipermail/freebsd-arch/2020-January/019823.html

PR:		228919
Reviewed by:	brooks, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D23124
2020-02-29 03:25:51 +00:00
Dimitry Andric
75dfc66c1b Merge ^/head r358269 through r358399. 2020-02-27 19:07:10 +00:00
Ed Maste
593d80c4a0 src.opts.mk: drop MIPS special case for disabling BINUTILS_BOOTSTRAP
Binutils has already been reduced to installing ld only on powerpc32
and as only on amd64.  (Also objdump on every arch supported by binutils
2.17.50.)  Although BINUTILS_BOOTSTRAP serves no purpose on MIPS there
is no reason to have a special case for it.

Sponsored by:	The FreeBSD Foundation
2020-02-26 19:08:23 +00:00
Warner Losh
47e9f42ea3 Remove sparc64 specific buid-system hacks
Remove all the sparc64 hacks and tweaks to the build system. We don't
need them anymore.
2020-02-26 18:49:20 +00:00
Dimitry Andric
9caf7b3610 Adjust the regex used for LINKER_FREEBSD_VERSION so it captures the last
dash-separated segment from the upstream commit description.  This is
required to parse "git describe --long" output.
2020-02-24 19:11:52 +00:00
Dimitry Andric
eb834d9f1b Take LINKER_FREEBSD_VERSION from numerical field after dash
Summary:
With COMPILER_FREEBSD_VERSION, we use a numeric value that we bump each
time we make a change that requires re-bootstrapping, but with the
linker variant, we instead take the entire part after "FreeBSD", as in
this example version output:

LLD 9.0.1 (FreeBSD c1a0a213378a458fbea1a5c77b315c7dce08fd05-1300006) (compatible with GNU linkers)

E.g., LINKER_FREEBSD_VERSION is currently being set to
"c1a0a213378a458fbea1a5c77b315c7dce08fd05-1300006".  This means that
*any* new upstream lld version will cause re-bootstrapping.

We should only look at the numerical field we append after a dash
instead.  This review attempts to make it so.

The only thing I am not happy about is the post-processing of awk output
in Makefile.inc1.  I notice that our awk does not have gensub(), so it
can't substitute a numbered sub-regex with \1, \2, etc.  Suggestions
welcome. :)

MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D23691
2020-02-19 21:12:59 +00:00
Dimitry Andric
43c7dd6b59 Merge ^/head r358075 through r358130. 2020-02-19 21:03:06 +00:00
Ed Maste
db1d8f1de4 Move GCOV option to default NO
GNU gcov will be removed along with GCC 4.2.1 at the end of the month.
Change the default to NO in preparation.
2020-02-19 14:12:59 +00:00
Dimitry Andric
c246b3930d Tentatively apply D23691, which takes LINKER_FREEBSD_VERSION from the
numerical field after the dash.  This avoids re-bootstrapping of the
linker, when only the git commit hash changes.
2020-02-15 14:53:26 +00:00
Brooks Davis
d3a5bf95f2 Make the warning for deprecated NO_ variables an error.
Support for NO_CTF, NO_DEBUG_FILES, NO_INSTALLLIB, NO_MAN, NO_PROFILE,
and NO_WARNS as deprecated in 2014 with a warning added for each one
found. Turn these into error in preperation for removal of compatability
support before FreeBSD 13.

This was previously committed in r354909 and reverted in r355011 due to
unforseen impacts on ports.  I've since corrected all amd64 and i386
ports reported in prior runs as well as instance of these variables I
found via grep.
2020-02-12 18:09:20 +00:00