Fix the default alignment of the allocations.
In order to enforce this constraint:
The pointer returned if the allocation succeeds shall be suitably
aligned so that it may be assigned to a pointer to any type of object
and then used to access such an object in the space allocated.
Force all allocations on 32 bit systems to have 8 byte alignment,
and all allocations on 64 bit systems to have 16 byte alignment.
Add a test to verify that the allocator returns the correct alignments.
Bug: 26739265
Change-Id: I9af53279617408676b94e4ec6481b3ed7ffafc6a
diff --git a/libc/malloc_debug/malloc_debug.h b/libc/malloc_debug/malloc_debug.h
index 6f9f90f..347fae2 100644
--- a/libc/malloc_debug/malloc_debug.h
+++ b/libc/malloc_debug/malloc_debug.h
@@ -39,7 +39,7 @@
// will still be in this order.
// Header (Required)
// BacktraceHeader (Optional: For the allocation backtrace)
-// uint8_t data (Optional: Front guard, will be a multiple of sizeof(uintptr_t))
+// uint8_t data (Optional: Front guard, will be a multiple of MINIMUM_ALIGNMENT_BYTES)
// allocation data
// uint8_t data (Optional: End guard)
//