]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.boringcrypto] cmd/link: work around DWARF symbol bug
authorRuss Cox <rsc@golang.org>
Wed, 23 Aug 2017 02:50:27 +0000 (22:50 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 24 Aug 2017 18:37:26 +0000 (18:37 +0000)
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>
src/cmd/link/internal/ld/data.go

index 452332367cd9ce0c942d7087cf4638ac6b1bce08..3c92e263009dee351ad6f204aba141a45c8f53b0 100644 (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
                        }