Commit Graph

3823 Commits

Author SHA1 Message Date
Daniel Engberg
ed3fb74e44 share/mk/bsd.cpu.mk: Add AMD Zen 4 for x86
Main difference between older Zen variants is that this supports AVX-512

Reviewed by:	imp (previous version), emaste
Approved by:	emaste
Differential Revision:	https://reviews.freebsd.org/D41331
2023-08-20 23:54:29 +02:00
Enji Cooper
0c785f0602 Fix GoogleTest 1.14.0 import
- Prune headers and tests no longer installed after the upgrade.
- Remove GoogleTest-related files when MK_GOOGLETEST == no.
- Disable `-Werror` with gcc to unbreak the gcc12 CI run with
  `lib/googletest`. Any issues found by g++ will be filed
  upstream and hopefully resolved in a future version.
- Remove clang -Werror issues which are resolved in version 1.14.0 to
  avoid masking valid issues.

MFC after:	1 week
MFC with:	28f6c2f292
2023-08-18 19:33:58 -07:00
Warner Losh
d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Simon J. Gerraty
93ac817fae local.dirdeps.mk ensure tools/build is built if needed
If MK_host_egacy is yes, we need it built, make sure that happens.

Reviewed by:	stevek
2023-08-16 08:31:11 -07:00
Enji Cooper
28f6c2f292 Import GoogleTest 1.14.0
GoogleTest 1.14.0 now requires C++14 to build. Change
`googletest.test.inc.mk` to reflect this requirement.

Adjust the build integration logic to handle the new version of
GoogleTest (add/remove headers/sources as needed).

Tighten down warnings via `CXXFLAGS.clang` instead of ignoring all
warnings. Some new warnings snuck in after I did my last round of fix
submissions upstream.

Also address some overlinking added in the previous version import by
removing superfluous libraries.

===============================

Expect WhenDynamicCastToTest.AmbiguousCast to fail

This change reapplies the expected failure from 1.10.0.

Ref: https://github.com/google/googletest/issues/2172

MFC after:	2 weeks
Reviewed by:	asomers, emaste
Differential Revision:	https://reviews.freebsd.org/D41399

Merge commit '8ef491440fcaec96f899d73e08873426c78583a4' into googletest-v1.14.0-import
2023-08-10 02:32:33 -07:00
Stephen J. Kiernan
458e0c1b66 local.sys.dirdeps.mk: Allow CROSS_TARGET_FLAGS to be overridden
Use ?= when setting CROSS_TARGET_FLAGS so we do not override it
if another file already has set it.

Reviewed by:	sjg
Obtained from:	Juniper Networks, Inc.
2023-08-08 16:11:27 -04:00
Domagoj Stolfa
6de0222840 dtrace: Add WITH_DTRACE_ASAN
See commit 4ae6991228.  This version of
the commit avoids inadvertently changing SHLIBDIR for libdtrace.so.
2023-08-02 09:15:08 -04:00
Ed Maste
77f6be4484 retire SHARED_TOOLCHAIN knob
Toolchain components were historically statically linked.  They became
normal dynamically linked executables in commit 6ab18ea64d.  There is
no need to keep a special case build option for the toolchain; users who
want statically linked toolchain (or any other) components can use the
existing NO_SHARED knob.

Reviewed by:	dim, sjg
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41266
2023-08-01 20:13:22 -04:00
Mark Johnston
5cdaac92e1 dtrace: Revert the addition of WITH_DTRACE_ASAN
The follow-up fix triggers a lib32 build failure, revert everything
until the problem is addressed.
2023-08-01 13:03:10 -04:00
Jessica Clarke
2d01ce7f85 mk: Install bsd.compat.pre.mk
Reported by:	dchagin
Fixes:		5d6cb793d0 ("bsd.compat.mk Extract _ALL_LIBCOMPATS and add related variables")
2023-07-28 17:52:38 +01:00
Warner Losh
98d03dca9a universe: Demote armv6 to an extra architecture.
Per discussions over how to lighten the load of armv6, move it to an
extra arch. You can still build TARGET_ARCH=armv6 if you desire, but
it won't be built as part of 'make universe' without -DEXTRA_TARGETS.

Sponsored by:		Netflix
2023-07-27 22:30:41 -06:00
Val Packett
da6620e495 mk: fix unnecessary library relinking with incremental builds
Initial libs such as csu are always built (.PHONY), and their
installation to WORLDTMP was causing all the subsequent libraries to
be considered out-of-date even when in reality they were not. Use
install -C more consistently everywhere to avoid unnecessarily
updating the mtimes in WORLDTMP, fixing this problem.

This cut down my no-change buildworld time from 30 to 15 seconds.

Fixes: https://lists.freebsd.org/pipermail/freebsd-current/2016-May/061481.html
TODO.1

Reviewed by: sjg
Sponsored by: https://www.patreon.com/valpackett
Differential Revision:  https://reviews.freebsd.org/D39980
2023-07-27 14:55:16 -07:00
Domagoj Stolfa
4ae6991228 dtrace: Add WITH_DTRACE_ASAN
This option is a blanket for all the DTrace-related software. The option
when enabled passes in -fsanitize=address -fsanitize=undeifned, enabling
ASAN and UBSAN in the following components:

 - libdtrace
 - dtrace(1)
 - lockstat(1)
 - plockstat(1)

The option defaults to "no" and is intended as a developer aid.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D41157
2023-07-27 16:07:34 -04:00
Jessica Clarke
87177389b7 bsd.lib.mk: Automatically generate libcompat TAGS
Note that the pattern for matching is made slightly more specific, so as
to permit libcompats where one is a prefix of another (e.g. CheriBSD has
lib64 and lib64c).

Reviewed by:	brooks, jhb, emaste
Differential Revision:	https://reviews.freebsd.org/D41185
2023-07-27 05:10:46 +01:00
Jessica Clarke
5d6cb793d0 bsd.compat.mk Extract _ALL_LIBCOMPATS and add related variables
Adding these to a new bsd.compat.pre.mk will allow other parts of the
tree to iterate over the set of possible libcompats (upper and/or lower)
rather than having to hard-code the list.

Reviewed by:	brooks, jhb, emaste
Differential Revision:	https://reviews.freebsd.org/D41178
2023-07-27 05:10:43 +01:00
Mike Karels
a1b6757313 arm64 lib32: enable building of lib32 on arm64
Enable LIB32 option on aarch64, defaulting to YES; it had defaulted
to "broken".  Add required variables for how to compile lib32 on
arm.  Use /usr/include/arm for armv7 (32-bit) headers, analogous to
/usr/include/i386 on amd64.  Omit libomp from lib32; it is not
supported on armv7.

Reviewed by:	jrtc27
Differential Revision:	https://reviews.freebsd.org/D40945
2023-07-25 18:59:52 -05:00
Jessica Clarke
7f9318a022 bsd.linker.mk: Use :C not :S for regex
Whilst ^ and $ are supported with C, those are special cases, and
general regex syntax like groups and alternations are not. Use the
correct modifier so we get a version number out that's not 0 (which is
what happens when it can't be parsed by the later code).

Fixes:		c4177f5b41 ("bsd.linker.mk: Handle Xcode 15 linker identification")
MFC after:	1 week
2023-07-24 01:50:55 +01:00
Jessica Clarke
c4177f5b41 bsd.linker.mk: Handle Xcode 15 linker identification
The upcoming Xcode 15 introduces a new linker (called ld-prime or ld-new
in some documentation) to replace the classic ld64, which we need to
handle.

Previously, the linker would identify itself as:

  @(#)PROGRAM:ld  PROJECT:ld64-<version>

Now, there are two cases. When the classic ld64 is in use, it identifies
itself as:

  @(#)PROGRAM:ld-classic  PROJECT:ld64-<version>

When the new linker is in use, it identifies itself as:

  @(#)PROGRAM:ld  PROJECT:dyld-<version>

Thus, tweak the detection to allow a -classic suffix in the PROGRAM
string and to allow a dyld- prefix instead of an ld64- prefix on the
version number in the PROJECT string.

MFC after:	1 week
2023-07-24 01:34:17 +01:00
John Baldwin
92053e4f8a share/mk: Pass -znoexecstack to ld.bfd when linking libraries and programs.
lld assumes -znoexecstack by default whereas ld.bfd still defaults to
-zexecstack in the absence of .note.GNU-stack annotations.  Adding the
flags centrally avoids having to patch various libraries in the tree
as one-offs (e.g. OpenSSL 3 is the current thing generating new
warnings with ld.bfd).

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D41120
2023-07-20 16:37:46 -07:00
Jessica Clarke
1840dc06e1 bsd.compat.mk: Remove obsolete COMPAT_32BIT now it's unused
See commit 8fad2cda93 ("bsd.compat.mk: Provide new CPP and sub-make
variables") for the context behind this change.

Reviewed by:	emaste, brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D40932
2023-07-09 18:50:03 +01:00
Jessica Clarke
8fad2cda93 bsd.compat.mk: Provide new CPP and sub-make variables
Currently the only way to detect for a libcompat build is to consult
whether COMPAT_32BIT is defined (or equivalent, for downstreams with
other libcompats or past releases with libsoft as COMPAT_SOFTFP). There
are two issues with this:

1. COMPAT_32BIT is a new naming scheme that doesn't match the libcompat
   name, which is unnecessary deviation.
2. When multiple libcompats exist, everywhere that needs to detect a
   libcompat must check each variable in turn, despite the fact that it
   normally just wants to know if this is a libcompat build and perhaps
   what ${LIBCOMPAT} and/or ${libcompat} are for it.

As a result, far too many places in the tree need to know about the set
of possible libcompats.

Instead, introduce two new CPP and sub-make variables, COMPAT_LIBCOMPAT
and COMPAT_libcompat, which give the values for ${LIBCOMPAT} and
${libcompat} respectively, so that uses can be made parameterised. For
when code really does need to know the specific libcompat, Makefiles can
perform a string comparison, but the C preprocessor cannot, so introduce
an additional CPP-only COMPAT_LIB${LIBCOMPAT} which is intended to
replace the inconsistently-named COMPAT_32BIT (which will be removed in
future). Uses of this new variable should still be kept to a minimum,
however, given the code duplication needed for new libcompats.

Reviewed by:	emaste, brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D40922
2023-07-09 18:47:42 +01:00
Jessica Clarke
aa8567656e bsd.compat.mk: Fix indentation for alignment
Fixes:	91d7edd549 ("Generalise libcompat to be a list rather than a single option")
2023-07-07 20:17:19 +01:00
Greg Becker
642cd51102 libthr: Add src.conf variable WITHOUT_PTHREADS_ASSERTIONS
This patch fixes a bug which prevents building libthr without
_PTHREADS_INVARIANTS defined. The default remains to build libthr
with -D_PTHREADS_INVARIANTS. However, with this patch, if one builds
libthr with WITHOUT_PTHREADS_ASSERTIONS=true then the latency to
acquire+release a default pthread mutex is reduced by roughly 5%, and a
robust mutex by roughly 18% (as measured by a simple synthetic test on a
Xeon E5-2697a based machine).

Reviewed by:	jhb, kib, mjg
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40900
2023-07-07 04:45:09 +03:00
Simon J. Gerraty
84c84ae15b BOOT_MACHINE_DIR should be stand not boot
Reviewed by:	stevek
2023-06-29 12:02:27 -07:00
John Baldwin
d036adc4e9 bsd.sys.mk: Re-enable -Wunused-but-set-variable for clang 13+.
Reviewed by:	dim, emaste
Differential Revision:	https://reviews.freebsd.org/D40674
2023-06-28 12:27:43 -07:00
John Baldwin
39240ddf85 bsd.sys.mk: Stop muting -Wunused-but-set-variable for GCC.
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D40662
2023-06-28 11:13:58 -07:00
Jessica Clarke
91d7edd549 Generalise libcompat to be a list rather than a single option
Whilst the kernel can support any number of COMPAT_FOO, world can only
build a single libfoo. Upstream this isn't such an issue, since the only
option is lib32 anyway, but downstreams, such as CheriBSD, may wish to
support multiple at the same time. Thus, adjust the top-level Makefiles
to turn _LIBCOMPAT into a _LIBCOMPATS list that gets iterated over, and
adjust bsd.compat.mk to support this use-case.

For the normal NEED_COMPAT/WANT_COMPAT case, LIBCOMPATFOO remain set and
refer to the requested compat's, preserving the current interface. For
the top-level Makefiles those variables are no longer set (since there
is no longer "the" compat) and only the per-compat ones are available.

Reviewed by:	brooks, jhb, imp
Differential Revision:	https://reviews.freebsd.org/D40571
2023-06-28 00:10:49 +01:00
Ed Maste
b2dcde7e9e Assemble .s to .o using cc, not as
As of commit fd71da37d4 we no longer have an `as` in the default
toolchain.  Although we do not make use of this rule in the base system
some ports or downstream projects might.  Use `cc -x assembler` instead
of as.

Reviewed by:	arichardson
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35859
2023-06-25 22:03:19 -04:00
Piotr Kubaj
5581cf903f share/mk/bsd.cpu.mk: drop -mno-powerpc64
Clang doesn't have -mno-powerpc64.

Differential revision:	https://reviews.freebsd.org/D40589
Approved by:	jhibbits
2023-06-24 22:01:47 +02:00
Colin Percival
824b64a2f1 Warn about nonfunctional WITHOUT options
Print a warning if we try to WITHOUT_ an option which is marked as
"required" (and forced on).

Suggested by:	emaste, imp
Reviewed by:	emaste, imp
Differential Revision:	https://reviews.freebsd.org/D40613
2023-06-20 13:58:58 -07:00
John Baldwin
ad79b018dc bsd.sys.mk: Add NO_WUNUSED_BUT_SET_VARIABLE helper variable.
This is already present in sys/conf/kern.mk and can be used to
selectively disable -Wunused-but-set-variable.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D40663
2023-06-20 12:36:15 -07:00
Colin Percival
c24c117b96 Remove WITHOUT_{CAPSICUM,CASPER} options
At this point CAPSICUM and CASPER are merely forced on via the newly
added __REQUIRED_OPTIONS list; after stable/14 branches I'll sweep
the tree for MK_{CAPSICUM,CASPER}.

This change will not be MFCed.

Discussed on:	freebsd-arch
Differential Revision:	https://reviews.freebsd.org/D40592
2023-06-19 17:23:09 -07:00
Colin Percival
b908f6c45e bsd.mkopt.mk: Add REQUIRED_OPTIONS list
Options on this list will be forced to 'yes'.  This is intended for use
as a transitional measure when an option is ceasing to be optional,
before all of the associated make logic is removed.

Differential Revision:	https://reviews.freebsd.org/D40590
2023-06-19 17:23:09 -07:00
Piotr Kubaj
2c7279bae7 share/mk/bsd.cpu.mk: handle the default case when CPUTYPE is not specified on powerpc*
Approved by:	imp
Differential Revision: https://reviews.freebsd.org/D40576
2023-06-16 21:15:03 +02:00
Dag-Erling Smørgrav
21850106fd libtacplus: Allow additional AV pairs to be configured.
* Replace hand-rolled input tokenizer with openpam_readlinev() which supports line continuations and has better quoting and escaping.
* Simplify string handling by merging struct clnt_str and struct srvr_str into just struct tac_str.
* Each server entry in the configuration file can now have up to 255 AV pairs which will be appended to the ones returned by the server in response to a successful authorization request.

This allows nss_tacplus(8) to be used with servers which do not provide identity information beyond confirming the existence of the user.

This adds a dependency on libpam, however libtacplus is currently only used by pam_tacplus(8) (which is already always used with libpam) and the very recently added nss_tacplus(8) (which is extremely niche).  In the longer term it might be a good idea to split this out into a separate library.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	pauamma_gundo.com, markj
Differential Revision:	https://reviews.freebsd.org/D40285
Relnotes:	yes
2023-06-13 16:08:08 +00:00
Baptiste Daroussin
cb1fc924d2 genl: add new command to list genetlink(4)
This commands list genetlink protocols and its operations and
capabilities

Name: nlctrl
	ID: 0x10, Version: 00, header size: 2, max attributes: 10
	supported operations:
	 - ID: 0x3, Capabilities: 0xe (can modify; can get/dump;
has policy)
	multicast groups:
	 - ID: 0x30, Name: notify
Name: carp
	ID: 0x11, Version: 00, header size: 2, max attributes: 2
	supported operations:
	 - ID: 0x1, Capabilities: 0xe (can modify; can get/dump;
has policy)
	 - ID: 0x2, Capabilities: 0xb (requires admin permission;
can modify; has policy)

Reviewed by:		melifaro
Differential Revision:	https://reviews.freebsd.org/D40330
2023-05-30 13:36:43 +02:00
John Baldwin
3dad1c6696 Enable -Wstrict-prototypes for all clang versions at WARNS >= 3.
Previously clang 15+ only enabled it for WARNS >= 5.

PR:		271072 (exp-run)
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D39732
2023-05-25 07:11:38 -07:00
Dimitry Andric
c32736222c Enable -ftrivial-auto-var-init flags for gcc >= 12
Now that gcc >= 12 supports -ftrivial-auto-var-init, add it to
bsd.compiler.mk's "init-all" feature.

PR:		271047
Reviewed by:	emaste
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D40208
2023-05-23 19:44:45 +02:00
Dimitry Andric
3006f6df02 Update -ftrivial-auto-var-init flags for clang >= 16
As of clang 16, the -ftrivial-auto-var-init=zero option no longer needs
-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
to enable the option. Only add it for older clang versions.

PR:		271047
Reviewed by:	emaste
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D40208
2023-05-23 19:44:45 +02:00
Simon J. Gerraty
92a4e8b348 dirdeps.mk allow for TARGET_SPEC_VARS.host
While *most* projects need only DEP_MACHINE for host, there is always
an exception.  So we allow for TARGET_SPEC_VARS.host to be a subset of
TARGET_SPEC_VARS.  The default will *just work* for most projects.

We set DEP_TARGET_SPEC_VARS and hence DEP_TARGET_SPEC based on
DEP_MACHINE.  Allow for M_dep_qual_fixes.host to be different too and
take care to apply the right set.
2023-05-15 13:25:10 -07:00
Simon J. Gerraty
7d86c8b8ea sys.dirdeps.mk we do want to override OBJTOP
Add more comments to explain what and why.
Ensure OBJROOT ends in / or - (/ preferred).
Export OBJTOP if level > 0
this avoids the issue with bmake/unit-tests.

Check if we have to override MAKEOBJDIR
and if so, put it into env correctly.
2023-05-14 09:50:03 -07:00
Simon J. Gerraty
d489b2a39d local.dirdeps.mk no qual for PSEUDO_MACHINE_LIST
dirdeps.mk takes care of "host"
but we still need to deal with other PSEUDO_MACHINE_LIST members
2023-05-13 14:06:20 -07:00
Simon J. Gerraty
41d638f203 Update dirdeps.mk
Ensure host build_dirs are not qualified.
2023-05-13 14:05:56 -07:00
Simon J. Gerraty
477f6e3c96 sys.dirdeps.mk use ?= for OBJTOP
This broke bmake's after-import step.
2023-05-13 10:46:24 -07:00
Simon J. Gerraty
da1ef2d619 Move MACHINE/MACHINE_ARCH handling to sys.machine.mk
Rather than define the TARGETS and TARGET_ARCHES in src/Makefile
put them in sys.machine.mk so they can also be leveraged by
non-top-level builds.

We have TARGET_MACHINE_LIST as the list of MACHINES we build for.

For each MACHINE we have a MACHINE_ARCH_LIST_${MACHINE}
and the first entry of each list is used as default for
MACHINE_ARCH_${MACHINE}

We can now remove a bunch of MACHINE_ARCH.* handling from
local.sys.dirdeps*mk

Reviewed by:	imp
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D40083
2023-05-13 08:15:49 -07:00
Simon J. Gerraty
d1c8420702 Move more DIRDEPS_BUILD settings
local.meta.sys.env.mk should now concern itself only with
META_MODE.

Move any DIRDEPS_BUILD settings to local.sys.dirdeps.env.mk
2023-05-12 17:40:37 -07:00
Warner Losh
4d846d260e spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with:		pfg
MFC After:		3 days
Sponsored by:		Netflix
2023-05-12 10:44:03 -06:00
Simon J. Gerraty
bee3d4bf8e Move DIRDEPS_BUILD settings to sys.dirdeps.mk
When originally implemented, there was no distinction between
DIRDEPS_BUILD and META_MODE, they were one and the same.

META_MODE however is useful by itself, but since meta.sys.mk
had lots of settings related to DIRDEPS_BUILD its use was limited
to DIRDEPS_BUILD.

Move (most) DIRDEPS_BUILD related items to sys.dirdeps.mk
so that meta.sys.mk can be used for just META_MODE.
There is of course some bluring of the lines, so settings remain
in meta.sys.mk

Add MK_META_ERROR_TARGET to enable the META_MODE .ERROR target
independent of DIRDEPS_BUILD, it copies failed .meta files to ${SB}/error
to make it easier to identify the cause of build failures.

Since sys.dirdeps.mk should be included first, most of
local.meta.sys.mk becomes local.sys.dirdeps.mk
and some other bits need to move to local.sys.dirdeps.env.mk

Also fix dirdeps.mk to not add CURDIR to DIRDEPS when it is SRCTOP.

Reviewed by:	bdrewery
Differential Revision:	https://reviews.freebsd.org/D40053
2023-05-11 16:15:04 -07:00
Warner Losh
ad9d10a859 efi: mark as broken on i386
We're never going to support EFI booting on i386 (32-bit). Start to
decommission it, since it's never worked.

Sponsored by:		Netflix
Reviewed by:		tsoome, emaste
Differential Revision:	https://reviews.freebsd.org/D40011
2023-05-11 14:06:03 -06:00
Piotr Kubaj
448045e4a7 share/mk/bsd.cpu.mk: add AltiVec / VSX to powerpc*'s MACHINE_CPU
MFC after:	3 days
Approved by:	jhibbits
Differential revision:	https://reviews.freebsd.org/D39240
2023-05-05 16:20:28 +02:00