Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 19 Sep 2020 12:08:16 +0000 (UTC)
From:      Alex Richardson <arichardson@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r365901 - in head: cddl/lib/libspl tools/build/cross-build/include/common tools/build/cross-build/include/common/sys tools/build/cross-build/include/linux/sys tools/build/cross-build/in...
Message-ID:  <202009191208.08JC8Giu047870@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: arichardson
Date: Sat Sep 19 12:08:16 2020
New Revision: 365901
URL: https://svnweb.freebsd.org/changeset/base/365901

Log:
  Fix dtrace tools bootstrap on non-FreeBSD after OpenZFS import
  
  This required surprisingly few build system changes and only two changes to the
  openZFS compat headers which have been upstreamed as
  https://github.com/openzfs/zfs/pull/10863
  
  Reviewed By:	#zfs, freqlabs
  Differential Revision: https://reviews.freebsd.org/D26193

Deleted:
  head/tools/build/cross-build/include/common/sys/uio.h
Modified:
  head/cddl/lib/libspl/Makefile
  head/tools/build/cross-build/include/common/string.h
  head/tools/build/cross-build/include/common/sys/cdefs.h
  head/tools/build/cross-build/include/linux/sys/stat.h
  head/tools/build/cross-build/include/mac/sys/_types.h
  head/tools/build/mk/Makefile.boot

Modified: head/cddl/lib/libspl/Makefile
==============================================================================
--- head/cddl/lib/libspl/Makefile	Sat Sep 19 11:27:16 2020	(r365900)
+++ head/cddl/lib/libspl/Makefile	Sat Sep 19 12:08:16 2020	(r365901)
@@ -14,13 +14,14 @@ SRCS = \
         list.c \
         mkdirp.c \
         page.c \
-        strlcat.c \
-        strlcpy.c \
         timestamp.c \
         zone.c \
         include/sys/list.h \
         include/sys/list_impl.h
 
+# These functions are not required when bootstrapping and the atomic code
+# will not compile when building on macOS.
+.if !defined(BOOTSTRAPPING)
 SRCS += \
         getexecname.c \
         gethostid.c \
@@ -37,6 +38,7 @@ SRCS += atomic.S
 .else
 .PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libspl/asm-generic
 SRCS += atomic.c
+.endif
 .endif
 
 

Modified: head/tools/build/cross-build/include/common/string.h
==============================================================================
--- head/tools/build/cross-build/include/common/string.h	Sat Sep 19 11:27:16 2020	(r365900)
+++ head/tools/build/cross-build/include/common/string.h	Sat Sep 19 12:08:16 2020	(r365901)
@@ -37,6 +37,10 @@
  */
 #pragma once
 
+/* Avoid incompatible opensolaris redeclarations (without _FORTIFY_SOURCE). */
+#define HAVE_STRLCAT 1
+#define HAVE_STRLCPY 1
+
 #include_next <string.h>
 /*
  * FreeBSD string.h #includes strings.h and all libmd code depends on

Modified: head/tools/build/cross-build/include/common/sys/cdefs.h
==============================================================================
--- head/tools/build/cross-build/include/common/sys/cdefs.h	Sat Sep 19 11:27:16 2020	(r365900)
+++ head/tools/build/cross-build/include/common/sys/cdefs.h	Sat Sep 19 12:08:16 2020	(r365901)
@@ -276,3 +276,11 @@ typedef unsigned long u_long;
 #ifndef __DEQUALIFY
 #define __DEQUALIFY(type, var) ((type)(__uintptr_t)(const volatile void *)(var))
 #endif
+
+
+/* Expose all declarations when using FreeBSD headers */
+#define	__POSIX_VISIBLE		200809
+#define	__XSI_VISIBLE		700
+#define	__BSD_VISIBLE		1
+#define	__ISO_C_VISIBLE		2011
+#define	__EXT1_VISIBLE		1

Modified: head/tools/build/cross-build/include/linux/sys/stat.h
==============================================================================
--- head/tools/build/cross-build/include/linux/sys/stat.h	Sat Sep 19 11:27:16 2020	(r365900)
+++ head/tools/build/cross-build/include/linux/sys/stat.h	Sat Sep 19 12:08:16 2020	(r365901)
@@ -59,3 +59,6 @@
 #ifndef S_ISTXT
 #define S_ISTXT S_ISVTX
 #endif
+
+/* This include is needed for OpenZFS bootstrap */
+#include <sys/mount.h>

Modified: head/tools/build/cross-build/include/mac/sys/_types.h
==============================================================================
--- head/tools/build/cross-build/include/mac/sys/_types.h	Sat Sep 19 11:27:16 2020	(r365900)
+++ head/tools/build/cross-build/include/mac/sys/_types.h	Sat Sep 19 12:08:16 2020	(r365901)
@@ -43,3 +43,5 @@
  * __darwin_ct_rune_t exists.
  */
 typedef __darwin_ct_rune_t __ct_rune_t;
+/* Needed for opensolaris compat. */
+typedef	__int64_t	off64_t;

Modified: head/tools/build/mk/Makefile.boot
==============================================================================
--- head/tools/build/mk/Makefile.boot	Sat Sep 19 11:27:16 2020	(r365900)
+++ head/tools/build/mk/Makefile.boot	Sat Sep 19 12:08:16 2020	(r365901)
@@ -44,7 +44,6 @@ LIBELF:=${WORLDTMP}/legacy/usr/lib/libelf.a
 CFLAGS+=	-Werror=implicit-function-declaration -Werror=implicit-int \
 		-Werror=return-type -Wundef
 CFLAGS+=	-DHAVE_NBTOOL_CONFIG_H=1
-CFLAGS+=	-D__BSD_VISIBLE=1
 CFLAGS+=	-I${SRCTOP}/tools/build/cross-build/include/common
 
 # b64_pton and b64_ntop is in libresolv on MacOS and Linux:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202009191208.08JC8Giu047870>