Skip to content

Commit 12ef4f2

Browse files
committed
Set the allocation MIN_ALIGN for espidf to 1.
1 parent 936ce3d commit 12ef4f2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

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

+9-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,13 @@ pub const MIN_ALIGN: usize = 8;
2828
target_arch = "wasm64",
2929
)))]
3030
pub const MIN_ALIGN: usize = 16;
31+
// By default, the allocator on the esp-idf platform guarentees no specific alignment.
32+
// This can be changed, but not though libc API's so we set the MIN_ALIGN here to 1.
33+
#[cfg(all(any(
34+
all(target_arch = "riscv32", target_os = "espidf"),
35+
all(target_arch = "xtensa", target_os = "espidf"),
36+
)))]
37+
pub const MIN_ALIGN: usize = 1;
3138

3239
pub unsafe fn realloc_fallback(
3340
alloc: &System,

0 commit comments

Comments
 (0)