From db9fd99ba8bd638f64079d8f0f8a2b282c71a4df Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Mon, 23 Mar 2026 16:56:09 +0000 Subject: [PATCH] cross-build: Provide mempcpy when building on macOS We could patch the tzcode config to not use it, but it's simple to provide an implementation of it and avoid spreading cross-build bootstrapping special cases. Fixes: ff2c98b30b57 ("tzcode: Update to 2026a") MFC after: 1 week (cherry picked from commit 47402c9422ec6c9ba76d96414f5a08bd35a9e1fd) --- tools/build/Makefile | 7 +++++++ tools/build/cross-build/include/mac/string.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/tools/build/Makefile b/tools/build/Makefile index b6925688896d..92c80493139e 100644 --- a/tools/build/Makefile +++ b/tools/build/Makefile @@ -183,6 +183,13 @@ SRCS+= progname.c # Stub implementations of fflagstostr/strtofflags SRCS+= fflags.c .endif + +.if ${.MAKE.OS} == "Darwin" +# macOS currently lacks mempcpy +.PATH: ${LIBC_SRCTOP}/string +SRCS+= mempcpy.c +.endif # ${MAKE.OS} == "Darwin" + # Provide the same arc4random implementation on Linux/macOS CFLAGS.arc4random.c+= -I${SRCTOP}/sys/crypto/chacha20 -D__isthreaded=1 SRCS+= arc4random.c arc4random_uniform.c diff --git a/tools/build/cross-build/include/mac/string.h b/tools/build/cross-build/include/mac/string.h index 58464f1f9834..8a36bb1f392d 100644 --- a/tools/build/cross-build/include/mac/string.h +++ b/tools/build/cross-build/include/mac/string.h @@ -37,6 +37,8 @@ #include_next +void *(mempcpy)(void * __restrict, const void * __restrict, size_t); + /* * 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