On x86-64, sys.GoarchAmd64 == 1 for -mx32. But -mx32 has 32-bit pointer, not 64-bit. There is
// _64bit = 1 on 64-bit systems, 0 on 32-bit systems _64bit = 1 << (^uintptr(0) >> 63) / 2 We should check both _64bit and sys.GoarchAmd64. PR go/87470 * go/runtime/malloc.go (arenaBaseOffset): Also check _64bit. --- libgo/go/runtime/malloc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libgo/go/runtime/malloc.go b/libgo/go/runtime/malloc.go index ac4759ffbf1..c3445387057 100644 --- a/libgo/go/runtime/malloc.go +++ b/libgo/go/runtime/malloc.go @@ -306,7 +306,7 @@ const ( // // On other platforms, the user address space is contiguous // and starts at 0, so no offset is necessary. - arenaBaseOffset uintptr = sys.GoarchAmd64 * (1 << 47) + arenaBaseOffset uintptr = _64bit * sys.GoarchAmd64 * (1 << 47) // Max number of threads to run garbage collection. // 2, 3, and 4 are all plausible maximums depending -- 2.17.1