]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.link] cmd/internal/obj: convert "\" to "/" in file path
authorCherry Zhang <cherryyz@google.com>
Sat, 12 Oct 2019 18:01:57 +0000 (14:01 -0400)
committerCherry Zhang <cherryyz@google.com>
Tue, 15 Oct 2019 17:13:55 +0000 (17:13 +0000)
The old code does this. Do the same.

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

index caa442c0d3802aca8f973a1d3ebb18494da441a3..3f68d335ac2ec54b741bd36b303cb8daf5a11f58 100644 (file)
@@ -12,6 +12,7 @@ import (
        "cmd/internal/goobj2"
        "cmd/internal/objabi"
        "fmt"
+       "path/filepath"
        "strings"
 )
 
@@ -200,11 +201,11 @@ func (w *writer) StringTable() {
                }
                pc := &s.Func.Pcln
                for _, f := range pc.File {
-                       w.AddString(f)
+                       w.AddString(filepath.ToSlash(f))
                }
                for _, call := range pc.InlTree.nodes {
                        f, _ := linkgetlineFromPos(w.ctxt, call.Pos)
-                       w.AddString(f)
+                       w.AddString(filepath.ToSlash(f))
                }
        })
        for _, f := range w.ctxt.PosTable.DebugLinesFileTable() {
@@ -242,8 +243,12 @@ func (w *writer) Sym(s *LSym) {
        if s.TopFrame() {
                flag |= goobj2.SymFlagTopFrame
        }
+       name := s.Name
+       if strings.HasPrefix(name, "gofile..") {
+               name = filepath.ToSlash(name)
+       }
        o := goobj2.Sym{
-               Name: s.Name,
+               Name: name,
                ABI:  abi,
                Type: uint8(s.Type),
                Flag: flag,