From 9a6bae7619581d9211e44e81669a71fc9acd7095 Mon Sep 17 00:00:00 2001 From: Nick Spinale Date: Mon, 9 Sep 2024 19:20:27 -0700 Subject: [PATCH] Bump Rust toolchain Signed-off-by: Nick Spinale --- .../nix/rust-utils/build-crates-in-layers.nix | 2 +- hacking/nix/rust-utils/default.nix | 19 +++++++++++++++++-- hacking/nix/scope/default.nix | 6 +++--- hacking/nix/scope/microkit/default.nix | 10 +++++----- hacking/nix/scope/verus/default.nix | 6 +++++- rust-toolchain.toml | 2 +- .../aarch64-sel4-microkit-minimal.json | 10 +++++----- ...ch64-sel4-microkit-resettable-minimal.json | 10 +++++----- .../aarch64-sel4-microkit-resettable.json | 10 +++++----- support/targets/aarch64-sel4-microkit.json | 10 +++++----- support/targets/aarch64-sel4-minimal.json | 10 +++++----- support/targets/aarch64-sel4.json | 10 +++++----- support/targets/armv7a-sel4-minimal.json | 8 ++++---- support/targets/armv7a-sel4.json | 8 ++++---- support/targets/riscv32imac-sel4-minimal.json | 8 ++++---- support/targets/riscv32imac-sel4.json | 8 ++++---- .../targets/riscv32imafc-sel4-minimal.json | 8 ++++---- support/targets/riscv32imafc-sel4.json | 8 ++++---- support/targets/riscv64gc-sel4-minimal.json | 9 +++++---- support/targets/riscv64gc-sel4.json | 9 +++++---- support/targets/riscv64imac-sel4-minimal.json | 9 +++++---- support/targets/riscv64imac-sel4.json | 9 +++++---- support/targets/x86_64-sel4-minimal.json | 10 +++++----- support/targets/x86_64-sel4.json | 10 +++++----- 24 files changed, 116 insertions(+), 93 deletions(-) diff --git a/hacking/nix/rust-utils/build-crates-in-layers.nix b/hacking/nix/rust-utils/build-crates-in-layers.nix index aafff843c..61826c633 100644 --- a/hacking/nix/rust-utils/build-crates-in-layers.nix +++ b/hacking/nix/rust-utils/build-crates-in-layers.nix @@ -277,7 +277,7 @@ in let "--manifest-path" "${workspace}/Cargo.toml" "--target-dir" "$target_dir" ]) (lib.optionals (!test) [ - "--out-dir" "$out/bin" + rustEnvironment.artifactDirFlag "$out/bin" ])} ${lib.optionalString test ( diff --git a/hacking/nix/rust-utils/default.nix b/hacking/nix/rust-utils/default.nix index aca139e0b..5250672b0 100644 --- a/hacking/nix/rust-utils/default.nix +++ b/hacking/nix/rust-utils/default.nix @@ -62,22 +62,37 @@ in if channel != null then lib.hasPrefix "nightly" channel else throw "could not determine isNightly automatically" + , backwardsCompatibilityHacks ? {} , mkCustomTargetPath ? customTargetTripleTripleName: throw "unimplemented" , chooseLinker ? { targetTriple, platform }: null , compilerRTSource ? null , vendoredSuperLockfile ? null }: - { + let + elaborateBackwardsCompatibilityHacks = + { outDirInsteadOfArtifactDir ? false + , noLibraryWorkspace ? false + }: + { + inherit + outDirInsteadOfArtifactDir + noLibraryWorkspace + ; + }; + elaboratedBackwardsCompatibilityHacks = elaborateBackwardsCompatibilityHacks backwardsCompatibilityHacks; + in { inherit rustToolchain channel isNightly; inherit compilerRTSource; inherit chooseLinker; inherit vendoredSuperLockfile; + artifactDirFlag = if elaboratedBackwardsCompatibilityHacks.outDirInsteadOfArtifactDir then "--out-dir" else "--artifact-dir"; + mkTargetPath = targetTriple: if !targetTriple.isBuiltin then mkCustomTargetPath targetTriple.name else emptyDirectory; vendoredSysrootLockfile = vendorLockfile { inherit rustToolchain; - lockfile = symlinkToRegularFile "Cargo.lock" "${rustToolchain}/lib/rustlib/src/rust/Cargo.lock"; + lockfile = symlinkToRegularFile "Cargo.lock" "${rustToolchain}/lib/rustlib/src/rust/${lib.optionalString (!elaboratedBackwardsCompatibilityHacks.noLibraryWorkspace) "library/"}Cargo.lock"; }; } ); diff --git a/hacking/nix/scope/default.nix b/hacking/nix/scope/default.nix index 6e97c4c4c..339efdbaa 100644 --- a/hacking/nix/scope/default.nix +++ b/hacking/nix/scope/default.nix @@ -59,7 +59,7 @@ superCallPackage ../rust-utils {} self // defaultRustToolchain = fenix.fromToolchainFile { file = topLevelRustToolchainFile; - sha256 = "sha256-6lRcCTSUmWOh0GheLMTZkY7JC273pWLp2s98Bb2REJQ="; + sha256 = "sha256-GJR7CjFPMh450uP/EUzXeng15vusV3ktq7Cioop945U="; }; defaultRustEnvironment = elaborateRustEnvironment (mkDefaultElaborateRustEnvironmentArgs { @@ -67,8 +67,8 @@ superCallPackage ../rust-utils {} self // } // { channel = (builtins.fromTOML (builtins.readFile topLevelRustToolchainFile)).toolchain.channel; compilerRTSource = mkCompilerRTSource { - version = "18.0-2024-02-13"; - hash = "sha256-fbq8H86WT13KsXJECHbcbFkqFseLvV/EC2kihTL2lgI="; + version = "19.1-2024-07-30"; + hash = "sha256-fV51iDAbkRmWJj0twTmQKdZdLueMAKSZR6bBtgVPCbk="; }; mkCustomTargetPath = customTargetTripleTripleName: let diff --git a/hacking/nix/scope/microkit/default.nix b/hacking/nix/scope/microkit/default.nix index c6b8d97f7..3c41acfad 100644 --- a/hacking/nix/scope/microkit/default.nix +++ b/hacking/nix/scope/microkit/default.nix @@ -15,8 +15,8 @@ , sources , vendorLockfile , toTOMLFile -, defaultRustToolchain -, rustToolchain ? defaultRustToolchain +, defaultRustEnvironment +, rustEnvironment ? defaultRustEnvironment }: { board, config }: @@ -86,7 +86,7 @@ let tool = let vendoredLockfile = vendorLockfile { - inherit rustToolchain; + inherit (rustEnvironment) rustToolchain; lockfile = microkitSource + "/tool/microkit/Cargo.lock"; }; @@ -99,7 +99,7 @@ let src = lib.cleanSource (microkitSource + "/tool/microkit"); nativeBuildInputs = [ - rustToolchain + rustEnvironment.rustToolchain ]; depsBuildBuild = [ @@ -116,7 +116,7 @@ let ''; buildPhase = '' - cargo build -Z unstable-options --frozen --config ${cargoConfigFile} --out-dir $out/bin + cargo build -Z unstable-options --frozen --config ${cargoConfigFile} ${rustEnvironment.artifactDirFlag} $out/bin ''; }; diff --git a/hacking/nix/scope/verus/default.nix b/hacking/nix/scope/verus/default.nix index fdd02951b..79bd44f34 100644 --- a/hacking/nix/scope/verus/default.nix +++ b/hacking/nix/scope/verus/default.nix @@ -37,6 +37,10 @@ let inherit rustToolchain; } // { inherit (rustToolchainAttrs.toolchain) channel; + backwardsCompatibilityHacks = { + outDirInsteadOfArtifactDir = true; + noLibraryWorkspace = true; + }; mkCustomTargetPath = mkMkCustomTargetPathForEnvironment { rustEnvironment = self; }; @@ -77,7 +81,7 @@ stdenv.mkDerivation { -p verus-driver -p cargo-verus \ --features=verus-driver/singular \ --release \ - --out-dir $out/bin + ${rustEnvironment.artifactDirFlag} $out/bin ''; installPhase = '' diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 84a9735bf..48d5c371c 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -5,5 +5,5 @@ # [toolchain] -channel = "nightly-2024-05-01" +channel = "nightly-2024-09-01" components = [ "rustfmt", "rust-src", "rustc-dev", "llvm-tools-preview" ] diff --git a/support/targets/aarch64-sel4-microkit-minimal.json b/support/targets/aarch64-sel4-microkit-minimal.json index 45aadf045..47630c13b 100644 --- a/support/targets/aarch64-sel4-microkit-minimal.json +++ b/support/targets/aarch64-sel4-microkit-minimal.json @@ -1,7 +1,7 @@ { "arch": "aarch64", "crt-objects-fallback": "false", - "data-layout": "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", + "data-layout": "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32", "disable-redzone": true, "eh-frame-header": false, "env": "sel4", @@ -13,10 +13,10 @@ "llvm-target": "aarch64-unknown-none", "max-atomic-width": 128, "metadata": { - "description": null, - "host_tools": null, - "std": null, - "tier": null + "description": "Bare ARM64, hardfloat", + "host_tools": false, + "std": false, + "tier": 2 }, "panic-strategy": "abort", "pre-link-args": { diff --git a/support/targets/aarch64-sel4-microkit-resettable-minimal.json b/support/targets/aarch64-sel4-microkit-resettable-minimal.json index 3232e379a..19dc9e75c 100644 --- a/support/targets/aarch64-sel4-microkit-resettable-minimal.json +++ b/support/targets/aarch64-sel4-microkit-resettable-minimal.json @@ -1,7 +1,7 @@ { "arch": "aarch64", "crt-objects-fallback": "false", - "data-layout": "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", + "data-layout": "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32", "disable-redzone": true, "eh-frame-header": false, "env": "sel4", @@ -13,10 +13,10 @@ "llvm-target": "aarch64-unknown-none", "max-atomic-width": 128, "metadata": { - "description": null, - "host_tools": null, - "std": null, - "tier": null + "description": "Bare ARM64, hardfloat", + "host_tools": false, + "std": false, + "tier": 2 }, "panic-strategy": "abort", "pre-link-args": { diff --git a/support/targets/aarch64-sel4-microkit-resettable.json b/support/targets/aarch64-sel4-microkit-resettable.json index 391e5eafd..693a4d77a 100644 --- a/support/targets/aarch64-sel4-microkit-resettable.json +++ b/support/targets/aarch64-sel4-microkit-resettable.json @@ -1,7 +1,7 @@ { "arch": "aarch64", "crt-objects-fallback": "false", - "data-layout": "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", + "data-layout": "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32", "disable-redzone": true, "env": "sel4", "exe-suffix": ".elf", @@ -13,10 +13,10 @@ "llvm-target": "aarch64-unknown-none", "max-atomic-width": 128, "metadata": { - "description": null, - "host_tools": null, - "std": null, - "tier": null + "description": "Bare ARM64, hardfloat", + "host_tools": false, + "std": false, + "tier": 2 }, "pre-link-args": { "gnu-lld": [ diff --git a/support/targets/aarch64-sel4-microkit.json b/support/targets/aarch64-sel4-microkit.json index 75def462d..b151b793f 100644 --- a/support/targets/aarch64-sel4-microkit.json +++ b/support/targets/aarch64-sel4-microkit.json @@ -1,7 +1,7 @@ { "arch": "aarch64", "crt-objects-fallback": "false", - "data-layout": "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", + "data-layout": "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32", "disable-redzone": true, "env": "sel4", "exe-suffix": ".elf", @@ -13,10 +13,10 @@ "llvm-target": "aarch64-unknown-none", "max-atomic-width": 128, "metadata": { - "description": null, - "host_tools": null, - "std": null, - "tier": null + "description": "Bare ARM64, hardfloat", + "host_tools": false, + "std": false, + "tier": 2 }, "pre-link-args": { "gnu-lld": [ diff --git a/support/targets/aarch64-sel4-minimal.json b/support/targets/aarch64-sel4-minimal.json index 8c96d6741..495696505 100644 --- a/support/targets/aarch64-sel4-minimal.json +++ b/support/targets/aarch64-sel4-minimal.json @@ -1,7 +1,7 @@ { "arch": "aarch64", "crt-objects-fallback": "false", - "data-layout": "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", + "data-layout": "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32", "disable-redzone": true, "eh-frame-header": false, "env": "sel4", @@ -12,10 +12,10 @@ "llvm-target": "aarch64-unknown-none", "max-atomic-width": 128, "metadata": { - "description": null, - "host_tools": null, - "std": null, - "tier": null + "description": "Bare ARM64, hardfloat", + "host_tools": false, + "std": false, + "tier": 2 }, "panic-strategy": "abort", "pre-link-args": { diff --git a/support/targets/aarch64-sel4.json b/support/targets/aarch64-sel4.json index 0432c64d1..dd3dcf500 100644 --- a/support/targets/aarch64-sel4.json +++ b/support/targets/aarch64-sel4.json @@ -1,7 +1,7 @@ { "arch": "aarch64", "crt-objects-fallback": "false", - "data-layout": "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", + "data-layout": "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32", "disable-redzone": true, "env": "sel4", "exe-suffix": ".elf", @@ -12,10 +12,10 @@ "llvm-target": "aarch64-unknown-none", "max-atomic-width": 128, "metadata": { - "description": null, - "host_tools": null, - "std": null, - "tier": null + "description": "Bare ARM64, hardfloat", + "host_tools": false, + "std": false, + "tier": 2 }, "pre-link-args": { "gnu-lld": [ diff --git a/support/targets/armv7a-sel4-minimal.json b/support/targets/armv7a-sel4-minimal.json index d1deba6a7..6c4f5a3a6 100644 --- a/support/targets/armv7a-sel4-minimal.json +++ b/support/targets/armv7a-sel4-minimal.json @@ -15,10 +15,10 @@ "llvm-target": "armv7a-none-eabi", "max-atomic-width": 64, "metadata": { - "description": null, - "host_tools": null, - "std": null, - "tier": null + "description": "Bare Armv7-A", + "host_tools": false, + "std": false, + "tier": 2 }, "panic-strategy": "abort", "relocation-model": "static", diff --git a/support/targets/armv7a-sel4.json b/support/targets/armv7a-sel4.json index f2bfdaf38..bb21bcf10 100644 --- a/support/targets/armv7a-sel4.json +++ b/support/targets/armv7a-sel4.json @@ -15,10 +15,10 @@ "llvm-target": "armv7a-none-eabi", "max-atomic-width": 64, "metadata": { - "description": null, - "host_tools": null, - "std": null, - "tier": null + "description": "Bare Armv7-A", + "host_tools": false, + "std": false, + "tier": 2 }, "panic-strategy": "abort", "relocation-model": "static", diff --git a/support/targets/riscv32imac-sel4-minimal.json b/support/targets/riscv32imac-sel4-minimal.json index 67d19abe0..b10bdeaad 100644 --- a/support/targets/riscv32imac-sel4-minimal.json +++ b/support/targets/riscv32imac-sel4-minimal.json @@ -13,10 +13,10 @@ "llvm-target": "riscv32", "max-atomic-width": 32, "metadata": { - "description": null, - "host_tools": null, - "std": null, - "tier": null + "description": "Bare RISC-V (RV32IMAC ISA)", + "host_tools": false, + "std": false, + "tier": 2 }, "panic-strategy": "abort", "relocation-model": "static", diff --git a/support/targets/riscv32imac-sel4.json b/support/targets/riscv32imac-sel4.json index 7d8c0aa29..7d0175059 100644 --- a/support/targets/riscv32imac-sel4.json +++ b/support/targets/riscv32imac-sel4.json @@ -13,10 +13,10 @@ "llvm-target": "riscv32", "max-atomic-width": 32, "metadata": { - "description": null, - "host_tools": null, - "std": null, - "tier": null + "description": "Bare RISC-V (RV32IMAC ISA)", + "host_tools": false, + "std": false, + "tier": 2 }, "relocation-model": "static", "target-pointer-width": "32" diff --git a/support/targets/riscv32imafc-sel4-minimal.json b/support/targets/riscv32imafc-sel4-minimal.json index 62ffee573..b3721a1be 100644 --- a/support/targets/riscv32imafc-sel4-minimal.json +++ b/support/targets/riscv32imafc-sel4-minimal.json @@ -14,10 +14,10 @@ "llvm-target": "riscv32", "max-atomic-width": 32, "metadata": { - "description": null, - "host_tools": null, - "std": null, - "tier": null + "description": "Bare RISC-V (RV32IMAFC ISA)", + "host_tools": false, + "std": false, + "tier": 2 }, "panic-strategy": "abort", "relocation-model": "static", diff --git a/support/targets/riscv32imafc-sel4.json b/support/targets/riscv32imafc-sel4.json index 4f24dd24c..3ec282683 100644 --- a/support/targets/riscv32imafc-sel4.json +++ b/support/targets/riscv32imafc-sel4.json @@ -14,10 +14,10 @@ "llvm-target": "riscv32", "max-atomic-width": 32, "metadata": { - "description": null, - "host_tools": null, - "std": null, - "tier": null + "description": "Bare RISC-V (RV32IMAFC ISA)", + "host_tools": false, + "std": false, + "tier": 2 }, "relocation-model": "static", "target-pointer-width": "32" diff --git a/support/targets/riscv64gc-sel4-minimal.json b/support/targets/riscv64gc-sel4-minimal.json index 9db197202..014201eb0 100644 --- a/support/targets/riscv64gc-sel4-minimal.json +++ b/support/targets/riscv64gc-sel4-minimal.json @@ -15,14 +15,15 @@ "llvm-target": "riscv64", "max-atomic-width": 64, "metadata": { - "description": null, - "host_tools": null, - "std": null, - "tier": null + "description": "Bare RISC-V (RV64IMAFDC ISA)", + "host_tools": false, + "std": false, + "tier": 2 }, "panic-strategy": "abort", "relocation-model": "static", "supported-sanitizers": [ + "shadow-call-stack", "kernel-address" ], "target-pointer-width": "64" diff --git a/support/targets/riscv64gc-sel4.json b/support/targets/riscv64gc-sel4.json index e77f9d145..8b6bd0f78 100644 --- a/support/targets/riscv64gc-sel4.json +++ b/support/targets/riscv64gc-sel4.json @@ -15,13 +15,14 @@ "llvm-target": "riscv64", "max-atomic-width": 64, "metadata": { - "description": null, - "host_tools": null, - "std": null, - "tier": null + "description": "Bare RISC-V (RV64IMAFDC ISA)", + "host_tools": false, + "std": false, + "tier": 2 }, "relocation-model": "static", "supported-sanitizers": [ + "shadow-call-stack", "kernel-address" ], "target-pointer-width": "64" diff --git a/support/targets/riscv64imac-sel4-minimal.json b/support/targets/riscv64imac-sel4-minimal.json index f9dd0dbf2..ad39b2158 100644 --- a/support/targets/riscv64imac-sel4-minimal.json +++ b/support/targets/riscv64imac-sel4-minimal.json @@ -14,14 +14,15 @@ "llvm-target": "riscv64", "max-atomic-width": 64, "metadata": { - "description": null, - "host_tools": null, - "std": null, - "tier": null + "description": "Bare RISC-V (RV64IMAC ISA)", + "host_tools": false, + "std": false, + "tier": 2 }, "panic-strategy": "abort", "relocation-model": "static", "supported-sanitizers": [ + "shadow-call-stack", "kernel-address" ], "target-pointer-width": "64" diff --git a/support/targets/riscv64imac-sel4.json b/support/targets/riscv64imac-sel4.json index 3e9f022b4..a8c081458 100644 --- a/support/targets/riscv64imac-sel4.json +++ b/support/targets/riscv64imac-sel4.json @@ -14,13 +14,14 @@ "llvm-target": "riscv64", "max-atomic-width": 64, "metadata": { - "description": null, - "host_tools": null, - "std": null, - "tier": null + "description": "Bare RISC-V (RV64IMAC ISA)", + "host_tools": false, + "std": false, + "tier": 2 }, "relocation-model": "static", "supported-sanitizers": [ + "shadow-call-stack", "kernel-address" ], "target-pointer-width": "64" diff --git a/support/targets/x86_64-sel4-minimal.json b/support/targets/x86_64-sel4-minimal.json index 41e4e6383..318f61aa6 100644 --- a/support/targets/x86_64-sel4-minimal.json +++ b/support/targets/x86_64-sel4-minimal.json @@ -8,16 +8,16 @@ "eh-frame-header": false, "env": "sel4", "exe-suffix": ".elf", - "features": "-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-3dnow,-3dnowa,-avx,-avx2,+soft-float", + "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 + "description": "Freestanding/bare-metal x86_64 softfloat", + "host_tools": false, + "std": false, + "tier": 2 }, "panic-strategy": "abort", "plt-by-default": false, diff --git a/support/targets/x86_64-sel4.json b/support/targets/x86_64-sel4.json index 42e3316e6..c3d8699b6 100644 --- a/support/targets/x86_64-sel4.json +++ b/support/targets/x86_64-sel4.json @@ -7,17 +7,17 @@ "disable-redzone": true, "env": "sel4", "exe-suffix": ".elf", - "features": "-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-3dnow,-3dnowa,-avx,-avx2,+soft-float", + "features": "-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-avx,-avx2,+soft-float", "has-thread-local": true, "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 + "description": "Freestanding/bare-metal x86_64 softfloat", + "host_tools": false, + "std": false, + "tier": 2 }, "plt-by-default": false, "relro-level": "full",