diff options
| author | Ralf Jung <post@ralfj.de> | 2025-06-10 08:10:16 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2025-06-10 08:10:16 +0200 |
| commit | fceb8d65107cb081bed799050519ec805ddb8ef7 (patch) | |
| tree | a20ffd1e33e4050e17cb66ab68337a843c12142b | |
| parent | 89db7778d664a88d679ce3a58dbba208dd180629 (diff) | |
| download | rust-fceb8d65107cb081bed799050519ec805ddb8ef7.tar.gz rust-fceb8d65107cb081bed799050519ec805ddb8ef7.zip | |
sync max_fundamental_align with alloc crate
| -rw-r--r-- | src/tools/miri/src/shims/alloc.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/tools/miri/src/shims/alloc.rs b/src/tools/miri/src/shims/alloc.rs index d7bb16f0858..f05c5fbbe1d 100644 --- a/src/tools/miri/src/shims/alloc.rs +++ b/src/tools/miri/src/shims/alloc.rs @@ -15,11 +15,14 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // This is given by `alignof(max_align_t)`. The following list is taken from // `library/std/src/sys/alloc/mod.rs` (where this is called `MIN_ALIGN`) and should // be kept in sync. + let os = this.tcx.sess.target.os.as_ref(); let max_fundamental_align = match this.tcx.sess.target.arch.as_ref() { - "x86" | "arm" | "loongarch32" | "mips" | "mips32r6" | "powerpc" | "powerpc64" - | "wasm32" => 8, - "x86_64" | "aarch64" | "mips64" | "mips64r6" | "s390x" | "sparc64" | "loongarch64" => - 16, + "riscv32" if matches!(os, "espidf" | "zkvm") => 4, + "xtensa" if matches!(os, "espidf") => 4, + "x86" | "arm" | "m68k" | "csky" | "loongarch32" | "mips" | "mips32r6" | "powerpc" + | "powerpc64" | "sparc" | "wasm32" | "hexagon" | "riscv32" | "xtensa" => 8, + "x86_64" | "aarch64" | "arm64ec" | "loongarch64" | "mips64" | "mips64r6" | "s390x" + | "sparc64" | "riscv64" | "wasm64" => 16, arch => bug!("unsupported target architecture for malloc: `{}`", arch), }; // The C standard only requires sufficient alignment for any *type* with size less than or |
