aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2026-02-19 15:05:50 +0000
committerBrooks Davis <brooks@FreeBSD.org>2026-02-19 15:10:32 +0000
commit89c3ae5fc9cc24af940699b7e282fd24763f7ffa (patch)
tree83889fb0876cd24a5b4445a2cd5e3e1c81857808
parent2adc3f0db1877dbe9801e6dacfa9ae8df8879549 (diff)
build: add stddef.h to define ptraddr_t as required
Effort: CHERI upstreaming Sponsored by: Innovate UK Reviewed by: kib Co-authored-by: Alfredo Mazzinghi <am2419@cl.cam.ac.uk> Co-authored-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk> Differential Revision: https://reviews.freebsd.org/D55308
-rw-r--r--tools/build/Makefile3
-rw-r--r--tools/build/stddef.h49
2 files changed, 52 insertions, 0 deletions
diff --git a/tools/build/Makefile b/tools/build/Makefile
index 1eb539f06607..161b8f635c6d 100644
--- a/tools/build/Makefile
+++ b/tools/build/Makefile
@@ -99,6 +99,9 @@ SYSINCS+= stat.h
SRCS+= futimens.c utimensat.c
.endif
+# Define ptraddr_t for bootstrapping
+INCS+= stddef.h
+
_WITH_EXPLICIT_BZERO!= cat ${HOST_INCLUDE_ROOT}/strings.h ${HOST_INCLUDE_ROOT}/string.h | grep -c explicit_bzero || true
.if ${_WITH_EXPLICIT_BZERO} == 0
# .PATH: ${SRCTOP}/sys/libkern
diff --git a/tools/build/stddef.h b/tools/build/stddef.h
new file mode 100644
index 000000000000..77348dd57149
--- /dev/null
+++ b/tools/build/stddef.h
@@ -0,0 +1,49 @@
+/*-
+ * 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.
+ */
+#pragma once
+#include_next <stddef.h>
+
+#ifndef _PTRADDR_T_DECLARED
+#ifdef __PTRADDR_TYPE__
+typedef __PTRADDR_TYPE__ ptraddr_t;
+#else
+typedef size_t ptraddr_t;
+#endif
+#define _PTRADDR_T_DECLARED
+#endif