Skip to content

Apple's open-source XNU kernel on Android phones: its own loader and drivers, Metal on the Adreno. Runs from RAM; a reboot gives the phone back to Android.

C
794 B
Raw Blame
#!/bin/bash
# clang wrapper for cross-building XNU on Linux:
#  - forces an Apple Mach-O target (stock Linux clang defaults to ELF)
#  - drops flags only Apple's clang understands
#  - links with the cctools ld64
HB="$(cd "$(dirname "$0")" && pwd)"
case "$(basename "$0")" in *++) drv=clang++; extra=(-fno-use-cxa-atexit);; *) drv=clang; extra=();; esac
args=()
for a in "$@"; do
  case "$a" in
    -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang) ;;
    -fapple-kext-vtable-verify|-Wno-vla-cxx-extension) ;;
    -Werror|-Werror=*|-Weverything|-pedantic-errors) ;;
    *) args+=("$a");;
  esac
done
exec /usr/bin/$drv -include "$HB/../../hostinc/xnu_clang_compat.h" -target arm64-apple-ios${XNU_SDK_VERSION:-16.5} --ld-path="$HB/ld64" \
  -w "${extra[@]}" "${args[@]}"