Commit graph

1518 commits

Author SHA1 Message Date
Kyle Evans aad507854e Fix the cross-build after recent commits
- Provide a sys/md4.h in the cross-build environment to fix bootstrap
    of libmd.
- flua now exposes WTRAPPED which isn't incredibly common- make it
    conditional, we probably won't be using it in any bootstrap context
    any time soon.

Fixes:	442e0975ee ("Consolidate md4 implementations written in C")
Fixes:	c2caf3b331 ("flua: posix: add more useful functions [...]")
2024-09-30 00:08:49 -05:00
Konstantin Belousov eade2001aa jemalloc: set LG_VADDR to 64 on amd64
and allow to revert it back to 48 with WITHOUT_JEMALLOC_LG_VADDR_WIDE build
option.

Reviewed by:	andrew, emaste
Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46686
2024-09-27 01:54:25 +03:00
Ahmad Khalifa fe3f792f9a Add build option for the ia32 loader
In preparation for supporting 64-bit machines with 32-bit UEFI firmware,
add a build option for compiling the ia32 loader. Currently unused.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1098
2024-09-20 08:45:05 -06:00
Jessica Clarke b9c5eab0f3 depend-cleanup.sh: Fix overzealous syscall.S cleanup on amd64
Just as we skip the cleanup for i386 due to still having a custom
syscall.S, we also need to do the same for lib32 on amd64, so filter it
out of ALL_libcompats here.

Fixes:	a650ec0e55 ("lib{c,sys}: fix incremental builds")
2024-09-10 18:54:45 +01:00
Jessica Clarke 1a55697719 depend-cleanup.sh: Fix overzealous syscall.S cleanup on non-amd64
Although there is no longer a syscall.S in the source tree, the
generated file is still called syscall.S, so the syscall\.S regex still
matches the .depend file. Previously it looked like:

    syscall.o \
      /path/to/src/lib/libc/MACHINE/sys/syscall.S \
      ...

or

    syscall.o \
      /path/to/src/lib/libsys/MACHINE/syscall.S \
      ...

Now it looks like:

    syscall.o: syscall.S \
      ...

Thus, match on the file having a directory specified, to distinguish it from
the generated case where it's adjacent in the OBJDIR. Note the .* is needed due
to the use of egrep -w.

Fixes:	3a4b04e82d ("depend-cleanup.sh: Simplify handling for stale syscall.S")
2024-09-10 18:54:45 +01:00
Jessica Clarke 0980d0a037 depend-cleanup.sh: Fix overzealous abd_os.c cleanup
A source file with the same name is still used to build an abd_os.o, it
just comes from a different directory. Thus we need to include part of
the path in the regex too. Technically zfs/abd_os\.c would suffice given
it's now in sys/contrib/openzfs/lib/libzpool/abd_os.c, but this seems
clearer and less likely to have future false-positives.

Fixes:	fd3d3240b0 ("depend-cleanup.sh: Add a rule to work around abd_os.c dependency changes")
2024-09-10 18:54:45 +01:00
Jessica Clarke cc30f4ae67 depend-cleanup.sh: Extend clean_dep to support a custom regex
This will avoid having to duplicate the loop every time the default
regex isn't good enough, and will be used by upcoming commits.
2024-09-10 18:54:44 +01:00
Jessica Clarke e546c3950a depend-cleanup.sh: Fix overzealous rescue.mk cleanup
grep -q -v means "are there any lines that don't match", not "are there
no lines that match", and since the file has lines other than ones with
nvme_util.o when up-to-date this triggers on every build.

Fixes:		26a09db3ad ("Fix incremental build with WITH_NVME newly enabled")
MFC after:	1 week
2024-09-10 17:33:06 +01:00
Jessica Clarke 7ce171bd42 depend-cleanup.sh: Fix pretend (-n) mode
Fixes:		26a09db3ad ("Fix incremental build with WITH_NVME newly enabled")
MFC after:	1 week
2024-09-10 17:14:37 +01:00
Mark Johnston fd3d3240b0 depend-cleanup.sh: Add a rule to work around abd_os.c dependency changes
Fixes incremental buildworld after the latest OpenZFS import.

Fixes:	e2df9bb441 ("zfs: merge openzfs/zfs@b10992582")
Sponsored by:	Klara, Inc.
2024-09-10 15:29:39 +00:00
Wolfram Schneider c77ca9a72c stale-symlink-buildworld.sh: improve documentation 2024-09-09 14:55:29 +00:00
Mark Johnston 24affded3d src.conf: Add a MK_ZFS_TESTS knob
The in-tree ZFS test suite is somewhat outdated and I see a number of
failures there.  I tend to think that we want to integrate the OpenZFS
test suite somehow, replacing the legacy one, though it's also possible
to run that as a separate test suite.

In any case, if one wants to run the OpenZFS test suite separately, it's
useful to be able to disable installation of the legacy ZFS test suite,
so let's provide a src.conf option to do that.

Reviewed by:	asomers
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D46476
2024-09-07 14:36:28 +00:00
Val Packett 7b9c9f8004 cross-build: fix fake_sysctl/tzsetup
The error was always returned, even after handling the sysctl, breaking
installworld under Linux.

Sponsored by:		https://www.patreon.com/valpackett

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1376
2024-09-06 12:34:32 -06:00
Jessica Clarke 18aef07cfa beinstall: Pass -B to etcupdate
Since commit 246364454f ("etcupdate: Use new buildetc and installetc
targets when available"), beinstall has been much slower for the
etcupdate step, as it's been doing a kernel-toolchain (admittedly
without LLVM itself being built). Given beinstall requires an object
tree to already have been built and just installs it, we can pass -B to
beinstall to reuse that tree rather than build kernel-toolchain in
another one.

Reported by:	olivier
Tested by:	olivier
MFC after:	1 week
2024-08-28 23:36:56 +01:00
John Baldwin 0a5996443b src.conf.5: Fix spelling typo
Sponsored by:	AFRL, DARPA
2024-08-20 07:54:12 -04:00
Wolfram Schneider ccb0365643 stale symlinks: configurable obj dir prefix
Use $MAKEOBJDIRPREFIX if set, otherwise /usr/obj
2024-08-12 19:34:43 +00:00
Warner Losh bf4f27e85a options: Make it clearer some x86 / BIOS only things
Suggested by: jrtc27
Sponsored by: Netflix
2024-08-06 17:39:10 -06:00
Warner Losh 20d35d5817 loader: Add WITH/WITHOUT_LOADER_PXEBOOT build option
Make it possible to disable pxeboot. This loader will fail to build when
it's too large. When /boot/loader needs to be larger like that, this
options will disable a component whose build will fail. It is an explicit
option rather than implicit when things are too large to force the user to
make the explicit tradeoffs rather than wonder why they have a stale pxeboot
or other odd failure mode.

MFC After:		3 days
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D46212
2024-08-06 17:22:36 -06:00
Warner Losh 7ee781e2bf loader: Document that WITH_BEARSSL may need other tweaks
/boot/loader is right up aginst the 500k limit we have to make sure
everything works in a wide variety of environments. However, adding
WITH_BEARSSL can push it over the edge since we are so close to the
limit with it enabled. One may also need to increase LOADERSIZE when
enabling it. It's often safe to go much higher, especially when you
don't plan on using pxeldr. Document this trade off here.

MFC After:		3 days
Sponsored by:		Netflix
Reviewed by:		sjg, markj
Differential Revision:	https://reviews.freebsd.org/D46211
2024-08-06 17:22:36 -06:00
John Baldwin 3a4b04e82d depend-cleanup.sh: Simplify handling for stale syscall.S
Remove the outer grep and depend on the greps in clean_dep instead.

Reviewed by:	brooks, imp
Obtained from:	CheriBSD
Sponsored by:	AFRL, DARPA
Differential Revision:	https://reviews.freebsd.org/D46103
2024-08-05 15:49:06 -04:00
Ed Maste 4a06d14937 depend-cleanup: remove entries from 2020 and 2021
> These tests increase the build time (albeit by a small amount), so
> they should be removed once enough time has passed and it is extremely
> unlikely anyone would try a NO_CLEAN build against an object tree from
> before the related change.

The comment suggests a year is a reasonable period but we'll be somewhat
more conservative for now, in part so that we retain different examples
of special cases.

Reviewed by:	brooks, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46178
2024-07-29 14:57:32 -04:00
Ed Maste ba373fca78 Do not clean (in buildworld/buildkernel) by default
As discussed on the freebsd-arch mailing list[1].  For historical
reasons FreeBSD's buildworld and buildkernel targets started by cleaning
the object tree, for traditional (non-metamode) builds.

Cleaning is not necessary when dependencies are properly tracked, and we
have a somewhat kludgey script[2] to handle some known cases where deps
were mishandled by traditional builds.  Be consistent with the vast
majority of open source build systems by default, and do not clean at
the beginning of buildworld or buildkernel.

Users may set WITH_CLEAN in src.conf(5) to restore the previous
behaviour, or run `make cleanworld` and/or `make cleankernel` before
starting a build.

[1] https://lists.freebsd.org/archives/freebsd-arch/2024-July/000727.html
[2] tools/build/depend-cleanup.sh

Reviewed by:	jhb, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46172
2024-07-29 13:16:52 -04:00
Jose Luis Duran d55de30efd tools/build/make.py: Minor typo fix
If the object directory prefix does not exist, make.py previously exited
with a message indicating that the chosen prefix does not exit.

Reviewed by:	emaste
Pull request:	https://github.com/freebsd/freebsd-src/pull/1348
2024-07-27 23:04:24 -04:00
Warner Losh 18cf1e5023 cross-build: Define DEFFILEMODE and ALLPERMS if not defined
GLIBC defines these, but MUSL does not. FreeBSD's bootstrap code uses
these defines, so define them if they aren't yet defined.

Co-authored-by:		Val Packett <val@packett.cool>
Sponsored by:		Netflix
Pull Request:		https://github.com/freebsd/freebsd-src/pull/1066
Differential Revision:	https://reviews.freebsd.org/D45375
2024-07-24 20:47:26 -06:00
Warner Losh 744991d495 cross-build: progname.c is used only on linux, so no ifdefs needed
The logic in the makefile ensures this is only present on Linux, so no
ifdef is needed. I overlooked comments to the effect in the original
pull request somehow.

Fixes:			0e03402139
Suggested by:		arichards, jrtc27
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D45374
2024-07-24 20:47:26 -06:00
Warner Losh 4a0b7955fd cross-build: Move fcntl.h workaround to Linux specific file
Move the cdefs.h inclusion to the Linux specific file. Either place will
work, but it makes more sense to do it in the Linux specific file since
it's a Linux specific workaround.

Fixes:			4300e05361
Suggested by:		arichards, jrtc27
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D45373
2024-07-24 20:47:26 -06:00
Jessica Clarke e21e8c9180 tools/build: Unbreak cross build by providing stub ssp/ssp.h
We build arc4random.c on non-FreeBSD, which now wants the header for
__ssp_real.

Fixes:	d0b7445904 ("include: ssp: fortify <stdlib.h>")
2024-07-17 13:11:25 +01:00
Warner Losh e9ac41698b Remove residual blank line at start of Makefile
Some checks are pending
Cross-build Kernel / ${{ matrix.target_arch }} ${{ matrix.os }} (${{ matrix.compiler }}) (clang-14, /usr/lib/llvm-14/bin, ubuntu-22.04, bmake libarchive-dev clang-14 lld-14, arm64, aarch64) (push) Waiting to run
Cross-build Kernel / ${{ matrix.target_arch }} ${{ matrix.os }} (${{ matrix.compiler }}) (clang-14, /usr/lib/llvm-14/bin, ubuntu-22.04, bmake libarchive-dev clang-14 lld-14, amd64, amd64) (push) Waiting to run
Cross-build Kernel / ${{ matrix.target_arch }} ${{ matrix.os }} (${{ matrix.compiler }}) (clang-13, /opt/homebrew/opt/llvm@13/bin, macos-latest, bmake libarchive llvm@13, arm64, aarch64) (push) Waiting to run
Cross-build Kernel / ${{ matrix.target_arch }} ${{ matrix.os }} (${{ matrix.compiler }}) (clang-13, /opt/homebrew/opt/llvm@13/bin, macos-latest, bmake libarchive llvm@13, amd64, amd64) (push) Waiting to run
Cross-build Kernel / ${{ matrix.target_arch }} ${{ matrix.os }} (${{ matrix.compiler }}) (clang-12, /usr/lib/llvm-12/bin, ubuntu-20.04, bmake libarchive-dev clang-12 lld-12, arm64, aarch64) (push) Waiting to run
Cross-build Kernel / ${{ matrix.target_arch }} ${{ matrix.os }} (${{ matrix.compiler }}) (clang-12, /usr/lib/llvm-12/bin, ubuntu-20.04, bmake libarchive-dev clang-12 lld-12, amd64, amd64) (push) Waiting to run
This is a residual of the $FreeBSD$ removal.

MFC After: 3 days (though I'll just run the command on the branches)
Sponsored by: Netflix
2024-07-15 16:43:39 -06:00
Wolfram Schneider e880dd644f stale-symlink-buildworld.sh: a script to check for stale symlinks on a FreeBSD system
You can run the script before or after `make installworld'

You may also check your local ports with:

  env STALE_SYMLINK_BUILDWORLD_DIRS=/usr/local ./stale-symlink-buildworld.sh

PR: 276235
2024-07-07 12:59:20 +00:00
Ed Maste 0e34d09930 Add WITHOUT_LLVM_BINUTILS src.conf description
Before FreeBSD 15 I plan to switch to LLVM_BINUTILS by default.  Add the
src.conf description now, for the benefit of downstream branches and
testing/CI.

PR:		258872 [exp-run]
Sponsored by:	The FreeBSD Foundation
2024-06-10 11:50:32 -04:00
Warner Losh b661d9e64d Revert "checkstyle9.pl: Add check for missing space between ) {"
This reverts commit 6bad7d2486.

Turns out this special case wasn't necessary, and this was already
detected and due to another error (running the script got dropped
from my experimental scripts), I hadn't noticed.

Sponsored by:		Netflix
2024-05-29 11:18:00 -06:00
Warner Losh 6bad7d2486 checkstyle9.pl: Add check for missing space between ) {
Sponsored by:		Netflix
2024-05-29 09:59:27 -06:00
Warner Losh 0e03402139 cross-build: This is not glibc specific, but Linux specific
Neither glibc nor musl define these interfaces, so provide them for all
Linux builds.

Sponsored by:		Netflix
Reviewed by:		val_packett.cool
Differential Revision:	https://reviews.freebsd.org/D45355
2024-05-26 11:39:27 -06:00
Warner Losh 3c5f0da510 cross-build: Define __*int*_t and include sys/cdefs.h
FreeBSD assumes that sys/types.h includes sys/cdefs.h, so add it here.
FreeBSD also needs __*int*_t defined for software we bootstrap (a lot of
it). GLIBC defines these, but musl does not, so we have to define them
here, even though it looks backwards. There's no good #define to key off
of, so use !defined GLIBC since on Linux defacto there's only two libc
implementations.

Co-authored-by:		Val Packett <val@packett.cool>
Sponsored by:		Netflix
Pull Request:		https://github.com/freebsd/freebsd-src/pull/1066
Reviewed by:		val_packett.cool
Differential Revision:	https://reviews.freebsd.org/D45354
2024-05-26 11:39:18 -06:00
Warner Losh 27326f895e cross-build: string.h uses mode_t, so we need sys/types.h
string.h defines strmode with a mode_t argument. POSIX states that one
must include sys/types.h to get mode_t, so do that here. This makes musl
happier. We know that sys/types.h will include sys/cdefs.h, so just
replace the latter with the former.

Co-authored-by:		Val Packett <val@packett.cool>
Sponsored by:		Netflix
Pull Request:		https://github.com/freebsd/freebsd-src/pull/1066
Reviewed by:		val_packett.cool
Differential Revision:	https://reviews.freebsd.org/D45353
2024-05-26 11:39:10 -06:00
Warner Losh 76efd90ab0 cross-build: Include sys/types.h from sys/param.h
FreeBSD has a style(9) enforced assumption that sys/param.h includes
sys/types.h. However, Linux under musl doesn't do this so go ahead and
explicitly include it here. It won't hurt on the glibc systems, and
helps musl.

Co-authored-by:		Val Packett <val@packett.cool>
Sponsored by:		Netflix
Pull Request:		https://github.com/freebsd/freebsd-src/pull/1066
Reviewed by:		val_packett.cool
Differential Revision:	https://reviews.freebsd.org/D45352
2024-05-26 11:39:02 -06:00
Warner Losh 4300e05361 build: Include sys/cdefs.h in our fcntl.h shim
On Linux with musl, sys/cdefs.h isn't included with fcntl.h, so when we
use __BEGIN_DECL and __END_DECL in this file, it fails. There's no harm
in unconditionally including sys/cdefs.h here, so do that to avoid
encoding exactly where it is or isn't needed so we don't have to know
too much about the internal state of other libc implementations.

Co-authored-by:		Val Packett <val@packett.cool>
Sponsored by:		Netflix
Pull Request:		https://github.com/freebsd/freebsd-src/pull/1066
Reviewed by:		val_packett.cool
Differential Revision:	https://reviews.freebsd.org/D45351
2024-05-26 11:38:55 -06:00
Warner Losh 917c0541e4 cross-tools: Document a rather bizarre looking construct
On Linux, stddef.h will define __size_t to something when size_t is
defined. On FreeBSD, __size_t is an actual typedef which we need for
other parts of the system. If __size_t isn't defined, that tells us we
need to define the fallback __size_t typedef (if it is defined, then we
can't easily redefine it without issues because glob.h will define it to
something different than stddef.h defines it). Add a comment to this
effect.

Sponsored by:		Netflix
Reviewed by:		val_packett.cool
Differential Revision:	https://reviews.freebsd.org/D45350
2024-05-26 11:38:46 -06:00
Warner Losh 364c014d9b cross-tools: fts has different types for cmp routine
fts has different types for its compare rotuine. Other systems, not
4.4BSD based, have a non-const version. Before we tested against
__GLIBC__, but now we test against __linux__ because that's Linux's API
and musl doesn't define __GLIBC__.

In addition, link against libftl on this platform since musl doesn't
include ftl routines in libc, but rather in libftl.

Co-authored-by:		Val Packett <val@packett.cool>
Sponsored by:		Netflix
Pull Request:		https://github.com/freebsd/freebsd-src/pull/1066
Reviewed by:		val_packett.cool
Differential Revision:	https://reviews.freebsd.org/D45349
2024-05-26 11:38:30 -06:00
Val Packett 59aa64914a cross: Move Solaris API64 defines to common
off64_t is needed for both Linux (musl) and MacOS, so move them to the
common area. Somehow glibc provides the definition, but defining it
doesn't hurt and hels in the musl case.

Reviewed by: allanjude, jrtc27
Pull Request: https://github.com/freebsd/freebsd-src/pull/1066
2024-05-23 20:03:18 -06:00
Warner Losh 0115ad61d8 autofs: Fix cross-threading on file to delete
We want to delete the new file, which is installed in man4 not man5.

Noticed by:	Gary Jennejohn
Fixes:		a03e8a40d4
Sponsored by:	Netflix
2024-05-22 15:10:08 -06:00
Andrew Turner 82854693ae arm64: Allow userspace to be built with PAC and BTI
Add the WITH/WITHOUT_BRANCH_PROTECTION build flags. This can be used
to enable the use of pointer authentication (FEAT_PAuth) and branch
target identification (FEAT_BTI) in userspace.

The kernel already handles both of these is userspace, we just need
to enable it.

Leave disabled for a short period for this to settle before enabling.

Reviewed by:	emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D42596
2024-05-22 17:02:26 +00:00
Brooks Davis 6edb14c006 Make WITHOUT_UNDEFINED_VERSION the default
Link with --no-undefined-version by default.  Will detect and prevent
the accidental removal of symbols from versioned libraries.

(cherry picked from commit 4510f2ca91)
This reverts commit b25ceb97ed.

Reviewed by:	arichardson, kib, dim, emaste
Differential Revision:	https://reviews.freebsd.org/D44216
2024-05-20 15:40:19 +01:00
Ed Maste 65fd76b5f5 makeman: extend duplicate option warning to OPT_ options
In a local tree I accidentally had OPT_INIT_ALL defaulting to zero in
userland and none in kernel.  This resulted in the INIT_ALL text
appearing twice in src.conf.5.

Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45184
2024-05-16 13:30:37 -04:00
Alexander Ziaee 1a720cbec5 man filesystems: fix xrefs after move to section 4
Reviewed by: des, imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1077
2024-05-16 10:25:29 -06:00
Alexander Ziaee a03e8a40d4 man filesystems: ObsoleteFiles after move to sec 4
Reported by: imp
Reviewed by: des, imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1077
2024-05-16 10:25:13 -06:00
Kyle Evans 9bfd3b4076 Add a build knob for _FORTIFY_SOURCE
In the future, we will Default to _FORTIFY_SOURCE=2 if SSP is enabled,
otherwise default to _FORTIFY_SOURCE=0.  For now we default it to 0
unconditionally to ease bisect across older versions without the new
symbols, and we'll put out a call for testing.

include/*.h include their ssp/*.h equivalents as needed based on the
knob. Programs and users are allowed to override FORTIFY_SOURCE in their
Makefiles or src.conf/make.conf to force it off.

Reviewed by:	des, markj
Relnotes:	yes
Sponsored by:	Stormshield
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D32308
2024-05-13 00:23:50 -05:00
Warner Losh 758d02fb30 checkstyle9: Relax sob line requirement 2024-05-04 07:56:36 -06:00
Brooks Davis b25ceb97ed Revert "Make WITHOUT_UNDEFINED_VERSION the default"
This is causing failures on gcc13 CI builds so those need to be fixed
or worked around.

This reverts commit 4510f2ca91.
2024-05-02 22:55:08 +01:00
Brooks Davis 4510f2ca91 Make WITHOUT_UNDEFINED_VERSION the default
Link with --no-undefined-version by default.  Will detect and prevent
the accidental removal of symbols from versioned libraries.

Reviewed by:	arichardson, kib, dim, emaste
Differential Revision:	https://reviews.freebsd.org/D44216
2024-05-02 18:13:39 +01:00