Index: head/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c =================================================================== --- head/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c +++ head/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c @@ -27,6 +27,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #include +#include #include #include #include Index: head/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h =================================================================== --- head/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h +++ head/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h @@ -38,6 +38,7 @@ #include #include +#include #ifdef __cplusplus extern "C" { @@ -63,6 +64,15 @@ #ifndef MIN #define MIN(a, b) ((a) > (b) ? (b) : (a)) +#endif + +/* Sanity check for cross-build bootstrap tools */ +#if !defined(BYTE_ORDER) +#error "Missing BYTE_ORDER defines" +#elif !defined(_LITTLE_ENDIAN) +#error "Missing _LITTLE_ENDIAN defines" +#elif !defined(_BIG_ENDIAN) +#error "Missing _BIG_ENDIAN defines" #endif #define TRUE 1 Index: head/sys/cddl/compat/opensolaris/sys/stat.h =================================================================== --- head/sys/cddl/compat/opensolaris/sys/stat.h +++ head/sys/cddl/compat/opensolaris/sys/stat.h @@ -32,11 +32,19 @@ #include_next +/* + * When bootstrapping on Linux a stat64/fstat64 functions exists in both + * glibc and musl libc. To avoid compilation errors, use those functions instead + * of redefining them to stat/fstat. + * Similarly, macOS provides (deprecated) stat64 functions that we can use + * for now. + */ +#if !defined(__linux__) && !defined(__APPLE__) #define stat64 stat #define MAXOFFSET_T OFF_MAX -#ifndef _KERNEL +#if !defined(_KERNEL) #include static __inline int @@ -51,6 +59,7 @@ } return (ret); } -#endif +#endif /* !defined(_KERNEL) */ +#endif /* !defined(__linux__) && !defined(__APPLE__) */ #endif /* !_COMPAT_OPENSOLARIS_SYS_STAT_H_ */ Index: head/sys/cddl/compat/opensolaris/sys/time.h =================================================================== --- head/sys/cddl/compat/opensolaris/sys/time.h +++ head/sys/cddl/compat/opensolaris/sys/time.h @@ -29,6 +29,7 @@ #ifndef _OPENSOLARIS_SYS_TIME_H_ #define _OPENSOLARIS_SYS_TIME_H_ +#include #include_next #define SEC 1 Index: head/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h =================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h @@ -46,8 +46,12 @@ /* * Disk blocks (sectors) and bytes. */ +#ifndef dtob #define dtob(DD) ((DD) << DEV_BSHIFT) +#endif +#ifndef btod #define btod(BB) (((BB) + DEV_BSIZE - 1) >> DEV_BSHIFT) +#endif #define btodt(BB) ((BB) >> DEV_BSHIFT) #define lbtod(BB) (((offset_t)(BB) + DEV_BSIZE - 1) >> DEV_BSHIFT) @@ -220,9 +224,12 @@ /* * Macros for counting and rounding. */ +#ifndef howmany #define howmany(x, y) (((x)+((y)-1))/(y)) +#endif +#ifndef roundup #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) - +#endif /* * Macro to determine if value is a power of 2 */