Commit Graph

3823 Commits

Author SHA1 Message Date
Ed Maste
7661a2abe4 src.opts.mk: sync FDT and OFED options with kern.opts.mk
Where options exist in both src.opts.mk and kern.opts.mk they should be
kept in sync.

It may be that the option should be flipped the other way (e.g.,
enabling OFED in the kernel on arm64); if so that will be done as a
subsequent commit after further testing.

PR:		269994
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38952
2023-03-07 13:40:18 -05:00
Vitaliy Gusev
cff4823804 bhyve: Move libcasper dependecy to lib9p
libcasper(3) is not used in bhyve. So move dependency to the appropriate
place.

Reviewed by:	markj
MFC after:	1 week
Sponsored by:	vStack
Differential Revision:	https://reviews.freebsd.org/D38905
2023-03-07 11:09:22 -05:00
Ed Maste
6e0a1438d8 src.opts.mk: mark ZFS broken on powerpc, matching kern.opts.mk
Where options exist in both src.opts.mk and kern.opts.mk they should be
kept in sync.

PR:		269994
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D38935
2023-03-06 20:34:02 -05:00
Emmanuel Vadot
d43812b173 Disable ATM programs by default
ATM is an old technology, remove build of related programs by default

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38844
Reviewed by:	brooks, imp, emaste
2023-03-03 08:52:35 +01:00
Warner Losh
55f35c5398 Use 'mixed' links for 'hard' links by default.
emaste suggested this in https://github.com/freebsd/freebsd-src/pull/133
and it works. It will do the right thing by default, and handle the weird
cases 133 was trying to fix.
2023-02-27 10:19:00 -07:00
Piotr Kubaj
e552cac3d7 powerpc64*: port mlx5, OFED, KTLS and krping
Summary:
This review ports mlx5 driver, kernel's OFED stack (userland is already enabled), KTLS and krping to powerpc64 and powerpc64le.

krping requires a small change since it uses assembly for amd64 / i386.

NOTE: On powerpc64le RDMA works fine in the userspace with libmlx5, but on powerpc64 it does not. The problem is that contrib/ofed/libmlx5/doorbell.h checks for SIZEOF_LONG but this macro exists on neither powerpc64* nor amd64. Thus, the file silently goes to the fallback function written for 32-bit architectures. It works fine on little-endian architectures, but causes a hard fail on big-endian. It's possible it may also cause some runtime issues on little-endian.
Thus, on powerpc64 I verified that RDMA works with krping.

Reviewers: #powerpc, hselasky

Subscribers: bdrewery, imp, emaste, jhibbits

Differential Revision: https://reviews.freebsd.org/D38786
2023-02-26 23:38:33 +01:00
Piotr Kubaj
f5a1c871e6 Revert "powerpc64*: port mlx5, OFED, KTLS and krping"
Wrong push, another commit was supposed to be pushed.

This reverts commit 83d6d8877e.
2023-02-26 00:57:41 +01:00
Piotr Kubaj
83d6d8877e powerpc64*: port mlx5, OFED, KTLS and krping
Summary:
This review ports mlx5 driver, kernel's OFED stack (userland is already enabled), KTLS and krping to powerpc64 and powerpc64le.

krping requires a small change since it uses assembly for amd64 / i386.

NOTE: On powerpc64le RDMA works fine in the userspace with libmlx5, but on powerpc64 it does not. The problem is that contrib/ofed/libmlx5/doorbell.h checks for SIZEOF_LONG but this macro exists on neither powerpc64* nor amd64. Thus, the file silently goes to the fallback function written for 32-bit architectures. It works fine on little-endian architectures, but causes a hard fail on big-endian. It's possible it may also cause some runtime issues on little-endian.
Thus, on powerpc64 I verified that RDMA works with krping.

Reviewers: #powerpc, hselasky

Subscribers: bdrewery, imp, emaste, jhibbits

Differential Revision: https://reviews.freebsd.org/D38786
2023-02-26 00:56:37 +01:00
Warner Losh
d04c86717c bsd.sys.mk: Add NO_WSTRICT_PROTOTYPES like in kernel
Also add NO_WSTRICT_PROTOTYPES like we do for the kernel.

Sponsored by:		Netflix
2023-02-19 00:02:12 -07:00
Warner Losh
3ae78d66d9 bsd.cpu.mk: Simplify armv[67] support
Drop a clause that's no longer relevant to v4/v5. Drop support for
softfloat for v[45]. Simplify soft float expression by assuming we're
always either armv6 or armv7.

Sponsored by:		Netflix
Reviewed by:		emaste
Differential Revision:	https://reviews.freebsd.org/D38584
2023-02-14 09:53:15 -07:00
Warner Losh
5c33688475 arm: Remove armv5 supprt
This can only be true on armv5, so we can GC it.

Sponsored by:		Netflix
Reviewed by:		fuz@fuz.su, brooks, emaste
Differential Revision:	https://reviews.freebsd.org/D38563
2023-02-14 09:48:37 -07:00
Emmanuel Vadot
0b8a2c744c pkgbase: Do not override packages for FILES
Not all FILES entries should end up in FreeBSD-utilities

Reviewed by:	bapt
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38296
2023-02-08 08:50:16 +01:00
Warner Losh
4601064126 kboot: Enable for aarch64
Enable building loader.kboot for aarch64/arm64.

Sponsored by:		Netflix
Reviewed by:		tsoome, kevans, andrew
Differential Revision:	https://reviews.freebsd.org/D38262
2023-02-03 08:41:40 -07:00
Ed Maste
ac4c695ad6 Retire WITHOUT_CXX option
Several important base system components are written in C++, and the
WITHOUT_CXX option produced a system that was not fully functional.
Just accept this, and remove the option to build without C++ support.

This reverts commit adc3c128c6.

Reviewed by:	brooks, kevans, jhb (earlier)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33108
2023-01-26 21:13:16 -05:00
Simon J. Gerraty
e300f328fe Add site.{autodep,gendirdeps}.mk
Allow for site customization to minimize churn in share/mk

Reviewed by:	stevek
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D37895
2022-12-28 12:39:08 -08:00
Dimitry Andric
526f57bf85 Update CWARNFLAGS in bsd.sys.mk and CWARNEXTRA in kern.mk for clang 15.
MFC after:	3 days
2022-12-25 12:58:22 +01:00
Simon J. Gerraty
073ccb9d55 Allow site.*.mk to augment local.*.mk and src.*.mk
Add some extra customization points so that FreeBSD build
can be adapted to local requirements.
We use these to minimize changes to share/mk

Reviewed by:	stevek
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D37617
2022-12-07 11:30:35 -08:00
Simon J. Gerraty
48e733eef9 Add some more local.*.mk includes
These facilitate customizing the build with minimal churn.

Reviewed by:	stevek
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D37592
2022-12-06 10:49:54 -08:00
John Baldwin
9134d9265c bsd.sys.mk: Add NO_WZERO_LENGTH_BOUNDS helper variable.
This variable expands to -Wno-zero-length-bounds on GCC 10+.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D37537
2022-12-04 16:29:55 -08:00
John Baldwin
ad96424e31 bsd.sys.mk: Add NO_WDANGLING_POINTER helper variable.
This variable expands to -Wno-dangling-pointer on GCC 12+.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D37532
2022-12-04 16:26:48 -08:00
John Baldwin
442295c1fe Silence GCC warnings when using libc++ headers.
GCC 12 raises warnings about literal operator suffixes not preceded by
'_' in libc++ headers such as <string_view> as it doesn't recognize
libc++ headers being an implementation of the standard.

GCC 12 also warns about clang-specific pragmas in <locale>.

Disabling these warnings globally for all C++ code is not ideal, but
is a better option than patching libc++ headers to ignore these
warnings.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D37530
2022-11-30 14:53:29 -08:00
Ed Maste
a8f92d247e Enable -Wdate-time warning
This produces an "expansion of date or time macro is not reproducible"
warning or error upon use of __DATE__ or __TIME__.

Provide NO_WDATE_TIME for ports or 3rd party software to opt out.

This is a recommit of 489d7a8528, which was reverted (by baf8cbcd97)
due to ports build failures.

PR:		267902 [exp-run]
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29580
2022-11-30 13:59:57 -05:00
Warner Losh
0ecb616196 clang: Define NO_WDEPRECATED_NON_PROTOTYPE for clang 15
Clang 15 enforces function definitions using the C89 form rather than
the K&R form. While not strictly a prototype (which is only for a
declaration), use the name that mirror's clang's warning name. Much code
in contrib still uses K&R function definitions, so invent this for
compiling there.

Sponsored by:		Netflix
Reviewed by:		jhb
Differential Revision:	https://reviews.freebsd.org/D37515
2022-11-30 11:08:44 -07:00
John Baldwin
5115511ed4 Use __freebsd_kprintf__ with GCC 12+ similar to clang. 2022-11-22 08:36:12 -08:00
Ed Maste
20a66ab4bf Retire CLANG_IS_CC option
A small reduction in build infrastructure complexity; when we had both
Clang and GCC in the tree it was useful to have both built, and choose
one or the other to install as /usr/bin/cc.  Now only Clang is in the
tree, and there is no point in building and installing base Clang but
not providing it as cc (and c++, cpp).

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D37075
2022-11-21 14:56:13 -05:00
John Baldwin
adc3c128c6 src.opts.mk: Require C++20 for C++ support.
libc++ requires C++20, so mark C++ (MK_CXX) as broken if the compiler
does not support C++20.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D36893
2022-11-18 20:12:28 -08:00
John Baldwin
063b380f54 bsd.compiler.mk: Add a c++20 compiler feature.
This is enabled for clang versions 10+ and GCC versions 10+.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D36892
2022-11-18 20:11:59 -08:00
Warner Losh
8a744de27e stand: Remove i386-only support fire firewire
Remove support for booting off of firewire, and for having dcons via
firewire in the loader. Kernel support for these things is unchanged.
Discussed on arch@ and the current state is not working (and the build
was wrong to boot).

Sponsored by:		Netflix
Discussed:		https://lists.freebsd.org/archives/freebsd-arch/2022-November/000267.html
Reviewed by:		kevans, melifaro, emaste
Differential Revision:	https://reviews.freebsd.org/D37334
2022-11-18 10:43:59 -07:00
John Baldwin
f53dc31bb3 src.opts.mk: Disable all of LLVM if C++ support is disabled.
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D36891
2022-11-15 19:21:20 -08:00
Gordon Bergling
d835a2f8be bsd.sanitizer.mk: Fix a typo in a comment
- s/santizers/sanitizers/

MFC after:	3 days
2022-11-01 09:18:34 +01:00
Warner Losh
c07be2c53e make: Don't print as many ==> and -- xxx -- lines in meta mode
Since metamode just announces what it's doing, the extra -- xxx -- lines
aren't needed for recursive descent, nor are the ==> lines needed. This
speeds up rebuilding kernels a lot...

Sponsored by:		Netflix
Reviewed by:		sjg, bdrewery
Differential Revision:	https://reviews.freebsd.org/D37071
2022-10-29 10:13:54 -06:00
Souradeep Chakrabarti
9729f076e4 arm64: Hyper-V: enablement for ARM64 in Hyper-V (Part 3, final)
This is the last part for ARM64 Hyper-V enablement. This includes
commone files and make file changes to enable the ARM64 FreeBSD
guest on Hyper-V. With this patch, it should be able to build
the ARM64 image and install it on Hyper-V.

Reviewed by:	emaste, andrew, whu
Tested by:	Souradeep Chakrabarti <schakrabarti@microsoft.com>
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D36744
2022-10-27 13:53:22 +00:00
Brooks Davis
426fc376af bsd.cpu.mk: Introduce MACHINE_ABI
MACHINE_ABI is a list of properties of the ABI used for MACHINE_ARCH.
It should be used in place of long conditionals on MACHINE_ARCH where
practical.

The following properties are indicated with one of the follow values:

Byte order:                  big-endian, little-endian
Floating point ABI:          soft-float, hard-float
Size of long (size_t, etc):  long32, long64
Pointer type:                ptr32, ptr64
Size of time_t:              time32, time64

For example, i386 targets will be:
MACHINE_ABI=	big-endian hard-float long32 ptr32 time32

Reviewed by:	imp
Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D36421
2022-10-05 17:27:44 +01:00
John Baldwin
67b0751249 bsd.sys.mk: Add NO_WUSE_AFTER_FREE helper variable.
This variable expands to -Wno-use-after-free on GCC 12+.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D36817
2022-10-03 16:10:42 -07:00
Dag-Erling Smørgrav
0aa2700123 Put OPIE to rest.
Differential Revision: https://reviews.freebsd.org/D36592
2022-10-02 03:37:29 +02:00
John Baldwin
409dae262f bsd.sys.mk: Add NO_WARRAY_PARAMETER helper variable.
This variable expands to -Wno-array-parameter on GCC 11+.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D36756
2022-09-28 14:01:04 -07:00
Gordon Bergling
8dcfb0282d mk: Remove a double word in a comment
- s/to to/to/

MFC after:	3 days
2022-09-10 12:57:55 +02:00
Gleb Popov
20adba8bc1 src.conf: Introduce WITHOUT_MACHDEP knob.
Summary:
This knob can be used to make buildsystem prefer generic C implentations of
various functions, instead of machine-specific assembler ones.

Test Plan: `make buildworld` on amd64

Reviewed by: imp, emaste

Differential Revision: https://reviews.freebsd.org/D36076

MFC after:	3 days
2022-09-09 09:54:28 +03:00
Xin LI
4385a9f851 Fix build.
Pointy hat to:	delphij
MFC after:	2 weeks
X-MFC-with:	c65e42dbde
2022-09-06 23:41:10 -07:00
Xin LI
c65e42dbde libc: add test case for qsort_b(3)
Reviewed by: 	markj
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D36463
2022-09-06 23:11:46 -07:00
Alex Richardson
ac175bd33a Install working pkgconfig .pc files for compat libraries
The default ones are install them to /usr/libdata/pkgconfig, and we can't
use this path for compat libraries, so we use /usr/lib<suffix>/pkgconfigi here.

Test Plan:	grep -rn libdir= ./usr/lib32/pkgconfig/*.pc
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D34939
2022-08-11 23:18:34 +01:00
Brooks Davis
0c8ff61ee1 src.libnames.mk: NEED/WANT_COMPAT+static support
Look in _LIB_OBJTOP for all static libraries not just INTERNALLIBs. In
normal operation this is a no-op, but improves the consistency of this
file.

Reviewed by:	imp, jhb
Obtained from:	CheriBSD
Differential Revision:	https://reviews.freebsd.org/D35822
2022-07-28 18:55:01 +01:00
Jessica Clarke
fcf1208158 Makefile.inc1 release bsd.own.mk: Introduce and use TAR_CMD
Our uses of tar rely on BSDisms, and so do not work in environments
where GNU tar is the default tar. Providing a TAR_CMD variable like
some other commands allows it to be overridden to use bsdtar in such
cases.

Reviewed by:	brooks, delphij, gjb
Obtained from:	CheriBSD
Differential Revision:	https://reviews.freebsd.org/D35813
2022-07-15 23:04:34 +01:00
Xin LI
0bbf270296 libproc: replace home grown crc32 with zlib implementation.
MFC after:	2 weeks
Reviewed by:	markj
Differential Revision: https://reviews.freebsd.org/D35766
2022-07-10 16:31:35 -07:00
Brooks Davis
3bf6636512 cddl/*: add a WITH(OUT)_DTRACE option
Add an option to enable/disable DTrace without disabling ZFS.  New
architectures such as CHERI may support ZFS before they support DTrace
and the old model of WITHOUT_CDDL disabling both wasn't helpful.

For compatiblity, the CDDL option remains and WITHOUT_CDDL implies
WITHOUT_DTRACE.  WITHOUT_DTRACE also implies WITHOUT_CTF.

As part of this change, largely convert cddl/*/Makefile to using the
more compact SUBDIR.${MK_<FOO>}+= form rather than using intermediate
variables.

Reviewed by:	markj
Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D35718
2022-07-06 14:03:48 +01:00
Brooks Davis
724123b9f4 libcompat: Use WORLDTMP sysroot
Now that -m32 is fixed, just install libs in ${WORLDTMP}/lib/lib32
and use the installed headers.

Reviewed by:	imp, jhb
Obtained from:	CheriBSD
Differential Revision:	https://reviews.freebsd.org/D34697
2022-07-01 08:33:16 +01:00
Jessica Clarke
4ca6ecf100 Really fix cross-builds from macOS
LINKER_TYPE is set to mac not macos on macOS.

Fixes:	7927452ac4 ("Add RELRO build knob, default to enabled")
2022-06-30 22:08:31 +01:00
Ed Maste
7927452ac4 Fix cross-builds from macOS
The macOS linker does not support -zrelro/-znorelro.  Since it is only
used to for build tools that run on the host, and WITH_RELRO or
WITHOUT_RELRO does not matter there, just skip the option.

Reviewed by:	markj
Fixes:		2f3a961487 ("Add RELRO build knob, default to enabled")
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35589
2022-06-27 10:22:12 -04:00
Alexander V. Chernikov
924226fba1 testing: move atf-pytest-wrapper to /usr/libexec
Move pytest wrapper to the collection of the other atf wrappers
 in libexec. It solves the problem of combining bits & pieces from
 bsd.test.mk and bgs.prog.mk to address "test binary, but not the
 suite binary".

Reviewed by:	kp
Differential Revision: https://reviews.freebsd.org/D35604
MFC after:	2 weeks
2022-06-26 13:25:47 +00:00
Alexander V. Chernikov
8eb2bee6c0 testing: Add basic atf support to pytest.
Implementation consists of the pytest plugin implementing ATF format and
a simple C++ wrapper, which reorders the provided arguments from ATF format
to the format understandable by pytest. Each test has this wrapper specified
after the shebang. When kyua executes the test, wrapper calls pytest, which
loads atf plugin, does the work and returns the result. Additionally, a
separate python "package", `/usr/tests/atf_python` has been added to collect
code that may be useful across different tests.

Current limitations:
* Opaque metadata passing via X-Name properties. Require some fixtures to write
* `-s srcdir` parameter passed by the runner is ignored.
* No `atf-c-api(3)` or similar - relying on pytest framework & existing python libraries
* No support for `atf_tc_<get|has>_config_var()` & `atf_tc_set_md_var()`.
 Can be probably implemented with env variables & autoload fixtures

Differential Revision: https://reviews.freebsd.org/D31084
Reviewed by:	kp, ngie
2022-06-25 19:25:15 +00:00
Ed Maste
2f3a961487 Add RELRO build knob, default to enabled
Note that lld enables relro by default, so that we already had either
partial or full RELRO, depending on the state of the BIND_NOW knob.

Add a RELRO knob so that the option can be disabled if desired, and so
that builds using the GNU toolchain are equivalent to those using the
standard Clang/LLVM toolchain.

Reviewed by:	markj
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35545
2022-06-22 12:18:41 -04:00
Konstantin Belousov
4f79bd4a1a src.libnames.mk: add more lib variables
Submitted by:	hselasky
Reviewed by:	jhb
Sponsored by:	NVIDIA Networking
MFC after:	3 weeks
Differential revision:	https://reviews.freebsd.org/D32551
2022-05-24 23:59:33 +03:00
Bartosz Sobczak
cdcd52d41e
irdma: Add RDMA driver for Intel(R) Ethernet Controller E810
This is an initial commit for RDMA FreeBSD driver for Intel(R) Ethernet
Controller E810, called irdma.  Supporting both RoCEv2 and iWARP
protocols in per-PF manner, RoCEv2 being the default.

Testing has been done using krping tool, perftest, ucmatose, rping,
ud_pingpong, rc_pingpong and others.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>

Reviewed by:	#manpages (pauamma_gundo.com) [documentation]
MFC after:	1 week
Relnotes:	yes
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D34690
2022-05-23 16:52:49 -07:00
Cy Schubert
e343ebbfbe src.libnames: Replace redundant += with =
The += for unique assignments is equivalent to =. Make these confusing
assignments simply assignments.

Reviewed by:		emaste
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D35242
2022-05-19 15:33:45 -07:00
Ed Maste
4143e4fb19 Hide -fuse-ld= not supported message for non-build targets
In some build configurations a warning about (an absolute path for)
-fuse-ld= not being supported by GCC was emitted during cleandir or
other non-build make targets.

For these non-build targets COMPILER_TYPE is set to "none" but we
treated the .else case for COMPILER_TYPE==clang as implying gcc.
Check instead for COMPILER_TYPE==gcc.

PR:		263913
Reported by:	pstef
Reviewed by:	pstef
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2022-05-12 10:59:06 -04:00
Alfredo Dal'Ava Junior
f9ee415674 build target triple variable from sys/conf/newvers.sh
Retrieve FreeBSD revision number directly from sys/conf/newvers.sh
when building the compiler target triple value, avoiding manual
intervention on other files every new release.

Reviewed by:	imp
MFC after:	2 months
Sponsored by:	Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision:	https://reviews.freebsd.org/D34429
2022-05-03 08:09:38 -03:00
Warner Losh
7df08a14e3 stand: Initial kboot support on amd64
Get amd64 compiling. However, the current kboot supports an old way of
enumerating memory and the new way needs to be incorporated as well. The
powerpc folks could use either, it seems and newer powerpc platforms
need some changes for kboot to work anyway.

This commit includes the linker script, trampoline code to start the new
kernel, Linux system calls and the necessary configuration glue needed
to build the binaries.

This includes a quick hack to get multiboot support, but we need to
really share these defines. The multiiboot2.h is the minimum needed to
build. We have multiboot information in three places now, so a
refactoring is in order.

This should be considered, at best, preliminary and experimental for
anybody wishing to try it out.

Sponsored by:		Netflix
Reviewed by:		tsoome
Differential Revision:	https://reviews.freebsd.org/D35100
2022-05-01 11:13:39 -06:00
Simon J. Gerraty
525d1e204b Update dirdeps.mk
Latest dirdeps.mk is far more efficient when generating
DIRDEPS_CACHE.

Update dirdeps-options.mk to allow DEP_RELDIR to factor
into option processing. This is not very interesting if all
options are global.
2022-04-23 14:44:17 -07:00
Colin Percival
0967f7030c Install the recently added posix.mk file
This enables POSIX compatibility for Makefiles which start with
.POSIX:

Submitted by:	sjg
2022-04-12 13:05:55 -07:00
Cy Schubert
db2d56ca01 share/mk heimdal: Remove unnecessary trailing backslash
Remove the trailing backslash from the last list item. This is a NOP and
never bothered anything because the next line was a blank line. Remove
it for correctness sake.

MFC after:	3 days
2022-04-04 06:10:45 -07:00
Brooks Davis
cd8796cee0 share/mk: Remove obsolete reference to LINTLIBDIR
Lint support was removed in 1cbb58886a,
but this entry (accidently added in an unrelated commit) wasn't
removed.
2022-03-28 19:43:03 +01:00
Jessica Clarke
b58ea3e1f7 Fix hand-rolled METALOG entries for installconfig during distributeworld
During distributeworld we call distribute on subdirectories, which in
turn calls installconfig. However, this recursive installconfig call
appends the distribution name (in these cases, "base") to DESTDIR. For
install(1) this works fine as its -D argument comes from the top-level
Makefile.inc1, which passes the original DESTDIR, thereby resulting in
the METALOG entry having the distribution name as a prefix representing
its true installed path relative to the root, but for the hand-rolled
entries they do not use install(1) and thus do not have access to what
the original DESTDIR was, resulting in the METALOG missing this prefix.

Thus, pass down the name of the distribution via a new variable DISTBASE
(chosen as Makefile.inc1 already uses that to convey this exact same
information to etc's distrib-dirs during distributeworld) and prepend
this to the handful of manually-generated METALOG entries. For the
installworld case this variable will be empty and so this behaves as
before.

Note that we need to be careful to avoid double slashes in the METALOG;
distributeworld uses find | awk to split the single METALOG up into
multiple dist.meta files, and this relies on the paths in the METALOG
having the exact prefix ./dist (or ./dist/usr/lib/debug).

Reviewed by:	brooks, emaste
Differential Revision:	https://reviews.freebsd.org/D33997
2022-02-28 22:36:39 +00:00
Ed Maste
9aa786cbb5 src.libnames.mk: add a comment explaining libssp_nonshared
libssp_nonshared is a special case for (only) i386 and power*.  Add a
comment explaining why, based on the original commit message that added
it.

MFC after:	1 week
Fixes:		0f61170882 ("libssp_nonshared: use only on i386 and ppc")
Sponsored by:	The FreeBSD Foundation
2022-02-22 16:22:03 -05:00
Ed Maste
baf8cbcd97 Revert "Enable -Wdate-time warning"
This reverts commit 489d7a8528.

The flag leaks into some port builds, causing them to fail.  I will
recommit it with some sort of opt-out later on.

Reported by:	mi
2022-02-20 19:16:40 -05:00
Joerg Wunsch
a52d8d4a6c
share/mk: Fix obvious typo in README (TAREGT -> TARGET)
MFC after:	1 week
2022-02-20 17:26:04 +01:00
John Baldwin
2f6a842484 Disable -Wreturn-type on GCC.
GCC is more pedantic than clang about warning when a function doesn't
handle undefined enum values (see GCC bug 87950).  Clang's warning
gives a more pragmatic coverage and should find any real bugs, so
disable the warning for GCC rather than adding __unreachable
annotations to appease GCC.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D34147
2022-02-14 11:48:47 -08:00
Ed Maste
8dc42f9804 Invert CPU arch test for LLDB default
LLDB currently defaults to enabled on all architectures except arm and
riscv64 (and can probably be enabled for 32-bit arm).  Switch to an
opt-out list.

Reviewed by:	pkubaj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34218
2022-02-09 19:11:00 -05:00
Ed Maste
489d7a8528 Enable -Wdate-time warning
This produces an "expansion of date or time macro is not reproducible"
warning or error upon use of __DATE__ or __TIME__.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29580
2022-02-09 17:10:03 -05:00
Piotr Kubaj
d68224c2bd powerpc64le: enable CXGBETOOL and MLX5TOOL
While mlx5 is not yet enabled on powerpc64le, cxgbe is.
The binary seems to work properly.

Differential revision:	https://reviews.freebsd.org/D34026
Reviewed by:	emaste
2022-02-09 02:16:01 +01:00
Dimitry Andric
5f2aca8394 Disable clang 14 warning about bitwise operators in zstd
Parts of zstd, used in openzfs and other places, trigger a new clang 14
-Werror warning:

```
sys/contrib/zstd/lib/decompress/huf_decompress.c:889:25: error: use of bitwise '&' with boolean operands [-Werror,-Wbitwise-instead-of-logical]
                        (BIT_reloadDStreamFast(&bitD1) == BIT_DStream_unfinished)
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

While the warning is benign, it should ideally be fixed upstream and
then vendor-imported, but for now silence it selectively.

MFC after:	3 days
2022-02-08 21:46:08 +01:00
John Baldwin
c227269e2f Stop adding -Wredundant-decls to CWARNFLAGS.
clang doesn't implement it, and Linux doesn't enforce it.  As a
result, new instances keep cropping up both in FreeBSD's code and in
upstream sources from vendors.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D34144
2022-02-07 12:47:51 -08:00
John Baldwin
bca92be683 Remove more quotes around Makefile .error/.warn/.info strings.
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D34175
2022-02-04 15:59:53 -08:00
John Baldwin
ffe74ab77f bsd.compat.mk: A few cosmetic fixes.
- Add a missing ')' to a warning.

- Consistently use {} when expanding variables.

- Remove a spurious blank line.

Reviewed by:	imp, emaste
Obtained from:	CheriBSD
Differential Revision:	https://reviews.freebsd.org/D34172
2022-02-04 15:57:28 -08:00
Piotr Kubaj
0b2d2290fe powerpc: Enable LLDB on all powerpc architectures
While LLDB on powerpc and powerpcspe builds as-is, on powerpc64 and
powerpc64le it requires adding a couple of additional source files
to build.

Differential review:	https://reviews.freebsd.org/D34043
Approved by:	dim, imp, emaste
2022-01-26 15:03:27 +01:00
John Baldwin
42e51b158a Stop trying to strip 'eb' suffixes from ARM MACHINE_ARCH.
armeb is no longer a supported MACHINE_ARCH.

Reviewed by:	imp, emaste
Sponsored by:	The University of Cambridge, Google Inc.
Differential Revision:	https://reviews.freebsd.org/D34019
2022-01-25 11:37:29 -08:00
Eric van Gyzen
d7f944a046 Allow downstream projects to easily add private and internal libs
Allow projects based on the FreeBSD tree to append to _PRIVATELIBS
and _INTERNALLIBS by simply maintaining their own lists of
LOCAL_PRIVATELIBS and LOCAL_INTERNALLIBS, respectively.

Reviewed by:	bdrewery
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D33901
2022-01-14 10:19:19 -06:00
Emmanuel Vadot
9b6aa99e1f Revert "Introduce MODULES_EXCLUDE"
This is already present as WITHOUT_MODULES

This reverts commit 8c0c5bdf9d.

Reported by:	jrtc27
2022-01-13 15:59:47 +01:00
Emmanuel Vadot
8c0c5bdf9d Introduce MODULES_EXCLUDE
It's sometimes easier to exclude some modules rather than listing all
possibly needed ones with MODULES_OVERRIDE.
So for this add MODULES_EXCLUDE which do exactly as one would guess, excludes
some modules from the build/install.

For example if one wants to exclude all modules which are only present in the
GENERIC config on amd64 :
export MODULES_EXCLUDE=$(grep -E '^device' sys/amd64/conf/GENERIC | awk '{print $2}' | tr '\n' ' ')

MFC after:	2 weeks
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D33443
2022-01-13 15:16:34 +01:00
Warner Losh
f84135f699 libsoft: Remove
libsoft was a transition from the FreeBSD/armv6 10 (and earlier) with
'softfp' ABI (that is, hardware float, but passed as integer registers)
to the 'hardfp' ABI that was in FreeBSD/armv[67] in FreeBSD 11 and
newer. It's been off by default since it was created.

This was mostly used by people that wanted to do a source upgrade of
their system from FreeBSD 10 to 11 or from 11-current before the cutover
to 11-current after. This should not be confused with the full software
floating point implementation (that doesn't use the hardware floating
point instructions at all) that is used out of tree by at least one
company selling armv7 gear that has no FPU.

There's no longer a need for the transition, so retire it like should
likely have happened sometime before FreeBSD 12 was released 3 years
ago.

Sponsored by:		Netflix
Suggestions by:		jrtc27, jhb
Reviewed by:		manu, mmel
Differential Revision:	https://reviews.freebsd.org/D33761
2022-01-06 22:44:07 -07:00
Warner Losh
b68d6892ba libsoft: Remove targets to generate libsoft
Remove the targets needed to make and install libsoft.

Sponsored by:		Netflix
2022-01-06 22:34:15 -07:00
Warner Losh
81ec547fbd bsd.endian.mk: Allow for the cross building case
We need to include bsd.endian.mk from bsd.compiler.mk to enable
compressed symbols only on FreeBSD little endian targets.

However, since we include bsd.compiler.mk from Makefile.inc1 and from
the build tools makefiles, it has to work on Linux and osx. Make the
error condition only when we're building natively (so that we are
forced to add a new architecture to the list).

Otherwise, define bogus, poisoned values and leave TARGET_ENDIANNESS
undefined.  Since we don't actually use TARGET_ENDIANNESS for anything
in the cross building phase, these values are a failsafe agianst their
use. The one place in the build phase that detects endian is
appropriately protected.

Sponsored by:		Netflix
Reviewed by:		jrtc27
Differential Revision:	https://reviews.freebsd.org/D33742
2022-01-04 16:17:17 -07:00
Warner Losh
d373e61ef3 bsd.endian.mk: Sort architecture list
Sort arm alphabetically.

Reviewed by:		emaste
Differential Revision:	https://reviews.freebsd.org/D33744

Sponsored by:		Netflix
2022-01-04 13:57:47 -07:00
Warner Losh
b94ed3bc5a sys.mk: Stop rewriting mips* to get MACHINE_CPUARCH
With mips no longer supported, we can GC the substitution from here.

Sponsored by:		Netflix
2022-01-03 08:00:09 -07:00
Warner Losh
ad0a65469a bsd.endian.mk: Remove arm big endian
Remove vestiges of arm big endian support. Also use the more proper
MACHINE_CPUARCH instead of MACHINE to test for that here.

This leaves powerpc as the only big endian arch.

Sponsored by:		Netflix
2022-01-03 08:00:09 -07:00
Warner Losh
577075538c bsd.endian.mk: Remove mips
Remove the enumeration of the big vs little endian platform names.

Sponsored by:		Netflix
2022-01-03 08:00:09 -07:00
Warner Losh
69ee64c1c2 src.opts.mk: Remove most of the mips support
Mips had a number of special cases that disabled features that didn't
work. Remove them all. However, retain the llvm mips bits because that
requires a lot more effort to unwind and will be done separately.

Sponsored by:		Netflix
2022-01-03 08:00:09 -07:00
Warner Losh
8d6197929d meta: Remove mips support
Mips is no longer a supported target, remove it.

Sponsored by:		Netflix
2022-01-03 08:00:08 -07:00
Warner Losh
9b93d7589a bsd.cpu.mk: Remove mips support
Remove the tweaks to the compiler, as well as additional command line
args to get the proper endian, word size and floating style.

Sponsored by:		Netflix
2022-01-03 08:00:08 -07:00
Warner Losh
539d322082 bsd.compat.mk: Remove support for mips64
No longer need to care about mips32 binaries on mips64 for lib32
support.

Sponsored by:		Netflix
2022-01-03 08:00:08 -07:00
Warner Losh
98e58025a5 bsd.lib/prog.mk: Remove special case for mips
We no longer need to set the TLS model for mips64*.

Sponsored by:		Netflix
2022-01-03 08:00:08 -07:00
Warner Losh
d889875b78 bsd.opts.mk: Remove mips support
We don't need to list all the 32-bit mips variants here anymore.

Sponsored by:		Netflix
2022-01-03 08:00:08 -07:00
Warner Losh
e0281204cc Add clarifying comments
Expand on the terse comments for where each of these files is used.

Reviewed by:		emaste
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D33716
2022-01-02 00:30:58 -07:00
Warner Losh
1a7ed7fe93 kboot: Add MK_LOADER_KBOOT
Control building of KBOOT same as we do for uboot.

Sponsored by:		Netflix
Reviewed by:		tsoome
Differential Revision:	https://reviews.freebsd.org/D33511
2021-12-30 16:06:28 -07:00
John Baldwin
6378393308 Add an internal libiscsiutil library.
Move some of the code duplicated between ctld(8) and iscsid(8) into a
libiscsiutil library.

Sharing the low-level PDU code did require having a
'struct connection' base class with a method table to permit separate
initiator vs target behavior (e.g. in handling proxy PDUs).

Reviewed by:	mav, emaste
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D33544
2021-12-22 10:43:11 -08:00
Piotr Kubaj
40218ffe8c riscv64*: enable OFED
Summary:
OFED on riscv64 builds fine, so it's ok to enable it.

Also MFC to stable/13.

Test Plan: make buildworld

Reviewers: mhorne

Subscribers: bdrewery, imp, emaste

Differential Revision: https://reviews.freebsd.org/D33602
2021-12-21 18:41:57 +01:00
Simon J. Gerraty
3b26e5a453 Update dirdeps.mk et al to 20211212 versions
dirdeps.mk: simplify computation of qualified vs unqualified dirdeps.
	Note the importance of avoiding unresolved variables in DIRDEPS
	Fix DIRDEP_LOADAVG_REPORT - expr(1) fails if expression evaluates to 0
	Trim ${SRCTOP}/ from debug etc messages to make comparison easier.
	Include number of DIRDEPS in debug output.
	Trim ${SRCTOP}/ when exporting to env while building DIRDEPS_CACHE
	to help avoid env exhaustion.
	Use DIRDEPS_ALL_MACHINES_FILTER to better handle ALL_MACHINES
	in complex build environments.

dirdeps-options.mk: use separate .undef for each variable

dirdeps-targets.mk: allow for '.' in DIRDEPS_TARGETS_DIRS

meta.autodep.mk: leverage ${.SUFFIXES} if we can.

meta.sys.mk: allow use in META_MODE vs DIRDEPS_BUILD

meta2deps.py: compute a list of dirdep extensions that map to current
	TARGET_SPEC to avoid confusion.

Reviewed by: stevek
2021-12-18 13:37:07 -08:00
Warner Losh
9dc70af83e stand/uboot: reorg
Build uboot ubldr and friends like we build efi binaries
o move everything to be under stand/uboot
o md code goes in arch/$ARCH
o move everything over from the library
  - Had to rename console.c, disk.c and module.c due to conflicts
o update version to 1.5 to reflect the new way of building

This results in a more consistent build system and should represent no
functional change, apart from powerpc version getting new help
file. Also, moved to exlcuding uboot on powerpc64le by using
BROKEN_OPTION instead of the incidental exclusion we had before due to
Makefile reorgs.

Sponsored by:		Netflix
Feedback by:		stevek, jrtc27
Differential Revision:	https://reviews.freebsd.org/D33362
2021-12-14 21:09:53 -07:00
Warner Losh
4dbc7835cd mips: Turn off LLVM MIPS targets by default
Now that MIPS isn't a recognized target for buildworld, move llvm mips
to off by default.

Sponsored by:		Netflix
Reviewed by:		dim
Differential Revision:	https://reviews.freebsd.org/D33364
2021-12-10 11:31:07 -07:00
Ed Maste
2a31cd215d Apply ASAN/UBSAN Makefile check only for build target
COMPILER_TYPE is not set during cleandir and perhaps other non-build
targets, and a build with ASAN or UBSAN enabled failed with an error
reporting that runtime libraries could not be built.

PR:		260099
Reviewed by:	dim
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32805
2021-12-08 17:02:45 -05:00
Jessica Clarke
70f1e13491 src.libnames.mk: Extend _DP_archive hack when bootstrapping on non-FreeBSD
On Linux, libcrypto is available so a non-WITHOUT_OPENSSL build happens
to work, but on macOS it isn't available to be linked against (though
there is a versioned dylib for /usr/bin/openssl etc), and neither have
libmd so would both be broken under WITHOUT_OPENSSL. Since we're using
the system libarchive, further extend the hack to ensure _DP_archive is
empty.

Fixes:		ed4050750c ("src.libnames.mk: Add hack to workaround libarchive not being bootstrapped")
MFC after:	1 week
2021-12-07 00:24:20 +00:00
Jessica Clarke
f0a6ab51e6 src.libnames.mk: Include dependencies when bootstrapping from non-FreeBSD
When bootstrapping on FreeBSD we use -DNO_SHARED so this case is already
handled correctly, but on non-FreeBSD we set NO_SHARED to no in
Makefile.boot.pre as not all OSes have static libraries available. As a
result, users of libdwarf fail to link during the cross tools stage due
to the newly-introduced dependency of libdwarf on libz.

This should perhaps be reworked to instead leave NO_SHARED as yes but
have an override (either implicit in bsd.prog.mk, or explicit via a new
variable) to turn off just the use of -static.

MFC after:	1 week
2021-12-06 19:16:27 +00:00
Jessica Clarke
ed4050750c src.libnames.mk: Add hack to workaround libarchive not being bootstrapped
We don't currently honour _DP_foo when bootstrapping on non-FreeBSD, and
so none of these values matter, but the next commit will change that as
we do need to pull in dependencies for libdwarf. We should really be
bootstrapping our libarchive for ar anyway rather than using the host's,
as well as have a better way to communicate to src.libnames.mk whether
or not a library is being bootstrapped.

MFC after:	1 week
2021-12-06 19:16:27 +00:00
Mark Johnston
dbf05458e3 libdwarf: Support consumption of compressed ELF sections
Automatically decompress zlib-compressed debug sections when loading
them.  This lets ctfcovert work on userland code after commit
c910570e75 ("Use compressed debug in standalone userland debug files
by default").

Reported by:	avg
Reviewed by:	avg, emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33139
2021-12-06 10:37:49 -05:00
Ed Maste
fc073e6743 Move _p.a profiling archives under MK_INSTALLLIB
_p.a are just a special case of .a archives, and should not be installed
if WITHOUT_INSTALLLIB is set.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-12-04 16:32:26 -05:00
Andrew Turner
629b5e87ed Add an arm64 sha512 feature check
This is only available in recent toolchains. Check for it so we can
use it in libmd.

Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33166
2021-12-01 15:14:57 +00:00
Baptiste Daroussin
1cd0117ff6 ncurses: libform is installed as libformw
Reported by:	many
2021-11-24 13:58:17 +01:00
Baptiste Daroussin
37d0601f42 bsddialog: import new TUI widget and utility
bsddialog is an attempt to write in permissive license a replacement for
libdialog.

While it is still in early stage it is good enough to already be used in
many areas, it is imported as private lib until it matures enough to be
considered as having a stable ABI
2021-11-24 11:03:31 +01:00
Baptiste Daroussin
a46722b580 ncurses: register formw as usable lib for LIBADD 2021-11-24 11:02:22 +01:00
Greg V
9e9c651cac cddl: fix missing ZFS library dependencies
In 9fae47666 zfsd got a libspl dependency to avoid undefined references.
However that workaround did not help external consumers of libzfs_core.

Fix all missing dependencies lld 13 and the rtld complain about.

Reviewed by:	freqlabs, markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D32521
2021-11-15 09:42:07 -05:00
Ed Maste
0e1c864898 src.opts.mk: Add WITHOUT_CXX dependencies
OFED, OPENMP, and PMC depend on C++ support.  Force them off when
building WITHOUT_CXX.

Reported by:	Michael Dexter, Build Option Survey
Reviewed by:	imp, jrtc27
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32730
2021-10-29 10:06:27 -04:00
Ed Maste
6940d0e470 Force WITHOUT_OPENSSL_KTLS off when WITHOUT_OPENSSL
Discussed with:	jhb
MFC after:	1 week
Reported by:	Michael Dexter, Build Option Survey
Sponsored by:	The FreeBSD Foundation
2021-10-28 19:04:14 -04:00
Ed Maste
7b1e19ad78 Add libfido2 to the build
From https://github.com/Yubico/libfido2:

    libfido2 provides library functionality and command-line tools to
    communicate with a FIDO device over USB, and to verify attestation
    and assertion signatures.

    libfido2 supports the FIDO U2F (CTAP 1) and FIDO 2.0 (CTAP 2)
    protocols.

libfido2 will be used by ssh to support FIDO/U2F keys. It is currently
intended only for use by ssh, and so is installed as a PRIVATELIB and is
placed in the ssh pkgbase package.

This is currently disabled for the 32-bit library build as libfido2 is
not compatible with the COMPAT_32BIT hack in usb_ioctl.h.

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32448
2021-10-22 19:57:57 -04:00
Ed Maste
2e85df652c Add libcbor to the build
From https://github.com/PJK/libcbor:

    libcbor is a C library for parsing and generating CBOR, the general-
    purpose schema-less binary data format.

libcbor will be used by ssh to support FIDO/U2F keys.  It is currently
intended only for use by ssh, and so is installed as a PRIVATELIB and is
placed in the ssh pkgbase package.

cbor_export.h and configuration.h were generated by the upstream CMake
build.  We could create them with bmake rules instead (as NetBSD has
done) but this is a fine start.

This is currently disabled for the 32-bit library build as libfido2 is
not compatible with the COMPAT_32BIT hack in usb_ioctl.h, and there is
no need for libcbor without libfido2.

Reviewed by:	kevans
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32347
2021-10-15 15:10:24 -04:00
Baptiste Daroussin
9294a2c719 ncurses: convert libncursesw.a into a static ldscript
Introduce the notion of static linker scripts to allow libncursesw.a to
track its dependency on libtinfow.a

this allows the build of older freebsd source tree to happen and make
static linking in part with dynamic linking which already provides a
ldscript

This fixes a bootstrapping FreeBSD 12 or 13 on recent FreeBSD 14

Reviewed by:		imp
Differential Revision:	https://reviews.freebsd.org/D32435
2021-10-10 07:51:00 +02:00
Warner Losh
15575aca87 bsd.cpu.mk: Minor formatting for armv6 vs armv7
Separate out the arch/cpu options for armv6 from the armv7 ones. This is
less confusing.

Sponsored by:		Netflix
2021-10-08 15:44:46 -06:00
Baptiste Daroussin
cbc83e378a ncurses: chase dependency changes in the source tree
Differential Revision:	https://reviews.freebsd.org/D32098
2021-10-04 11:38:24 +02:00
Baptiste Daroussin
396851c20a ncurses: split libtinfo from libncurses
many external program expects libncurses to not be provided as a single
library. Instead of fixing all ports, distribute ncurses the way
upstream distributes it

Turn libncursesw.so into a ldscript which will link automatically as
needed to libtinfow so so this change is seamless at compile time.

Differential Revision:	https://reviews.freebsd.org/D32098
2021-10-04 11:38:21 +02:00
John Baldwin
93d6fa53c9 Disable -Woverflow errors for i386 for GCC 9.
GCC 9 warns about floating point constants overflowing for i386.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D26201
2021-09-13 11:00:38 -07:00
Dimitry Andric
45feade38e Add -Wno-error=unused-but-set-variable when building with Clang 13+
This warning triggers many times while building world. Downgrade it to a
warning until all occurrences have been fixed. Once the Clang warnings
have been fixed we should be able to turn it on for GCC as well. See
also f4fed768bb which did the same for the
kernel builds.

Reviewed by:	arichardson, imp
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D31927
2021-09-13 18:05:43 +02:00
Edward Tomasz Napierala
ddedf2a11e tzcode: Implement timezone change detection
Implement optional timezone change detection for local time libc
functions.  This is disabled by default; set WITH_DETECT_TZ_CHANGES
to build it.

Reviewed By:	imp
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
X-NetApp-PR:	#47
Differential Revision:	https://reviews.freebsd.org/D30183
2021-09-12 03:07:58 +00:00
Alex Richardson
2d78130185 Add missing dep patterns for .pieo
While adding sanitizer support, I noticed that all other extensions were
handled but .pieo was missing.

Reviewed By:	emaste, imp
MFC after:	1 week

Differential Revision: https://reviews.freebsd.org/D31040
2021-09-13 13:22:31 +01:00
Ed Maste
7c0226cad3 bsd.lib.mk: add conditions for building _pie.a archives
As with other .a targets, build _pie.a archives only if LIB is set.

At present we build _pie.a only for INTERNALLIBs, and none of them
include bsd.lib.mk without setting LIB.  However, we might want to build
_pie.a for non-INTERNALLIBs in the future.

Reviewed by:	arichardson
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31920
2021-09-13 07:52:02 -04:00
Alex Richardson
24f586182f Enable MK_LLVM_BINUTILS if MK_ASAN is requested
ASan will not be able to provide backtraces with symbol names with
elftoolchain's addr2line. To fix this turn MK_LLVM_BINUTILS on by
default when ASan instrumentation is requested.

Reviewed By:	emaste, markj
Differential Revision: https://reviews.freebsd.org/D31061
2021-09-06 10:24:34 +01:00
Alex Richardson
021385aba5 Add WITH_LLVM_BINUTILS to install LLVM binutils instead of Elftoolchain
When WITH_LLVM_BINUTILS is set, we will install the LLVM binutils as
ar/ranlib/nm/objcopy/etc. instead of the elftoolchain ones.
Having the LLVM binutils instead of the elftoolchain ones allows us to use
features such as LTO that depend on binutils that understand LLVM IR.
Another benefit will be an improved user-experience when compiling with
AddressSanitizer, since ASAN does not symbolize backtraces correctly if
addr2line is elftoolchain addr2line instead of llvm-symbolizer.
See https://lists.freebsd.org/archives/freebsd-toolchain/2021-July/000062.html
for more details.

This is currently off by default but will be turned on by default at some
point in the near future.

Reviewed By:	emaste

Differential Revision: https://reviews.freebsd.org/D31060
2021-09-06 09:49:49 +01:00
Alex Richardson
e7e22476d1 Don't default MK_LLVM_TARGET_ALL to yes unless MK_CLANG is requested
When building -DWITH_LLVM_BINUTILS -DWITHOUT_CLANG, this avoids
building a few hundred C++ source files that should not be needed
by default.

Reviewed By:	emaste
Differential Revision: https://reviews.freebsd.org/D31059
2021-09-06 09:31:25 +01:00
Dimitry Andric
22b8ab15c4 Remove -simplifycfg-dup-ret from CLANG_OPT_SMALL flags for clang 13
After llvm/clang 13.0.0, the -simplifycfg-dup-ret backend flag is no
longer supported. This was part of CLANG_OPT_SMALL, which is only still
used for stand/i386/boot2 and stand/i386/isoboot, to achieve the very
small binary size required. Luckily clang 13.0.0 does not need any
additional flags for this (I get 240 bytes available when building
boot2).

MFC after:	3 days
2021-08-29 15:39:16 +02:00
Jessica Clarke
83ec48b792 Revert "Mark LLDB/CLANG_BOOTSTRAP/LLD_BOOTSTRAP as broken on non-FreeBSD for now"
The fixes for this have now been committed so we can re-enable these.

This reverts commit d9f25575a2.

MFC after:	1 week
2021-08-24 15:04:25 +01:00
Jessica Clarke
c8edd05426 clang: Support building with GCC and DEBUG_FILES disabled
If MK_DEBUG_FILES=no then the Clang link rule has clang as .TARGET,
rather than clang.full, causing the implicit ${CFLAGS.${.TARGET:T}} to
be CFLAGS.clang, and thus pull in flags intended for when your compiler
is Clang, not when linking Clang itself. This doesn't matter if your
compiler is in fact Clang, but it breaks using GCC as, for example,
bsd.sys.mk adds -Qunused-arguments to CFLAGS.clang. This is seen when
trying to build a bootstrap toolchain on Linux where GCC is the system
compiler.

Thus, introduce a new internal NO_TARGET_FLAGS variable that is set by
Clang to disable the addition of these implicit flags. This is a bigger
hammer than necessary, as flags for .o files would be safe, but that is
not needed for Clang.

Note that the same problem does not arise for LDFLAGS when building LLD
with BFD, since our build produces a program called ld.lld, not plain
lld (unlike upstream, where ld.lld is a symlink to lld so they can
support multiple different flavours in one binary).

Suggested by:	sjg
Fixes:		31ba4ce889 ("Allow bootstrapping llvm-tblgen on macOS and Linux")
MFC after:	1 week
Reviewed by:	dim, imp, emaste
Differential Revision:	https://reviews.freebsd.org/D31532
2021-08-24 15:04:25 +01:00
Alex Richardson
d9f25575a2 Mark LLDB/CLANG_BOOTSTRAP/LLD_BOOTSTRAP as broken on non-FreeBSD for now
I enabled these options again in 31ba4ce889,
but unfortunately only my specific build configuration worked whereas the
build with default options is still broken.
2021-08-17 17:44:52 +01:00
Jessica Clarke
cef65082ae bsd.compiler.mk: Fix cross-building from non-FreeBSD
On non-FreeBSD, the various MACHINE variables for the host when
bootstrapping can be missing or not match FreeBSD's naming, causing
bsd.endian.mk to be unable to infer the endianness. Work around this by
assuming it's unsupported.

Note that we can't check BOOTSTRAPPING here as Makefile.inc1 includes
bsd.compiler.mk before that is set, and so we are unable to catch errors
during buildworld itself when cross-building and bsd.endian.mk failed,
but such errors should also show up when building on FreeBSD.

Fixes:	47363e99d3 ("Enable compressed debug on little-endian targets")
2021-08-12 23:45:09 +01:00
Ed Maste
47363e99d3 Enable compressed debug on little-endian targets
Compressed debug was enabled by default in commit c910570e75, but
broke the build on big-endian targets, and so was disabled in
89ed2ecb14.

Older versions of LLD fail with big-endian compressed debug sections.
This was fixed in LLD upstream (commit c6ebc651b6fa) and merged to
FreeBSD main (commit d69d07569e) by dim.

External toolchains (e.g. the llvm12 package) will not yet have the fix.
These may be used to link against base system .a archives, so compressed
debug sections would cause trouble even though the base system is fixed.

Enable compressed debug sections again, for little-endian targets only.
As discussed on freebsd-hackers[1] I expect to undo this in the future
(using compressed debug everywhere), once fixed versions of lld are
widely available.

Note that to be pedantically correct we should check both the compiler
and the linker for compressed debug support, but given the external
toolchain constraint the extra complexity does not seem worthwhile.

[1] https://lists.freebsd.org/archives/freebsd-hackers/2021-August/000188.html

PR:		257638
Reported by:	jrtc27 [impact of .a archives]
Discussed with:	imp
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31454

Revert "Disable compressed debug by default"

This reverts commit 89ed2ecb14.
2021-08-08 13:31:28 -04:00
Ed Maste
fe52b7f60e Disable PROFILE option by default
Hardware based profiling (e.g. hwpmc) is much better and produces more
useful results.  Today the profiling lib archives (_p.a) serve no real
purpose other than increasing the library build time.

Both upstream and base system (in commit b762974cf4) Clang have been
modified to remove the special case for linking against these libraries.

Clang's -pg support and mcount() remain, so building with -pg can still
be used on code that the user builds; we just no longer provide prebuilt
libraries compiled with -pg.

Discussed on freebsd-hackers[1] / freebsd-current [2] in 2020 and
freebsd-arch [3] in 2021.  A deprecation notice was added in
commit 175841285e.

[1] https://lists.freebsd.org/pipermail/freebsd-hackers/2020-January/055551.html
[2] https://lists.freebsd.org/pipermail/freebsd-current/2020-January/075105.html
[3] https://lists.freebsd.org/archives/freebsd-arch/2021-June/000016.html

PR:		256873 [exp-run]
Reviewed by:	imp, jhb, kib
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30833
2021-08-07 20:24:36 -04:00
Greg V
362fef2f4a bsd.cpu.mk: add support for x86-64-v[234] levels as CPUTYPE
These are supported in LLVM 12 and GCC 11:

https://github.com/llvm/llvm-project/commit/012dd42e027e
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=324bec558e95584e8c1997575ae9d75978af59f1

Differential Revision:	https://reviews.freebsd.org/D29150
2021-08-06 09:33:37 -04:00
Ed Maste
89ed2ecb14 Disable compressed debug by default
In c910570e75 I enabled compressed debug sections, but it broke mips
and powerpc.  Disable it for now.

Reported by:	jenkins, manu
Sponsored by:	The FreeBSD Foundation
2021-08-05 08:36:00 -04:00
Ed Maste
c910570e75 Use compressed debug in standalone userland debug files by default
The compiler supports CFLAGS=-gz=zlib to compress .debug sections in
object files, libraries, and binaries.  Enable it to reduce disk usage
for standalone debug files (and /usr/obj).

Reviewed by:	dim, kevans
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29002
2021-08-04 16:08:40 -04:00
Mitchell Horne
1b8db4b4e3 arm: enable stack-smashing protection
With current generation clang/llvm it can pass all of our tests in
libc/ssp.

While here, remove the extra MACHINE_CPUARCH check for mips. SSP is
included in BROKEN_OPTIONS for this architecture in src.opts.mk, which
is enough to ensure normal builds won't set SSP_CFLAGS.

Reviewed by:	kevans, imp, emaste
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D31400
2021-08-04 15:23:22 -03:00
Alex Richardson
428a32edba Use .sinclude for bsd.sanitizer.mk
We don't install this file since MK_ASAN/MK_UBSAN is only supported for
src builds. However, some ports also use bsd.lib.mk/bsd.prog.mk so we
should not fail the build if it can't be included.

Reported by:	jkim
Fixes:		7bc797e3f3 ("Add build system support for ASAN+UBSAN instrumentation")
2021-08-03 10:38:20 +01:00
Alex Richardson
17d6371e4c Fix GCC and -DWITH_CLEAN build after 7bc797e3f3
Reported by:	kib
2021-08-02 16:03:05 +01:00
Alex Richardson
31ba4ce889 Allow bootstrapping llvm-tblgen on macOS and Linux
This is needed in order to build various LLVM binutils (e.g. addr2line)
as well as clang/lld/lldb.

Co-authored-by: Jessica Clarke <jrtc27@FreeBSD.org>
Test Plan:	Compiles on ubuntu 18.04 and macOS 11.4
Reviewed By:	dim
Differential Revision: https://reviews.freebsd.org/D31057
2021-08-02 14:36:03 +01:00
Alex Richardson
7bc797e3f3 Add build system support for ASAN+UBSAN instrumentation
This adds two new options WITH_ASAN/WITH_UBSAN that can be set to
enable instrumentation of all binaries with AddressSanitizer and/or
UndefinedBehaviourSanitizer. This current patch is almost sufficient
to get a complete buildworld with sanitizer instrumentation but in
order to actually build and boot a system it depends on a few more
follow-up commits.

Reviewed By:	brooks, kib, markj
Differential Revision: https://reviews.freebsd.org/D31043
2021-08-02 14:33:24 +01:00
Alex Richardson
f8147dad44 bsd.linker.mk: Detect LLD when built with PACKAGE_VENDOR
Recent versions of homebrew's LLD are built with PACKAGE_VENDOR (since
e7c972b606).
This means that the -v output is now
`Homebrew LLD 12.0.1 (compatible with GNU linkers)` and bsd.linker.mk no
longer detects it as LLD since it only checks whether the first word is
LLD. This change allow me to build on macOS again and should unbreak the
GitHub actions CI.

Reviewed By:	imp, uqs
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D31224
2021-07-20 16:10:22 +01:00
Bryan Drewery
6da773cb1c bsd.compiler.mk: Use CCACHE_PKG_PREFIX as ports now supports. 2021-07-12 12:52:52 -07:00
Warner Losh
d8514fa6f1 mk: LZMA_SUPPORT is unused
Retire LZMA_SUPPORT. It's unused since r332995.

Reviewed by:		delphij
PR:			244302
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D31088
2021-07-10 10:53:35 -06:00
Alex Richardson
2eb9ad4274 Simplify and speed up the kyua build
Instead of having multiple kyua libraries, just include the files as part
of usr.bin/kyua. Previously, we would build each kyua source up to four
times: once as a .o file and once as a .pieo. Additionally, the kyua
libraries might be built again for compat32. As all the kyua libraries
amount to 102 C++ sources the build time is significant (especially when
using an assertions enabled compiler). This change ensures that we build
306 fewer .cpp source files as part of buildworld.

Reviewed By:	brooks
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D30967
2021-07-02 09:21:05 +01:00
Piotr Kubaj
aa033e0b14 Enable OPENMP on riscv64* by default.
Differential revision:	https://reviews.freebsd.org/D30862
Approved by:	mhorne
2021-06-25 16:22:50 +02:00
Alex Richardson
ab0c68ba4a Emit an error when we seen absolute paths to .o files
This is usually an error caused by using an absolute path in SRCS. This
happened to me in 83c20b8a2d due to changing LDADD to SRCS.
I did not notice that this had created a .o file inside the source tree
since .gitignore contains "*.o" and therefore git did not report any
changes.

Adding this warning message to bsd.lib.mk/bsd.prog.mk should prevent
issues like this in the future.

There was exactly one case of an absolute OBJS path in the current source
tree but that was removed in e713d3a013.

Reviewed By:	emaste (earlier version), imp
Differential Revision: https://reviews.freebsd.org/D28467
2021-06-21 16:13:54 +01:00
Emmanuel Vadot
af5e40770e pkgbase: Put the mibs and defs in the bnsmp package
Differential Revision:	https://reviews.freebsd.org/D30756
Sponsored by:	Diablotin Systems
2021-06-19 17:50:03 +02:00
Jung-uk Kim
e80145525b bsd.cpu.mk: Correct MACHINE_CPU for Intel Alder Lake
Apparently Intel Alder Lake lacks AVX-512 instructions.

Fixes:		09e7341c5e "Catch up with Clang 12"
2021-06-14 19:06:03 -04:00
Jung-uk Kim
09e7341c5e Catch up with Clang 12.
Add "znver3" for AMD and "alderlake" and "sapphirerapids" for Intel.
2021-06-14 18:42:59 -04:00
John Baldwin
0333fad1b7 Remove svnlite.
Reviewed by:	bcr, imp, emaste
Differential Revision:	https://reviews.freebsd.org/D30737
2021-06-11 14:56:41 -07:00