diff options
| author | Cherry Zhang <cherryyz@google.com> | 2020-01-31 14:45:52 -0500 |
|---|---|---|
| committer | Cherry Zhang <cherryyz@google.com> | 2020-01-31 14:45:52 -0500 |
| commit | ee04d45b8f380c2e3b3b26bc4771cd97fbd9d260 (patch) | |
| tree | 5db2e0ca22bb7d54f7c6d8a8d4acc96224b2e85c /src/cmd/dist | |
| parent | 23c96e9bbd29e3a815e6faabbc40af0d4c4d4353 (diff) | |
| parent | 96002cd25c343edfb6c06d2bf1f31ae1e345b81f (diff) | |
| download | go-ee04d45b8f380c2e3b3b26bc4771cd97fbd9d260.tar.xz | |
[dev.link] all: merge branch 'master' into dev.link
It has been a while we have not done this.
Merge conflict resolution:
- deleted/rewritten code modified on master
- CL 214286, ported in CL 217317
(cmd/internal/obj/objfile.go)
- CL 210678, it already includes a fix to new code
(cmd/link/internal/ld/deadcode.go)
- CL 209317, applied in this CL
(cmd/link/internal/loadelf/ldelf.go)
Change-Id: Ie927ea6a1d69ce49e8d03e56148cb2725e377876
Diffstat (limited to 'src/cmd/dist')
| -rw-r--r-- | src/cmd/dist/build.go | 20 | ||||
| -rw-r--r-- | src/cmd/dist/buildtool.go | 3 | ||||
| -rw-r--r-- | src/cmd/dist/main.go | 2 |
3 files changed, 22 insertions, 3 deletions
diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go index 9eb9e8f241..62e00b0856 100644 --- a/src/cmd/dist/build.go +++ b/src/cmd/dist/build.go @@ -110,6 +110,9 @@ func xinit() { fatalf("$GOROOT must be set") } goroot = filepath.Clean(b) + if modRoot := findModuleRoot(goroot); modRoot != "" { + fatalf("found go.mod file in %s: $GOROOT must not be inside a module", modRoot) + } b = os.Getenv("GOROOT_FINAL") if b == "" { @@ -1532,7 +1535,7 @@ var cgoEnabled = map[string]bool{ "linux/mipsle": true, "linux/mips64": true, "linux/mips64le": true, - "linux/riscv64": true, + "linux/riscv64": false, // Issue 36641 "linux/s390x": true, "linux/sparc64": true, "android/386": true, @@ -1560,7 +1563,6 @@ var cgoEnabled = map[string]bool{ // List of platforms which are supported but not complete yet. These get // filtered out of cgoEnabled for 'dist list'. See golang.org/issue/28944 var incomplete = map[string]bool{ - "linux/riscv64": true, "linux/sparc64": true, } @@ -1590,6 +1592,20 @@ func checkCC() { } } +func findModuleRoot(dir string) (root string) { + for { + if fi, err := os.Stat(filepath.Join(dir, "go.mod")); err == nil && !fi.IsDir() { + return dir + } + d := filepath.Dir(dir) + if d == dir { + break + } + dir = d + } + return "" +} + func defaulttarg() string { // xgetwd might return a path with symlinks fully resolved, and if // there happens to be symlinks in goroot, then the hasprefix test diff --git a/src/cmd/dist/buildtool.go b/src/cmd/dist/buildtool.go index 12baccbc4f..118800e8da 100644 --- a/src/cmd/dist/buildtool.go +++ b/src/cmd/dist/buildtool.go @@ -45,10 +45,11 @@ var bootstrapDirs = []string{ "cmd/compile/internal/mips", "cmd/compile/internal/mips64", "cmd/compile/internal/ppc64", - "cmd/compile/internal/types", + "cmd/compile/internal/riscv64", "cmd/compile/internal/s390x", "cmd/compile/internal/ssa", "cmd/compile/internal/syntax", + "cmd/compile/internal/types", "cmd/compile/internal/x86", "cmd/compile/internal/wasm", "cmd/internal/bio", diff --git a/src/cmd/dist/main.go b/src/cmd/dist/main.go index 3e54915122..b8a8c5f2e6 100644 --- a/src/cmd/dist/main.go +++ b/src/cmd/dist/main.go @@ -122,6 +122,8 @@ func main() { if elfIsLittleEndian(os.Args[0]) { gohostarch = "mipsle" } + case strings.Contains(out, "riscv64"): + gohostarch = "riscv64" case strings.Contains(out, "s390x"): gohostarch = "s390x" case gohostos == "darwin": |
