mirror of
https://github.com/golang/go
synced 2024-11-25 13:07:57 -07:00
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
This commit is contained in:
parent
fad10f9c1c
commit
15d8b05f0c
@ -1023,6 +1023,11 @@ textaddress(void)
|
|||||||
}
|
}
|
||||||
va += sym->size;
|
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;
|
sect->len = va - sect->vaddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user