]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.4] runtime: remove assumption that noptrdata data bss noptrbss...
authorRuss Cox <rsc@golang.org>
Wed, 19 Nov 2014 20:31:31 +0000 (15:31 -0500)
committerRuss Cox <rsc@golang.org>
Wed, 19 Nov 2014 20:31:31 +0000 (15:31 -0500)
commit427ee80413acc77fdf63fb77b992fe100fc9aea5
tree751c053a45781b8e7313123b151d7a6d2dcf6222
parentb4df0154c21cd5d229138c678007aafca0867432
[release-branch.go1.4] runtime: remove assumption that noptrdata data bss noptrbss are ordered and contiguous

««« CL 179980043 / d71cc7e8a0e0
runtime: remove assumption that noptrdata data bss noptrbss are ordered and contiguous

The assumption can be violated by external linkers reordering them or
inserting non-Go sections in between them. I looked briefly at trying
to write out the _go_.o in external linking mode in a way that forced
the ordering, but no matter what there's no way to force Go's data
and Go's bss to be next to each other. If there is any data or bss from
non-Go objects, it's very likely to get stuck in between them.

Instead, rewrite the two places we know about that make the assumption.
I grepped for noptrdata to look for more and didn't find any.

The added race test (os/exec in external linking mode) fails without
the changes in the runtime. It crashes with an invalid pointer dereference.

Fixes #9133.

LGTM=dneil
R=dneil
CC=dvyukov, golang-codereviews, iant
https://golang.org/cl/179980043
»»»

LGTM=dneil
R=dneil
CC=golang-codereviews
https://golang.org/cl/173510043
src/run.bash
src/runtime/malloc.go
src/runtime/race.c