Skip to content

Commit 5296bae

Browse files
committed
Set the allocation MIN_ALIGN for espidf to 4.
1 parent 936ce3d commit 5296bae

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

library/std/src/sys/common/alloc.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ use crate::ptr;
1414
target_arch = "asmjs",
1515
target_arch = "wasm32",
1616
target_arch = "hexagon",
17-
target_arch = "riscv32",
18-
target_arch = "xtensa"
17+
all(target_arch = "riscv32", not(target_os = "espidf")),
18+
all(target_arch = "xtensa", not(target_os = "espidf")),
1919
)))]
2020
pub const MIN_ALIGN: usize = 8;
2121
#[cfg(all(any(
@@ -28,6 +28,12 @@ pub const MIN_ALIGN: usize = 8;
2828
target_arch = "wasm64",
2929
)))]
3030
pub const MIN_ALIGN: usize = 16;
31+
// The allocator on the esp-idf platform guarentees 4 byte alignment.
32+
#[cfg(all(any(
33+
all(target_arch = "riscv32", target_os = "espidf"),
34+
all(target_arch = "xtensa", target_os = "espidf"),
35+
)))]
36+
pub const MIN_ALIGN: usize = 4;
3137

3238
pub unsafe fn realloc_fallback(
3339
alloc: &System,

0 commit comments

Comments
 (0)