]> Cypherpunks repositories - gostls13.git/commit
[dev.link] cmd/link: support updates to contents of obj-based Syms
authorThan McIntosh <thanm@google.com>
Mon, 16 Dec 2019 19:14:29 +0000 (14:14 -0500)
committerThan McIntosh <thanm@google.com>
Mon, 6 Jan 2020 19:15:40 +0000 (19:15 +0000)
commitd5854bf8e63a5b4f8ffea6cd1a82ffcc7bb0b87b
treeb4b4d6c4d957d18cb436915be9bfc2727fbc1d94
parenta52cea446d93e736113ed05c96e14f2d180c4274
[dev.link] cmd/link: support updates to contents of obj-based Syms

Add in the hooks to SymbolBuilder and to the loader to allow
the linker to make modifications to a non-external symbol (e.g.
a sym whose index is less than loader.extStart).

The basic idea is to manufacture a new external symbol with the same
name and version, then import the old symbol's content (type, data,
relocations, etc) into the payload struct for the new symbol, and
finally redirect the name lookup tables to target the new sym for the
specified name/version.

This change is needed in order to convert over the host object loaders
to avoid use of sym.Symbol.

Change-Id: I79cd42b23794e830bbdbcbcd2c500c35c351f01f
Reviewed-on: https://go-review.googlesource.com/c/go/+/211897
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/link/internal/loader/loader.go
src/cmd/link/internal/loader/loader_test.go
src/cmd/link/internal/loader/symbolbuilder.go