aboutsummaryrefslogtreecommitdiff
path: root/tools/build/cross-build
diff options
context:
space:
mode:
Diffstat (limited to 'tools/build/cross-build')
-rw-r--r--tools/build/cross-build/fflags.c62
-rw-r--r--tools/build/cross-build/include/common/exterr.h14
-rw-r--r--tools/build/cross-build/include/common/libutil.h2
-rw-r--r--tools/build/cross-build/include/common/sys/_types.h3
-rw-r--r--tools/build/cross-build/include/common/sys/cdefs.h10
-rw-r--r--tools/build/cross-build/include/common/sys/exterrvar.h6
-rw-r--r--tools/build/cross-build/include/linux/libutil.h2
-rw-r--r--tools/build/cross-build/include/linux/sys/stat.h20
-rw-r--r--tools/build/cross-build/include/mac/endian.h7
-rw-r--r--tools/build/cross-build/include/mac/string.h7
10 files changed, 67 insertions, 66 deletions
diff --git a/tools/build/cross-build/fflags.c b/tools/build/cross-build/fflags.c
deleted file mode 100644
index f1d23c3637b6..000000000000
--- a/tools/build/cross-build/fflags.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause
- *
- * Copyright 2018-2020 Alex Richardson <arichardson@FreeBSD.org>
- *
- * This software was developed by SRI International and the University of
- * Cambridge Computer Laboratory (Department of Computer Science and
- * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the
- * DARPA SSITH research programme.
- *
- * This software was developed by SRI International and the University of
- * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
- * ("CTSRD"), as part of the DARPA CRASH research programme.
- *
- * This work was supported by Innovate UK project 105694, "Digital Security by
- * Design (DSbD) Technology Platform Prototype".
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <string.h>
-#include <unistd.h>
-
-char *
-fflagstostr(u_long flags __unused)
-{
- return strdup("");
-}
-
-int
-strtofflags(char **stringp __unused, u_long *setp, u_long *clrp)
-{
- /* On linux just ignore the file flags for now */
- /*
- * XXX: this will prevent makefs from setting noschg on libc, etc.
- * so we should really find a way to support flags in disk images.
- */
- if (setp)
- *setp = 0;
- if (clrp)
- *clrp = 0;
- return (0); /* success */
-}
diff --git a/tools/build/cross-build/include/common/exterr.h b/tools/build/cross-build/include/common/exterr.h
new file mode 100644
index 000000000000..62482841c7b2
--- /dev/null
+++ b/tools/build/cross-build/include/common/exterr.h
@@ -0,0 +1,14 @@
+#ifndef _EXTERR_H_
+#define _EXTERR_H_
+
+#include <sys/types.h>
+
+static inline int
+uexterr_gettext(char *buf, size_t bufsz)
+{
+ if (bufsz > 0)
+ buf[0] = '\0';
+ return (0);
+}
+
+#endif
diff --git a/tools/build/cross-build/include/common/libutil.h b/tools/build/cross-build/include/common/libutil.h
index 15afd2fbca15..3cda32379965 100644
--- a/tools/build/cross-build/include/common/libutil.h
+++ b/tools/build/cross-build/include/common/libutil.h
@@ -39,4 +39,4 @@
#include_next <libutil.h>
#endif
-int expand_number(const char *_buf, uint64_t *_num);
+int expand_number(const char *_buf, int64_t *_num);
diff --git a/tools/build/cross-build/include/common/sys/_types.h b/tools/build/cross-build/include/common/sys/_types.h
index 408f0537d1e6..dc1b76f25063 100644
--- a/tools/build/cross-build/include/common/sys/_types.h
+++ b/tools/build/cross-build/include/common/sys/_types.h
@@ -48,3 +48,6 @@ typedef __builtin_va_list __va_list;
/* Needed for opensolaris compat. */
typedef __int64_t off64_t;
+
+/* Needed for sys/_callout.h */
+typedef __int64_t __sbintime_t;
diff --git a/tools/build/cross-build/include/common/sys/cdefs.h b/tools/build/cross-build/include/common/sys/cdefs.h
index 3f9b7866141f..faad5eccb3af 100644
--- a/tools/build/cross-build/include/common/sys/cdefs.h
+++ b/tools/build/cross-build/include/common/sys/cdefs.h
@@ -270,6 +270,16 @@
#define __ISO_C_VISIBLE 2011
#define __EXT1_VISIBLE 1
+/*
+ * Macro to test if we're using a specific version of gcc or later.
+ */
+#if defined(__GNUC__)
+#define __GNUC_PREREQ__(ma, mi) \
+ (__GNUC__ > (ma) || __GNUC__ == (ma) && __GNUC_MINOR__ >= (mi))
+#else
+#define __GNUC_PREREQ__(ma, mi) 0
+#endif
+
/* Alignment builtins for better type checking and improved code generation. */
/* Provide fallback versions for other compilers (GCC/Clang < 10): */
#if !__has_builtin(__builtin_is_aligned)
diff --git a/tools/build/cross-build/include/common/sys/exterrvar.h b/tools/build/cross-build/include/common/sys/exterrvar.h
new file mode 100644
index 000000000000..0ba821aadef2
--- /dev/null
+++ b/tools/build/cross-build/include/common/sys/exterrvar.h
@@ -0,0 +1,6 @@
+#ifndef _SYS_EXTERRVAR_H_
+#define _SYS_EXTERRVAR_H_
+
+#define UEXTERROR_MAXLEN 256
+
+#endif
diff --git a/tools/build/cross-build/include/linux/libutil.h b/tools/build/cross-build/include/linux/libutil.h
index 8f9ca406edc1..a1d6508be82d 100644
--- a/tools/build/cross-build/include/linux/libutil.h
+++ b/tools/build/cross-build/include/linux/libutil.h
@@ -46,7 +46,7 @@ struct pidfh;
__BEGIN_DECLS
int humanize_number(char *buf, size_t len, int64_t bytes, const char *suffix,
int scale, int flags);
-int expand_number(const char *_buf, uint64_t *_num);
+int expand_number(const char *_buf, int64_t *_num);
int flopen(const char *_path, int _flags, ...);
int flopenat(int dirfd, const char *path, int flags, ...);
diff --git a/tools/build/cross-build/include/linux/sys/stat.h b/tools/build/cross-build/include/linux/sys/stat.h
index 5937920ce461..1a69e127c2e1 100644
--- a/tools/build/cross-build/include/linux/sys/stat.h
+++ b/tools/build/cross-build/include/linux/sys/stat.h
@@ -66,5 +66,25 @@
#define ALLPERMS (S_ISUID | S_ISGID | S_ISTXT | S_IRWXU | S_IRWXG | S_IRWXO)
#endif
+#define UF_SETTABLE 0x0000ffff
+#define UF_NODUMP 0x00000001
+#define UF_IMMUTABLE 0x00000002
+#define UF_APPEND 0x00000004
+#define UF_OPAQUE 0x00000008
+#define UF_NOUNLINK 0x00000010
+#define UF_SYSTEM 0x00000080
+#define UF_SPARSE 0x00000100
+#define UF_OFFLINE 0x00000200
+#define UF_REPARSE 0x00000400
+#define UF_ARCHIVE 0x00000800
+#define UF_READONLY 0x00001000
+#define UF_HIDDEN 0x00008000
+#define SF_SETTABLE 0xffff0000
+#define SF_ARCHIVED 0x00010000
+#define SF_IMMUTABLE 0x00020000
+#define SF_APPEND 0x00040000
+#define SF_NOUNLINK 0x00100000
+#define SF_SNAPSHOT 0x00200000
+
/* This include is needed for OpenZFS bootstrap */
#include <sys/mount.h>
diff --git a/tools/build/cross-build/include/mac/endian.h b/tools/build/cross-build/include/mac/endian.h
new file mode 100644
index 000000000000..11788044f05a
--- /dev/null
+++ b/tools/build/cross-build/include/mac/endian.h
@@ -0,0 +1,7 @@
+/*
+ * Copyright (c) 2025 John Baldwin <jhb@FreeBSD.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <sys/endian.h>
diff --git a/tools/build/cross-build/include/mac/string.h b/tools/build/cross-build/include/mac/string.h
index d7db0d3023a4..58464f1f9834 100644
--- a/tools/build/cross-build/include/mac/string.h
+++ b/tools/build/cross-build/include/mac/string.h
@@ -38,9 +38,12 @@
#include_next <string.h>
/*
- * strchrnul is not provided by macOS and the strchrnul.c implementation
- * can not be compiled on macOS so just provide it inline here
+ * strchrnul is provided by macOS 15.4 and later. However, there is
+ * no good way to detect the current host version at compile time, so
+ * provide an inline definition under an alternate name.
*/
+#define strchrnul(p, ch) __freebsd_strchrnul(p, ch)
+
static inline char *
strchrnul(const char *p, int ch)
{