From 6f4580264a29fa73097e96b436141a8594b97610 Mon Sep 17 00:00:00 2001 From: Albert van der Linde Date: Tue, 14 Jul 2020 07:47:26 +0000 Subject: prog/alloc: align address allocation for aligned[addr] Calls to alloc didn't respect the alignment attribute. Now Type.Alignment() is used to ensure each type is correctly aligned. Existing descriptions with [align[X]] don't have an issue as they align to small blocks and default align is to 64 bytes. This commits adds support for [align[X]] for an X larger than 64. --- prog/encoding.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'prog/encoding.go') diff --git a/prog/encoding.go b/prog/encoding.go index 1f5b2b374..6dd2a2582 100644 --- a/prog/encoding.go +++ b/prog/encoding.go @@ -1017,7 +1017,7 @@ func (p *parser) fixupAutos(prog *Prog) { _ = s case *PtrType: a := arg.(*PointerArg) - a.Address = s.ma.alloc(nil, a.Res.Size()) + a.Address = s.ma.alloc(nil, a.Res.Size(), a.Res.Type().Alignment()) default: panic(fmt.Sprintf("unsupported auto type %T", typ)) } -- cgit mrf-deployment