[libgo] Fix alignment issue in persistent allocator

Message ID 2320575.aka1Yb8TTl@polaris
State New
Headers show
Series
  • [libgo] Fix alignment issue in persistent allocator
Related show

Commit Message

Eric Botcazou Feb. 16, 2019, 4:26 p.m.
This gets rid of a bunch of Go failures on SPARC.

Tested on x86-64/Linux, SPARC/Solaris and SPARC64/Linux.


2019-02-16  Eric Botcazou  <ebotcazou@adacore.com>

	* go/runtime/malloc.go (persistentalloc1): Always align the offset.

-- 
Eric Botcazou

Comments

Ian Lance Taylor Feb. 27, 2019, 3:51 p.m. | #1
On Sat, Feb 16, 2019 at 8:26 AM Eric Botcazou <ebotcazou@adacore.com> wrote:
>

> This gets rid of a bunch of Go failures on SPARC.

>

> Tested on x86-64/Linux, SPARC/Solaris and SPARC64/Linux.

>

>

> 2019-02-16  Eric Botcazou  <ebotcazou@adacore.com>

>

>         * go/runtime/malloc.go (persistentalloc1): Always align the offset.


Thanks, committed to mainline.  Also sent upstream as
https://golang.org/cl/163859.

Ian

Patch

Index: go/runtime/malloc.go
===================================================================
--- go/runtime/malloc.go	(revision 268849)
+++ go/runtime/malloc.go	(working copy)
@@ -1269,7 +1269,7 @@  func persistentalloc1(size, align uintpt
 				break
 			}
 		}
-		persistent.off = sys.PtrSize
+		persistent.off = round(sys.PtrSize, align)
 	}
 	p := persistent.base.add(persistent.off)
 	persistent.off += size