Created
May 20, 2015 23:21
-
-
Save minux/3d795d947440dfb15903 to your computer and use it in GitHub Desktop.
Run darwin/arm64 port natively patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/cmd/dist/util.go b/src/cmd/dist/util.go | |
index cae5d69..7acacd2 100644 | |
--- a/src/cmd/dist/util.go | |
+++ b/src/cmd/dist/util.go | |
@@ -429,8 +429,11 @@ func main() { | |
case strings.Contains(out, "ppc64"): | |
gohostarch = "ppc64" | |
case gohostos == "darwin": | |
- if strings.Contains(run("", CheckExit, "uname", "-v"), "RELEASE_ARM_") { | |
+ ver := run("", CheckExit, "uname", "-v") | |
+ if strings.Contains(ver, "RELEASE_ARM_") { | |
gohostarch = "arm" | |
+ } else if strings.Contains(ver, "RELEASE_ARM64_") { | |
+ gohostarch = "arm64" | |
} | |
default: | |
fatal("unknown architecture: %s", out) | |
diff --git a/src/cmd/internal/ld/lib.go b/src/cmd/internal/ld/lib.go | |
index 753e8ee..088d77f 100644 | |
--- a/src/cmd/internal/ld/lib.go | |
+++ b/src/cmd/internal/ld/lib.go | |
@@ -896,7 +896,11 @@ func hostlink() { | |
} | |
if extld == "" { | |
- extld = "gcc" | |
+ if HEADTYPE == obj.Hdarwin { | |
+ extld = "clang" | |
+ } else { | |
+ extld = "gcc" | |
+ } | |
} | |
var argv []string | |
diff --git a/src/os/file_darwin.go b/src/os/file_darwin.go | |
index ee3a954..bf24340 100644 | |
--- a/src/os/file_darwin.go | |
+++ b/src/os/file_darwin.go | |
@@ -2,6 +2,7 @@ | |
// Use of this source code is governed by a BSD-style | |
// license that can be found in the LICENSE file. | |
+// +build cgo | |
// +build arm arm64 | |
package os |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment