]> Cypherpunks repositories - gostls13.git/commit
[dev.link] cmd/link: handle multiple levels of overwrite
authorThan McIntosh <thanm@google.com>
Wed, 18 Dec 2019 20:14:46 +0000 (15:14 -0500)
committerThan McIntosh <thanm@google.com>
Thu, 9 Jan 2020 20:31:01 +0000 (20:31 +0000)
commitdb48d458388e62aa1ae8947a5f5bbd60b467bcf6
tree440dfc4613f728eb8eaf4286cd4a366393734882
parent49e94f19f0e0575fc14f6f83e5586762b263b864
[dev.link] cmd/link: handle multiple levels of overwrite

Revamp the way that symbol overwrites are handled to deal with symbols
that are overwritten more than once (such as "_cgo_mmap"). The
scenario here is that a symbol can be overwritten twice, once during
preload, and then again when host objects are read during internal
linking. This can result in a situation where we have two entries in
the overwrite map, from X -> Y and then from Y -> Z. Rather than
search the overwrite map when adding new entries, add a helper routine
for querying the map that catches this situation and fixes it up.

Also with this patch is a couple of tweaks to the loader.Dump method
to insure that it can dump the entire global index space without
crashing due to odd overwrites (as in the scenario above).

Change-Id: Ib6c8a0e03e92fc2b57318001711b501eeaf12249
Reviewed-on: https://go-review.googlesource.com/c/go/+/212098
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
src/cmd/link/internal/loader/loader.go
src/cmd/link/internal/loader/symbolbuilder.go