]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.link] cmd/internal/goobj: replace `"".` with package prefix in newobj mode
authorCherry Zhang <cherryyz@google.com>
Wed, 9 Oct 2019 19:53:03 +0000 (15:53 -0400)
committerCherry Zhang <cherryyz@google.com>
Thu, 10 Oct 2019 22:05:44 +0000 (22:05 +0000)
This is the behavior of the old code. Do the same.

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

index 442784de3a0b269207338e7b90a69dafed865e5d..b4b84692d5ea97bc03644cf4cb1020cde1538341 100644 (file)
@@ -8,6 +8,7 @@ import (
        "cmd/internal/goobj2"
        "cmd/internal/objabi"
        "fmt"
+       "strings"
 )
 
 // Read object file in new format. For now we still fill
@@ -67,7 +68,11 @@ func (r *objReader) readNew() {
                if osym.Name == "" {
                        continue // not a real symbol
                }
-               symID := SymID{Name: osym.Name, Version: abiToVer(osym.ABI)}
+               // In a symbol name in an object file, "". denotes the
+               // prefix for the package in which the object file has been found.
+               // Expand it.
+               name := strings.ReplaceAll(osym.Name, `"".`, r.pkgprefix)
+               symID := SymID{Name: name, Version: abiToVer(osym.ABI)}
                r.p.SymRefs = append(r.p.SymRefs, symID)
 
                if i >= ndef {