#!/bin/sh set -eu TASK_ROOT=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) export TASK_ROOT cd "$TASK_ROOT" if [ -z "${RUSTC:-}" ]; then if command -v rustc >/dev/null 2>&1; then RUSTC=$(command -v rustc) elif [ -n "${CARGO_HOME:-}" ] && [ -x "${CARGO_HOME}/bin/rustc" ]; then RUSTC="${CARGO_HOME}/bin/rustc" elif [ -x "$HOME/.cargo/bin/rustc" ]; then RUSTC="$HOME/.cargo/bin/rustc" else echo "error: rustc not found (set RUSTC or CARGO_HOME, or add rustc to PATH)" >&2 exit 1 fi fi export RUSTC make --no-print-directory -f - audit <<'MK' ROOT := $(TASK_ROOT) RUST_BUILD_PRODUCT_RECEIPT := $(ROOT)/target/gpu-arch-codegen/config.json include $(ROOT)/utils.mk OUT := $(ROOT)/target/gpu-arch-codegen COMMON := $(filter-out --crate-type=lib --emit=obj,$(RUST_KERNEL_FLAGS)) -C embed-bitcode=yes .PHONY: audit audit: @mkdir -p $(OUT) @rm -f $(OUT)/libnv_rs_abi.rlib $(OUT)/libnv_rs_core.rlib $(OUT)/audit.a $(OUT)/audit.o "$(RUSTC)" $(COMMON) --crate-name nv_rs_abi --crate-type=rlib $(ROOT)/src/common/abi/src/lib.rs -o $(OUT)/libnv_rs_abi.rlib "$(RUSTC)" $(COMMON) --crate-name nv_rs_core --crate-type=rlib $(ROOT)/src/nvidia/src/lib.rs --extern nv_rs_abi=$(OUT)/libnv_rs_abi.rlib -o $(OUT)/libnv_rs_core.rlib "$(RUSTC)" $(COMMON) --crate-name nv_arch_audit --crate-type=staticlib -C lto=fat $(ROOT)/tests/gpu-arch-codegen.rs --extern nv_rs_abi=$(OUT)/libnv_rs_abi.rlib --extern nv_rs_core=$(OUT)/libnv_rs_core.rlib -L dependency=$(OUT) -o $(OUT)/audit.a ld -r --gc-sections --whole-archive $(OUT)/audit.a --no-whole-archive -u NV_RS_AUDIT_ARCH_GET -u NV_RS_AUDIT_ARCH_NEW -u NV_RS_AUDIT_ARCH_CLOSE -u NV_RS_AUDIT_ARCH_REFERENCES -u NV_RS_AUDIT_ARCH_IMAGE -o $(OUT)/audit.o $(OBJCOPY) --remove-section=.llvmbc --remove-section=.llvmcmd --remove-section=.eh_frame --remove-section=.eh_frame_hdr --remove-section=.gcc_except_table $(OUT)/audit.o MK python3 tools/check_native_codegen.py --object target/gpu-arch-codegen/audit.o --report reports/gpu-arch-production-codegen.json --entrypoint NV_RS_AUDIT_ARCH_GET --entrypoint NV_RS_AUDIT_ARCH_NEW --entrypoint NV_RS_AUDIT_ARCH_CLOSE --entrypoint NV_RS_AUDIT_ARCH_REFERENCES --entrypoint NV_RS_AUDIT_ARCH_IMAGE --scope 'Compile-only actual ArchitectureRegistry<32> get/create/cache ownership, final-storage constructor, reads, external-reference preflight and cleanup under unchanged utils.mk production flags. Five real retained typed wrappers, no memcpy/memset threshold overrides. No module loading/GPU access. Fixed per-function stack check is not a full call-chain bound.'