]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj: remove Link.Windows field
authorDave Cheney <dave@cheney.net>
Mon, 21 Mar 2016 03:37:57 +0000 (14:37 +1100)
committerDave Cheney <dave@cheney.net>
Mon, 21 Mar 2016 04:07:09 +0000 (04:07 +0000)
This CL addresses a long standing CL by rsc by pushing the use of
Link.Windows down to its two users.

Link.Window was always initalised with the value of runtime.GOOS so
this does not affect cross compilation.

Change-Id: Ibbae068f8b5aad06336909691f094384caf12352
Reviewed-on: https://go-review.googlesource.com/20869
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/compile/internal/gc/main.go
src/cmd/internal/obj/link.go
src/cmd/internal/obj/sym.go

index b29f7d10ae34d5565d3ea15c965675807306efd5..e7011646c3e6efe1909cb3bb1f454c19630b9408 100644 (file)
@@ -16,6 +16,7 @@ import (
        "log"
        "os"
        "path"
+       "runtime"
        "strconv"
        "strings"
 )
@@ -571,7 +572,7 @@ func isDriveLetter(b byte) bool {
 // is this path a local name?  begins with ./ or ../ or /
 func islocalname(name string) bool {
        return strings.HasPrefix(name, "/") ||
-               Ctxt.Windows != 0 && len(name) >= 3 && isDriveLetter(name[0]) && name[1] == ':' && name[2] == '/' ||
+               runtime.GOOS == "windows" && len(name) >= 3 && isDriveLetter(name[0]) && name[1] == ':' && name[2] == '/' ||
                strings.HasPrefix(name, "./") || name == "." ||
                strings.HasPrefix(name, "../") || name == ".."
 }
@@ -893,7 +894,7 @@ func mkpackage(pkgname string) {
                if i := strings.LastIndex(p, "/"); i >= 0 {
                        p = p[i+1:]
                }
-               if Ctxt.Windows != 0 {
+               if runtime.GOOS == "windows" {
                        if i := strings.LastIndex(p, `\`); i >= 0 {
                                p = p[i+1:]
                        }
index 8cae1255cd0e5549a3a2492141a40cadab5ce3b4..e2993630a9a7f94e9142a544c7f5a842a8c7a310 100644 (file)
@@ -618,7 +618,6 @@ type Link struct {
        Flag_optimize bool
        Bso           *Biobuf
        Pathname      string
-       Windows       int32
        Goroot        string
        Goroot_final  string
        Hash          map[SymVer]*LSym
index 41623266f59d79687fa422507be324e2b1d1c640..a723eb4689d7643c6c0f5e19107177dccbc7b6b1 100644 (file)
@@ -35,7 +35,6 @@ import (
        "log"
        "os"
        "path/filepath"
-       "runtime"
        "strconv"
 )
 
@@ -83,10 +82,6 @@ func Linknew(arch *LinkArch) *Link {
        ctxt.Version = HistVersion
        ctxt.Goroot = Getgoroot()
        ctxt.Goroot_final = os.Getenv("GOROOT_FINAL")
-       if runtime.GOOS == "windows" {
-               // TODO(rsc): Remove ctxt.Windows and let callers use runtime.GOOS.
-               ctxt.Windows = 1
-       }
 
        var buf string
        buf, _ = os.Getwd()