From a413d5dfe9ac50b959e268446c48b2be290f31e9 Mon Sep 17 00:00:00 2001 From: Damian Gryski Date: Wed, 13 Oct 2021 09:49:42 -0700 Subject: [PATCH] rutime/gc_leaking: ensure heapptr is aligned on wasm --- src/runtime/gc_leaking.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/runtime/gc_leaking.go b/src/runtime/gc_leaking.go index 2dc76af3..60340c64 100644 --- a/src/runtime/gc_leaking.go +++ b/src/runtime/gc_leaking.go @@ -53,7 +53,12 @@ func SetFinalizer(obj interface{}, finalizer interface{}) { func initHeap() { // preinit() may have moved heapStart; reset heapptr - heapptr = heapStart + ptr := heapStart + if GOARCH == "wasm" { + // llvm11 and llvm12 do not correctly align the heap on wasm + ptr = align(ptr) + } + heapptr = ptr } // setHeapEnd sets a new (larger) heapEnd pointer.