diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-01-21 22:03:13 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-21 22:03:13 +0100 |
| commit | 701a8330e8ee2135137fa3fed5154e5d03945df9 (patch) | |
| tree | 5541278f6ada1343e0d6427c8fb4445448e698a4 | |
| parent | 10c9ec399ecce52c1d7a9c766f297fefe8cd9aed (diff) | |
| parent | 5296baeab13658b307c782e9464cfa6f2027a4ec (diff) | |
| download | rust-701a8330e8ee2135137fa3fed5154e5d03945df9.tar.gz rust-701a8330e8ee2135137fa3fed5154e5d03945df9.zip | |
Rollup merge of #92586 - esp-rs:bugfix/allocation-alignment-espidf, r=yaahc
Set the allocation MIN_ALIGN for espidf to 4. Closes https://github.com/esp-rs/rust/issues/99. cc: `@ivmarkov`
| -rw-r--r-- | library/std/src/sys/common/alloc.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/library/std/src/sys/common/alloc.rs b/library/std/src/sys/common/alloc.rs index 9665d1fa892..e06eaf6db1a 100644 --- a/library/std/src/sys/common/alloc.rs +++ b/library/std/src/sys/common/alloc.rs @@ -14,8 +14,8 @@ use crate::ptr; target_arch = "asmjs", target_arch = "wasm32", target_arch = "hexagon", - target_arch = "riscv32", - target_arch = "xtensa" + all(target_arch = "riscv32", not(target_os = "espidf")), + all(target_arch = "xtensa", not(target_os = "espidf")), )))] pub const MIN_ALIGN: usize = 8; #[cfg(all(any( @@ -28,6 +28,12 @@ pub const MIN_ALIGN: usize = 8; target_arch = "wasm64", )))] pub const MIN_ALIGN: usize = 16; +// The allocator on the esp-idf platform guarentees 4 byte alignment. +#[cfg(all(any( + all(target_arch = "riscv32", target_os = "espidf"), + all(target_arch = "xtensa", target_os = "espidf"), +)))] +pub const MIN_ALIGN: usize = 4; pub unsafe fn realloc_fallback( alloc: &System, |
