1
0
mirror of https://github.com/golang/go synced 2024-11-19 15:44:44 -07:00

ld: fix alignment of rodata section on Plan 9

This was causing a panic in the reflect package
since type.* pointers with their low bits set are
assumed to have certain flags set that disallow
the use of reflection.

Thanks to Pavel and Taru for help tracking down
this bug.

R=rsc, paulzhol, taruti
CC=golang-dev
https://golang.org/cl/4511041
This commit is contained in:
Anthony Martin 2011-05-11 23:52:05 -04:00 committed by Russ Cox
parent f58d911698
commit 4fca395321
2 changed files with 2 additions and 4 deletions

View File

@ -188,7 +188,7 @@ main(int argc, char *argv[])
if(INITDAT == -1) if(INITDAT == -1)
INITDAT = 0; INITDAT = 0;
if(INITRND == -1) if(INITRND == -1)
INITRND = 1; INITRND = 4096;
break; break;
case Hmsdoscom: /* MS-DOS .COM */ case Hmsdoscom: /* MS-DOS .COM */
HEADR = 0; HEADR = 0;

View File

@ -899,10 +899,8 @@ address(void)
segdata.fileoff = va - segtext.vaddr + segtext.fileoff; segdata.fileoff = va - segtext.vaddr + segtext.fileoff;
if(HEADTYPE == Hwindows) if(HEADTYPE == Hwindows)
segdata.fileoff = segtext.fileoff + rnd(segtext.len, PEFILEALIGN); segdata.fileoff = segtext.fileoff + rnd(segtext.len, PEFILEALIGN);
if(HEADTYPE == Hplan9x32) { if(HEADTYPE == Hplan9x32)
segdata.vaddr = va = rnd(va, 4096);
segdata.fileoff = segtext.fileoff + segtext.filelen; segdata.fileoff = segtext.fileoff + segtext.filelen;
}
for(s=segdata.sect; s != nil; s=s->next) { for(s=segdata.sect; s != nil; s=s->next) {
s->vaddr = va; s->vaddr = va;
va += s->len; va += s->len;