]> Cypherpunks repositories - gostls13.git/commit
cmd/link: fix bug with -newobj and "ld -r" ELF host objects
authorThan McIntosh <thanm@google.com>
Fri, 22 Nov 2019 20:27:01 +0000 (15:27 -0500)
committerThan McIntosh <thanm@google.com>
Sat, 23 Nov 2019 00:06:41 +0000 (00:06 +0000)
commitf29e53d66419713f011cda50a3001cc20950bc7e
treec5dc0a25c2ce8bc8d5cde75c7a3ca133dcb11915
parent6ba1bf393af0d4fb71e29a0e7f0f52502cff29eb
cmd/link: fix bug with -newobj and "ld -r" ELF host objects

When the ELF host object loader encounters a static/hidden symbol, it
creates a sym.Symbol for it but does not enter it into the sym.Symbols
lookup table. Under -newobj mode, this was not happening correctly; we
were adding the sym via loader.LookupOrCreate, which resulted in
collisions when it encountered symbols with the same name + version +
section (this can happen for "ld -r" objects).

Fixes #35779.

Change-Id: I36d40fc1efc03fc1cd8ae6b76cb6a0d2a957389c
Reviewed-on: https://go-review.googlesource.com/c/go/+/208479
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/link/internal/loadelf/ldelf.go
src/cmd/link/internal/loader/loader.go