From 4fca3953210ded1ff08e0c1681c027b620c206b2 Mon Sep 17 00:00:00 2001 From: Anthony Martin Date: Wed, 11 May 2011 23:52:05 -0400 Subject: [PATCH] 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 --- src/cmd/8l/obj.c | 2 +- src/cmd/ld/data.c | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/cmd/8l/obj.c b/src/cmd/8l/obj.c index 2a38f7ef0a..f84a30f390 100644 --- a/src/cmd/8l/obj.c +++ b/src/cmd/8l/obj.c @@ -188,7 +188,7 @@ main(int argc, char *argv[]) if(INITDAT == -1) INITDAT = 0; if(INITRND == -1) - INITRND = 1; + INITRND = 4096; break; case Hmsdoscom: /* MS-DOS .COM */ HEADR = 0; diff --git a/src/cmd/ld/data.c b/src/cmd/ld/data.c index 0cb2b2138f..f6f71305fd 100644 --- a/src/cmd/ld/data.c +++ b/src/cmd/ld/data.c @@ -899,10 +899,8 @@ address(void) segdata.fileoff = va - segtext.vaddr + segtext.fileoff; if(HEADTYPE == Hwindows) segdata.fileoff = segtext.fileoff + rnd(segtext.len, PEFILEALIGN); - if(HEADTYPE == Hplan9x32) { - segdata.vaddr = va = rnd(va, 4096); + if(HEADTYPE == Hplan9x32) segdata.fileoff = segtext.fileoff + segtext.filelen; - } for(s=segdata.sect; s != nil; s=s->next) { s->vaddr = va; va += s->len;