]> Cypherpunks repositories - gostls13.git/commit
cmd/link: additional fixes for -newobj and "ld -r" ELF host objects
authorThan McIntosh <thanm@google.com>
Mon, 25 Nov 2019 19:07:59 +0000 (14:07 -0500)
committerThan McIntosh <thanm@google.com>
Mon, 2 Dec 2019 19:05:01 +0000 (19:05 +0000)
commite4c01f088bec6cc504a1e9dc85c97741c06b3868
treee38265011c2999ed1cb50d921a20b185f8de40f6
parentbf3ee57d27f7542808f8a153c7b547efaba355b0
cmd/link: additional fixes for -newobj and "ld -r" ELF host objects

The previous fix for this issue (CL 208479) was not general enough;
this patch revises it to handle more cases.

The problem with the original fix was that once a sym.Symbol is
created for a given static symbol and given a bogus anonymous version
of -1, we hit problems if some other non-anonymous symbol (created by
host object loading) had relocations targeting the static symbol.

In this patch instead of assigning a fixed anonymous version of -1 to
such symbols, each time loader.Create is invoked we create a new
(unique) anonymous version for the sym.Symbol, then enter the result
into the loader's extStaticSyms map, permitting it to be found in
lookups when processing relocation targets.

NB: this code will hopefully get a lot simpler once we can move host
object loading away from early sym.Symbol creation.

Updates #35779.

Change-Id: I450ff577e17549025565d355d6707a2d28a5a617
Reviewed-on: https://go-review.googlesource.com/c/go/+/208778
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/link/internal/loader/loader.go