From add75911f9b2aa79113a948ec90318fd9ca6039b Mon Sep 17 00:00:00 2001 From: Ivan Velickovic Date: Wed, 5 Nov 2025 12:32:06 +1100 Subject: [PATCH] Remove Rust custom targets for initialiser The motivation for this is that the Rust custom targets are an unstable feature which means it is subject to change at any point in the forseeable future. This just happened with Rust 1.91.0 which changed the format of target-pointer-width which lead to the Microkit SDK failing to build if you had a too new Rust compiler but then if we fix it for that anyone that doesn't have the latest verison of Rust then we break the SDK build for them. I can't see anything special about these targets so the embedded no OS targets that already exist for Rust should be appropriate. Signed-off-by: Ivan Velickovic --- build_sdk.py | 19 +++++------ .../support/targets/aarch64-sel4-minimal.json | 34 ------------------- .../targets/riscv64imac-sel4-minimal.json | 28 --------------- .../support/targets/x86_64-sel4-minimal.json | 32 ----------------- 4 files changed, 9 insertions(+), 104 deletions(-) delete mode 100644 initialiser/support/targets/aarch64-sel4-minimal.json delete mode 100644 initialiser/support/targets/riscv64imac-sel4-minimal.json delete mode 100644 initialiser/support/targets/x86_64-sel4-minimal.json diff --git a/build_sdk.py b/build_sdk.py index b9e991d10..0a7f5f4d8 100644 --- a/build_sdk.py +++ b/build_sdk.py @@ -74,13 +74,13 @@ def target_triple(self) -> str: else: raise Exception(f"Unsupported toolchain architecture '{self}'") - def rust_toolchain(self) -> str: + def rust_target(self) -> str: if self == KernelArch.AARCH64: - return f"{self.to_str()}-sel4-minimal" + return f"aarch64-unknown-none" elif self == KernelArch.RISCV64: - return f"{self.to_str()}imac-sel4-minimal" + return f"riscv64imac-unknown-none-elf" elif self == KernelArch.X86_64: - return f"{self.to_str()}-sel4-minimal" + return f"x86_64-unknown-none" else: raise Exception(f"Unsupported toolchain target triple '{self}'") @@ -735,8 +735,7 @@ def build_initialiser( sel4_src_dir = build_dir / board.name / config.name / "sel4" / "install" cargo_cross_options = "-Z build-std=core,alloc,compiler_builtins -Z build-std-features=compiler-builtins-mem" - cargo_target = board.arch.rust_toolchain() - rust_target_path = Path("initialiser/support/targets").absolute() + cargo_target = board.arch.rust_target() dest = ( root_dir / "board" / board.name / config.name / "elf" / f"{component_name}.elf" @@ -750,10 +749,10 @@ def build_initialiser( component_build_dir.mkdir(exist_ok=True, parents=True) if custom_rust_sel4_dir is None: - capdl_init_elf = component_build_dir / "bin" / "sel4-capdl-initializer.elf" + capdl_init_elf = component_build_dir / "bin" / "sel4-capdl-initializer" cmd = f""" RUSTC_BOOTSTRAP=1 \ - RUST_TARGET_PATH={rust_target_path} SEL4_PREFIX={sel4_src_dir.absolute()} \ + SEL4_PREFIX={sel4_src_dir.absolute()} \ cargo install {cargo_cross_options} \ --target {cargo_target} \ --git https://github.com/au-ts/rust-seL4 --branch capdl_dev sel4-capdl-initializer \ @@ -761,9 +760,9 @@ def build_initialiser( --root {component_build_dir} """ else: - capdl_init_elf = custom_rust_sel4_dir / "target" / cargo_target / "release" / "sel4-capdl-initializer.elf" + capdl_init_elf = custom_rust_sel4_dir / "target" / cargo_target / "release" / "sel4-capdl-initializer" cmd = f""" - cd {custom_rust_sel4_dir} && SEL4_PREFIX={sel4_src_dir.absolute()} {cargo_env} \ + cd {custom_rust_sel4_dir} && SEL4_PREFIX={sel4_src_dir.absolute()} \ cargo build {cargo_cross_options} --target {cargo_target} \ --release -p sel4-capdl-initializer """ diff --git a/initialiser/support/targets/aarch64-sel4-minimal.json b/initialiser/support/targets/aarch64-sel4-minimal.json deleted file mode 100644 index 46fc21aa8..000000000 --- a/initialiser/support/targets/aarch64-sel4-minimal.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "arch": "aarch64", - "crt-objects-fallback": "false", - "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32", - "disable-redzone": true, - "exe-suffix": ".elf", - "features": "+v8a,+strict-align,+neon,+fp-armv8", - "linker": "rust-lld", - "linker-flavor": "gnu-lld", - "llvm-target": "aarch64-unknown-none", - "max-atomic-width": 128, - "metadata": { - "description": null, - "host_tools": null, - "std": null, - "tier": null - }, - "panic-strategy": "abort", - "pre-link-args": { - "gnu-lld": [ - "-z", - "max-page-size=4096" - ] - }, - "relocation-model": "static", - "stack-probes": { - "kind": "inline" - }, - "supported-sanitizers": [ - "kcfi", - "kernel-address" - ], - "target-pointer-width": "64" -} diff --git a/initialiser/support/targets/riscv64imac-sel4-minimal.json b/initialiser/support/targets/riscv64imac-sel4-minimal.json deleted file mode 100644 index 8697c8c59..000000000 --- a/initialiser/support/targets/riscv64imac-sel4-minimal.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "arch": "riscv64", - "code-model": "medium", - "cpu": "generic-rv64", - "crt-objects-fallback": "false", - "data-layout": "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128", - "emit-debug-gdb-scripts": false, - "exe-suffix": ".elf", - "features": "+m,+a,+c", - "linker": "rust-lld", - "linker-flavor": "gnu-lld", - "llvm-abiname": "lp64", - "llvm-target": "riscv64", - "max-atomic-width": 64, - "metadata": { - "description": null, - "host_tools": null, - "std": null, - "tier": null - }, - "panic-strategy": "abort", - "relocation-model": "static", - "supported-sanitizers": [ - "shadow-call-stack", - "kernel-address" - ], - "target-pointer-width": "64" -} diff --git a/initialiser/support/targets/x86_64-sel4-minimal.json b/initialiser/support/targets/x86_64-sel4-minimal.json deleted file mode 100644 index c09af2c79..000000000 --- a/initialiser/support/targets/x86_64-sel4-minimal.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "arch": "x86_64", - "code-model": "small", - "cpu": "x86-64", - "crt-objects-fallback": "false", - "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128", - "disable-redzone": true, - "exe-suffix": ".elf", - "features": "-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-avx,-avx2,+soft-float", - "linker": "rust-lld", - "linker-flavor": "gnu-lld", - "llvm-target": "x86_64-unknown-none-elf", - "max-atomic-width": 64, - "metadata": { - "description": null, - "host_tools": null, - "std": null, - "tier": null - }, - "panic-strategy": "abort", - "plt-by-default": false, - "relro-level": "full", - "rustc-abi": "x86-softfloat", - "stack-probes": { - "kind": "inline" - }, - "supported-sanitizers": [ - "kcfi", - "kernel-address" - ], - "target-pointer-width": "64" -}