]> Cypherpunks repositories - gostls13.git/commit
[dev.link] cmd/link: handle runtime.text/etext symbols more consistently
authorCherry Zhang <cherryyz@google.com>
Fri, 26 Jun 2020 02:22:59 +0000 (22:22 -0400)
committerCherry Zhang <cherryyz@google.com>
Fri, 26 Jun 2020 14:25:58 +0000 (14:25 +0000)
commita9a1217112aa8f5e01fe2f3e5f203ac880dbd566
tree7ca9e8a38188b2dda3504ab302f2643a57e0588b
parent1fdf5ba50cf67d28dffb4a4f0e29fcb053d660ad
[dev.link] cmd/link: handle runtime.text/etext symbols more consistently

Currently, on most platforms, the start/end symbols runtime.text
and runtime.etext are defined in symtab pass and assigned values
in address pass. In some cases (darwin+dynlink or AIX+external),
however, they are defined and assigned values in textaddress pass
(because they need non-zero sizes). Then their values get
overwritten in address pass. This is bad. The linker expects
their values to be consistent. In particular, in CL 239281,
findfunctab is split to two parts. The two parts need to have a
consistent view of the start/end symbols. If its value changes in
between, bad things can happen.

This CL fixes it by always defining runtime.text/etext symbols in
the textaddress pass.

Fix darwin and AIX builds.

Change-Id: Ifdc1bcb69d99be1b7e5b4fd31d473650c03e3b9d
Reviewed-on: https://go-review.googlesource.com/c/go/+/240065
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
src/cmd/link/internal/ld/data.go
src/cmd/link/internal/ld/lib.go
src/cmd/link/internal/ld/symtab.go