interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / native / omega / allen / build-one.sh

29 lines · 1554 bytes Raw Blame History
1#!/bin/sh
2# External development orchestration. Every compiler invocation verifies its pin.
3set -eu
4[ "$#" = 2 ] || { echo 'usage: build-one.sh SOURCE OUTPUT' >&2; exit 64; }
5root=$(CDPATH= cd -- "$(dirname "$0")/../../.." && pwd)
6compiler=${OMEGA_COMPILER:-"$root/build/allen-toolchain/seed/out/omc"}
7[ -f "$compiler" ] && [ -x "$compiler" ] || {
8 echo 'pinned compiler missing; follow native/omega/allen/README.md' >&2
9 exit 69
10}
11# Pin: omega-mv b8bd1d03 (local branch fix/imac-net-L974-snp on 81ab1900; compiler change pending its own review): register slots, live-slot calls, the efi 11 file word, const/bitcast, the site tables and the efi 8 link keep. AArch64 output is byte-identical to 81ab1900.
12[ "$(sha256sum "$compiler" | cut -d' ' -f1)" = 2eeab5147deb8320cb1bc7f86a5f3de534955ff89f76be2832155348706e0164 ] || {
13 echo 'compiler digest differs from the qualified pin' >&2
14 exit 65
15}
16[ ! -e "$2" ] && [ ! -L "$2" ] || { echo 'fresh output required' >&2; exit 73; }
17temporary=$(mktemp "${2}.build.XXXXXX")
18trap 'rm -f -- "$temporary" "$temporary.header" "$temporary.dynamic"' EXIT
19trap 'exit 74' HUP INT TERM
20"$compiler" < "$1" > "$temporary"
21[ -s "$temporary" ]
22readelf -h "$temporary" > "$temporary.header"
23grep -q 'Machine:.*AArch64' "$temporary.header"
24grep -q 'Type:.*EXEC' "$temporary.header"
25readelf -l -d "$temporary" > "$temporary.dynamic"
26if grep -Eq 'INTERP|NEEDED' "$temporary.dynamic"; then exit 65; fi
27chmod 700 "$temporary"
28# Atomic no-replace publication also refuses a link created during compilation.
29ln -T -- "$temporary" "$2"