aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/ld
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2012-02-23 23:01:36 -0500
committerRuss Cox <rsc@golang.org>2012-02-23 23:01:36 -0500
commit15d8b05f0ca604e40ba42a3e9f6d30b1a280d1d8 (patch)
tree3e922287014015728633f35582dddeb850dc1947 /src/cmd/ld
parentfad10f9c1cba2aef54ef3822d6c3688eb1c25483 (diff)
downloadgo-15d8b05f0ca604e40ba42a3e9f6d30b1a280d1d8.tar.xz
ld: fix alignment of rodata section
We were not aligning the code size, so read-only data, which follows in the same segment, could be arbitrarily misaligned. Fixes #2506. R=golang-dev, iant CC=golang-dev https://golang.org/cl/5693055
Diffstat (limited to 'src/cmd/ld')
-rw-r--r--src/cmd/ld/data.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cmd/ld/data.c b/src/cmd/ld/data.c
index 397ae83b23..786c10b64d 100644
--- a/src/cmd/ld/data.c
+++ b/src/cmd/ld/data.c
@@ -1023,6 +1023,11 @@ textaddress(void)
}
va += sym->size;
}
+
+ // Align end of code so that rodata starts aligned.
+ // 128 bytes is likely overkill but definitely cheap.
+ va = rnd(va, 128);
+
sect->len = va - sect->vaddr;
}