__heap_base was not aligned. In practice, it will often be aligned simply because it follows the stack, but when the stack is placed at the beginning (with the --stack-first option), the __heap_base might be unaligned. It could even be byte-aligned.
At least wasi-libc appears to expect that __heap_base is aligned: https://github.com/WebAssembly/wasi-libc/blob/659ff414560721b1660a19685110e484a081c3d4/dlmalloc/src/malloc.c#L5224
While WebAssembly itself does not appear to require any alignment for memory accesses, it is sometimes required when sharing a pointer externally. For example, WASI might expect alignment up to 8: https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md#-timestamp-u64
This issue got introduced with the addition of the --stack-first flag: https://reviews.llvm.org/D46141
I suspect the lack of alignment wasn't intentional here.
I think it would make sense to use 16 here since the default ABI has a max_align_t of 16.
Maybe just call this heapAlignment?