@@ -294,6 +294,17 @@ case ${HOST_CC_MACHINE} in
294294 echo " #undef HAVE_VMM_H" > tenders/hvt/hvt_openbsd_config.h
295295 fi
296296 ;;
297+ arm64-* darwin* |aarch64-* darwin* )
298+ CONFIG_HOST_ARCH=aarch64 CONFIG_HOST=Darwin
299+ # Apple clang emits Mach-O, not ELF, and macOS ships no GNU cross
300+ # binutils, so building the target toolchain and bindings here needs
301+ # an explicit ELF cross compiler. The tenders are Linux/BSD-only and
302+ # are not built on macOS.
303+ [ -z " ${TARGET_CC} " ] && \
304+ die " macOS host requires an ELF cross toolchain: set TARGET_CC" \
305+ " (e.g. TARGET_CC='clang -target aarch64-linux-gnu')," \
306+ " TARGET_LD and TARGET_OBJCOPY"
307+ ;;
297308 * )
298309 die " Unsupported host toolchain: ${HOST_CC_MACHINE} "
299310 ;;
@@ -495,6 +506,15 @@ case ${CONFIG_HOST} in
495506 TARGET_LD_LDFLAGS=" -nopie --no-execute-only"
496507 TARGET_CC_CFLAGS=" ${TARGET_CC_CFLAGS} -fno-emulated-tls"
497508 ;;
509+ Darwin)
510+ # Cross-building ELF unikernels from macOS: the LLVM cross tools
511+ # (clang -target, ld.lld, llvm-objcopy) stand in for the GNU binutils
512+ # Apple does not ship. Same ELF build-id/-no-pie handling as the Linux
513+ # "cc as linker" case.
514+ TARGET_LD=" ${TARGET_LD:- ld.lld} "
515+ TARGET_OBJCOPY=" ${TARGET_OBJCOPY:- llvm-objcopy} "
516+ TARGET_CC_LDFLAGS=" -Wl,--build-id=none,-no-pie"
517+ ;;
498518 * )
499519 die " Unsupported host system: ${CONFIG_HOST} "
500520 ;;
0 commit comments