1
0
mirror of https://github.com/golang/go synced 2024-11-26 03:17:57 -07:00

[dev.boringcrypto] cmd/link: work around DWARF symbol bug

The DWARF code is mishandling the case when the host object files
define multiple (distinct) symbols with the same name. They are mapped
to the same DWARF debug symbol, which then appears on the dwarfp
list multiple times, which then breaks the code that processes the list.
Detect duplicates and skip them, because that's trivial, instead of fixing
the underlying problem.

See #21566.

Change-Id: Ib5a34c891d7c15f4c7bb6239d8f31a1ec767b8bc
Reviewed-on: https://go-review.googlesource.com/57943
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Russ Cox 2017-08-22 22:50:27 -04:00
parent 7e9e3a06cb
commit 991652dcf0

View File

@ -1868,6 +1868,11 @@ func (ctxt *Link) dodata() {
datsize = Rnd(datsize, int64(sect.Align))
sect.Vaddr = uint64(datsize)
for _, s := range dwarfp[i:] {
// Syms can (incorrectly) appear twice on the list. Ignore repeats.
// See golang.org/issue/21566.
if s.Type == SRODATA {
continue
}
if s.Type != SDWARFINFO {
break
}