Commit graph

477 commits

Author SHA1 Message Date
Dag-Erling Smørgrav d9a9f23d0b diff: Integrate libdiff from OpenBSD GoT.
This adds support for two new diff algorithms, Myers diff and Patience
diff.

These algorithms perform a different form of search compared to the
classic Stone algorithm and support escapes when worst case scenarios
are encountered.

Add the -A flag to allow selection of the algorithm, but default to
using the new Myers diff implementation.

The libdiff implementation currently only supports a subset of input and
output options supported by diff.  When these options are used, but the
algorithm is not selected, automatically fallback to the classic Stone
algorithm until support for these modes can be added.

Based on work originally done by thj@ with contributions from kevans@.

Sponsored by:	Klara, Inc.
Reviewed by:	thj
Differential Revision:	https://reviews.freebsd.org/D44302
2024-03-27 11:03:33 +01:00
Mark Johnston f29af8618b libfdt: Make an internal FDT library available
This will be used by bhyve to build a device tree when booting arm64
guests.

Reviewed by:	corvink, jhb
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D40994
2024-03-21 01:05:05 -04:00
Brooks Davis 0d4f7723bc libc: link libsys as a auxiliary filter library
At runtime, when rtld loads libc it will also load libsys.  For each
symbol that is present in both, the libsys one will override the libc
one.  It continues to be the case that program need only link against
libc (usually implicitly).  The linkage to libsys is automatic.

Reviewed by:	kib, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/908
2024-02-05 20:34:56 +00:00
Brooks Davis e9d961055a libsys: plumb in to build
libsys provides the FreeBSD kernel interface (auxargs, system calls,
vdso).  It can be linked directly for programs using a non-standard
libc and will later be linked as a filter library to libc providing
the actual system call implementation.

Reviewed by:	kib, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/908
2024-02-05 20:34:56 +00:00
Warner Losh dc36d6f9bb lib: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by:		Netflix
2023-11-26 22:23:28 -07:00
Warner Losh d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06: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 3864bd4fd2 lib: Migrate from COMPAT_32BIT to generic COMPAT_LIBCOMPAT
In the process, delete a COMPAT_SOFTFP remnant that was missed in
previous sweeps.

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/D40931
2023-07-09 18:49:53 +01:00
Jessica Clarke 6adfb8155e lib: Enable libcbor and libfido2 for COMPAT_32BIT
We no longer have COMPAT_32BIT hacks for libusb, instead supporting the
normal 32-bit ioctls for freebsd32 processes, so we can enable these for
the lib32 build.

Reviewed by:	emaste, brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D40920
2023-07-09 18:45:56 +01:00
Dag-Erling Smørgrav 6c5cdba1ba Add nss_tacplus, a TACACS+ NSS module.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D40133
2023-05-22 10:14:52 +00:00
Brooks Davis af0cc0b223 NgATM: Remove netgraph ATM support
Most ATM support was removed prior to FreeBSD 12.  The netgraph support
was kept as it was less intrusive, but it is presumed to be unused.

Reviewed by:	manu
Relnotes:	yes
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D38879
2023-03-09 18:04:02 +00: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
Dag-Erling Smørgrav 0aa2700123 Put OPIE to rest.
Differential Revision: https://reviews.freebsd.org/D36592
2022-10-02 03:37:29 +02:00
Emmanuel Vadot 15d781b532 lib: Gate libfigpar under MK_DIALOG
libfigpar is only used by dpv and dpv isn't built if WITHOUT_DIALOG
is set.
2022-08-16 21:15:12 +02:00
John Baldwin 0b09867f67 Simplify conditional guards for libclang_rt.
All supported architectures can build libclang_rt now.

Reviewed by:	dim
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D35740
2022-07-07 13:54:57 -07:00
Piotr Kubaj 3781e77995 riscv: actually enable sanitizers
1. Backport b475ce39e8.
2. Enable libclang_rt for riscv.

Previous commit missed it.

MFC after:	3 days
Reviewed by:	dim
Differential Revision: https://reviews.freebsd.org/D34543
2022-03-13 13:06:57 +01:00
Ed Maste 6f6fbfa3a8 Remove quotes around Makefile .error/.warn/.info strings
The text after .error et al is emitted verbatim.

Reviewed by:	sjg
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33904
2022-01-22 14:03:07 -05: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
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
Baptiste Daroussin 5abafe4aa0 bsddialog, mark the lib as dependent on ncurses 2021-11-24 16:48:44 +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
Ed Maste ad09e2c8cf Don't build sanitizer runtimes under WITHOUT_CXX
In the past we built the sanitizer runtimes when building Clang
(and using Clang as the compiler) but 7676b388ad changed this to
be conditional only on using Clang, to make the runtimes available
for external Clang.

They fail to build when WITHOUT_CXX is set though, so add MK_CXX
as part of the condition.

Reported by:	Michael Dexter, Build Option Survey
Reviewed by:	imp, jrtc27
Fixes:		7676b388ad ("Always build the sanitizer runtimes...")
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32731
2021-10-29 10:05:49 -04:00
Ed Maste 93942379cc Avoid building libfido2 if WITHOUT_USB
libfido2 requires USB, so disable it if not available.

Reported by:	peterj
Fixes:		7b1e19ad78 ("Add libfido2 to the build")
Sponsored by:	The FreeBSD Foundation
2021-10-26 17:17:56 -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
Hans Petter Selasky 903873ce15 Implement and use new mixer(3) library for FreeBSD.
Wiki article: https://wiki.freebsd.org/SummerOfCode2021Projects/SoundMixerImprovements
This project was part of Google Summer of Code 2021.

Submitted by:	christos@
Differential Revision:	https://reviews.freebsd.org/D31636
Sponsored by:	NVIDIA Networking
2021-09-22 19:43:56 +02: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 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 c951566915 Remove lib/kyua from the build
I forgot to include this line in 2eb9ad4274.

Reported by:    Jenkins CI
MFC after:      1 week
Fixes:          2eb9ad427475190ei ("Simplify and speed up the kyua build")
2021-07-02 10:18:00 +01:00
Kristof Provost 0d71f9f36e pfctl: Move ioctl abstraction functions into libpfctl
Introduce a library to wrap the pf ioctl interface.

MFC after:	4 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D29562
2021-04-10 11:16:02 +02:00
Alex Richardson 7676b388ad Always build the sanitizer runtimes when compiling with clang
This allows instrumenting e.g. test binaries even when compiling with an
external clang (e.g. CROSS_TOOLCHAIN=llvm11). I have some upcoming patches
that allow building the entire base system with ASan/UBSan/etc.
instrumentation and this is required in preparation for this.

Reviewed By:	dim, emaste
Differential Revision: https://reviews.freebsd.org/D28532
2021-02-10 15:25:14 +00:00
Alex Richardson 5cf6f1c4bc Remove the MK_LIBCPLUSPLUS option
This option has been equivalent to any form of C++ support since libstdc++
was removed. Therefore, replace all MK_LIBCPLUSPLUS uses with MK_CXX.

Reviewed By:	emaste
Differential Revision: https://reviews.freebsd.org/D27974
2021-02-01 09:32:07 +00:00
Kyle Evans 123ae3045d build: remove LIBPTHREAD/LIBTHR build options
WITHOUT_LIBTHR has been broken for a little over five years now, since the
xz 5.2.0 update introduced a hard liblzma dependency on libthr, and building
a useful system without threading support is becoming increasingly more
difficult.

Additionally, in the five plus years that it's been broken more reverse
dependencies have cropped up in libzstd, libsqlite3, and libcrypto (among
others) that make it more and more difficult to reconcile the effort needed
to fix these options.

Remove the broken options.

PR:		252760
Reviewed by:	brooks, emaste, kib
Differential Revision:	https://reviews.freebsd.org/D28263
2021-01-22 12:33:27 -06:00
Ryan Moeller 73577bf01d flua: Add a libjail module
libjail is pretty small, so it makes for a good proof of concept demonstrating
how a system library can be wrapped to create a loadable Lua module for flua.

* Introduce 3lua section for man pages
* Add libjail module

Reviewed by:	kevans, manpages
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D26080
2020-10-24 17:08:59 +00:00
Jakub Wojciech Klama 100353cfbf Add virtio-9p (aka VirtFS) filesystem sharing to bhyve.
VirtFS allows sharing an arbitrary directory tree between bhyve virtual
machine and the host. Current implementation has a fairly complete support
for 9P2000.L protocol, except for the extended attribute support. It has
been verified to work with the qemu-kvm hypervisor.

Reviewed by:	rgrimes, emaste, jhb, trasz
Approved by:	trasz (mentor)
MFC after:	1 month
Relnotes:	yes
Sponsored by:	Conclusive Engineering (development), vStack.com (funding)
Differential Revision:	https://reviews.freebsd.org/D10335
2020-10-03 19:05:13 +00:00
Vincenzo Maffione 5c4f8d801c lib: add libnetmap
This changeset introduces the new libnetmap library for writing
netmap applications.
Before libnetmap, applications could either use the kernel API
directly (e.g. NIOCREGIF/NIOCCTRL) or the simple header-only-library
netmap_user.h (e.g. nm_open(), nm_close(), nm_mmap() etc.)

The new library offers more functionalities than netmap_user.h:
  - Support for complex netmap options, such as external memory
    allocators or per-buffer offsets. This opens the way to future
    extensions.
  - More flexibility in the netmap port bind options, such as
    non-numeric names for pipes, or the ability to specify the netmap
    allocator that must be used for a given port.
  - Automatic tracking of the netmap memory regions in use across the
    open ports.

At the moment there is no man page, but the libnetmap.h header file
has in-depth documentation.

Reviewed by:	hrs
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D26171
2020-08-28 20:03:54 +00:00
Alex Richardson 18de62a94a Move libsqlite3 to the top of the SUBDIR list
In parallel builds, this should allow sqlite to start building earlier and
increase parallelism when building lib/. Looking at htop output during
buildworld/tinderbox, there are long phases where only one CPU is active
optimizing the massive sqlite3.c file since the build of libsqlite3 is
started quite late.

Reviewed By:	emaste
Differential Revision: https://reviews.freebsd.org/D26169
2020-08-26 09:19:49 +00:00
Kyle Evans eb578fec7f Ensure libregex is built in time for googletest
In lib/Makefile, we document the dependency with SUBDIR_DEPEND

For buildworld orchestration, just prebuild libregex if GOOGLETEST is
enabled. googletest will get built in a later pass.
2020-08-04 03:43:28 +00:00
Ed Maste c5ea81f7a6 rename in-tree libevent v1 to libevent1
r316063 installed pf's embedded libevent as a private lib, with headers
in /usr/include/private/event.  Unfortunately we also have a copy of
libevent v2 included in ntp, which needed to be updated for compatibility
with OpenSSL 1.1.

As unadorned 'libevent' generally refers to libevent v2, be explicit that
this one is libevent v1.

Reviewed by:	vangyzen (earlier)
Differential Revision:	https://reviews.freebsd.org/D17275
2020-05-28 22:05:50 +00:00
Brooks Davis b0d29bc47d Import the kyua test framework.
Having kyua in the base system will simplify automated testing in CI and
eliminates bootstrapping issues on new platforms.

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

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

This is a preparatory commit for D24103.

Reviewed by:	emaste
Obtained from:	CheriBSD
Sponsored by:	DARPA
2020-03-23 18:26:23 +00:00
Brooks Davis 564b9ff2a7 Add an internal liblua and use it in flua.
The new liblua will be used in a forthcoming import of kyua.

Reviewed by:	kevans
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D24090
2020-03-17 17:28:12 +00:00
Ed Maste c45018041d retire the LLVM_LIBUNWIND option
LLVM's libunwind is used on all FreeBSD-supported CPU architectures and
is a required component.

Reviewed by:	brooks (earlier)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D23123
2020-02-29 12:43:43 +00:00
Warner Losh feb2ecc382 Remove excluding libproc and librtld_db on sparc64. 2020-02-12 06:54:28 +00:00
Kyle Evans cd0d51baaa Provide libssp based on libc
For libssp.so, rebuild stack_protector.c with FORTIFY_SOURCE stubs that just
abort built into it.

For libssp_nonshared.a, steal stack_protector_compat.c from
^/lib/libc/secure and massage it to maintain that __stack_chk_fail_local
is a hidden symbol.

libssp is now built unconditionally regardless of {WITH,WITHOUT}_SSP in the
build environment, and the gcclibs version has been disconnected from the
build in favor of this one.

PR:		242950 (exp-run)
Reviewed by:	kib, emaste, pfg, Oliver Pinter (earlier version)
Also discussed with:	kan
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D22943
2020-01-04 20:19:25 +00:00
Dimitry Andric 1bb8eb56ef libclang_rt: enable on powerpc*
Summary:
Enable on powerpc64 and in lib/libclang_rt/Makefile change
MACHINE_CPUARCH to MACHINE_ARCH because on powerpc64
MACHINE_ARCH==MACHINE_CPUARCH so the 32-bit library overwrites 64-bit
library during installworld.

This patch doesn't enable any other libclang_rt libraries because they
need to be separately ported.

I have verified that games/julius (which fails on powerpc64 elfv2
without this change because of no libclang_rt profiling library) builds.

Test Plan: Ship it, test on powerpc and powerpcspe

Submitted by:	pkubaj
Reviewed by:	dim, jhibbits
Differential Revision: https://reviews.freebsd.org/D22425
MFC after:	1 month
X-MFC-With:	r353358
2019-11-23 19:35:09 +00:00
Dimitry Andric 8b3bc70a2b Merge ^/head r352764 through r353315. 2019-10-08 18:17:02 +00:00
Edward Tomasz Napierala 1a13f2e6b4 Introduce stats(3), a flexible statistics gathering API.
This provides a framework to define a template describing
a set of "variables of interest" and the intended way for
the framework to maintain them (for example the maximum, sum,
t-digest, or a combination thereof).  Afterwards the user
code feeds in the raw data, and the framework maintains
these variables inside a user-provided, opaque stats blobs.
The framework also provides a way to selectively extract the
stats from the blobs.  The stats(3) framework can be used in
both userspace and the kernel.

See the stats(3) manual page for details.

This will be used by the upcoming TCP statistics gathering code,
https://reviews.freebsd.org/D20655.

The stats(3) framework is disabled by default for now, except
in the NOTES kernel (for QA); it is expected to be enabled
in amd64 GENERIC after a cool down period.

Reviewed by:	sef (earlier version)
Obtained from:	Netflix
Relnotes:	yes
Sponsored by:	Klara Inc, Netflix
Differential Revision:	https://reviews.freebsd.org/D20477
2019-10-07 19:05:05 +00:00
Dimitry Andric 6b3555c38e Enable OpenMP for powerpc64
Summary: When powerpc64 switches to LLVM, use this patch to enable
OpenMP as well. OpenMP on PPC is only for 64-bits, so don't make a
32-bit libomp. A change to openmp files is necesssary (under review on
https://reviews.llvm.org/D67190), because it determines ELF format
version based on endianness, which is incorrect.

Reviewed by:	alfredo.junior_eldorado.org.br, #manpages
Differential Revision: https://reviews.freebsd.org/D21532
2019-09-26 18:24:04 +00:00
Dimitry Andric 0f80acb965 Merge ^/head r352436 through r352536. 2019-09-19 19:26:12 +00:00