Check for specific, important misalignment in garbage collector.
Not a complete fix for issue 599 but an important workaround.
Update #599.
R=golang-dev, iant, dvyukov
CC=golang-dev
https://golang.org/cl/
6641049
static int32
alignsymsize(int32 s)
{
- if(s >= PtrSize)
+ if(s >= 8)
+ s = rnd(s, 8);
+ else if(s >= PtrSize)
s = rnd(s, PtrSize);
else if(s > 2)
s = rnd(s, 4);
datsize += rnd(s->size, PtrSize);
}
sect->len = datsize - sect->vaddr;
+ datsize = rnd(datsize, PtrSize);
/* gcdata */
sect = addsection(&segtext, ".gcdata", 04);
M *m1;
uint32 i;
+ // The atomic operations are not atomic if the uint64s
+ // are not aligned on uint64 boundaries. This has been
+ // a problem in the past.
+ if((((uintptr)&work.empty) & 7) != 0)
+ runtime·throw("runtime: gc work buffer is misaligned");
+
// The gc is turned off (via enablegc) until
// the bootstrap has completed.
// Also, malloc gets called in the guts