]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: add -shared to darwin/arm{,64} default build mode
authorElias Naur <elias.naur@gmail.com>
Sat, 7 May 2016 05:24:39 +0000 (07:24 +0200)
committerElias Naur <elias.naur@gmail.com>
Sat, 7 May 2016 18:58:39 +0000 (18:58 +0000)
Buildmode c-archive now supports position independent code for
darwin/arm (in addition to darwin/arm64). Make PIC (-shared) the
default for both platforms in the default buildmode.

Without this change, gomobile will go install the standard library
into its separate package directory without PIC support.

Also add -shared to darwin/arm64 in buildmode c-archive, for
symmetry (darwin/arm64 always generates position independent code).

Fixes #15519

Change-Id: If27d2cbea8f40982e14df25da2703cbba572b5c6
Reviewed-on: https://go-review.googlesource.com/22920
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

misc/cgo/testcarchive/carchive_test.go
src/cmd/go/build.go

index 0174e31015692892addcb12d6a01e7029e5d8667..ab14c007a9cb5241d89083a1cd48c6765f8eefcc 100644 (file)
@@ -84,7 +84,7 @@ func init() {
                cc = append(cc, []string{"-framework", "CoreFoundation", "-framework", "Foundation"}...)
        }
        libgodir = GOOS + "_" + GOARCH
-       if GOOS == "darwin" && GOARCH == "arm" {
+       if GOOS == "darwin" && (GOARCH == "arm" || GOARCH == "arm64") {
                libgodir = GOOS + "_" + GOARCH + "_shared"
        }
        cc = append(cc, "-I", filepath.Join("pkg", libgodir))
index 6bef09b66b86bff340f5d60f9d8eee915bae6ca9..e0cb216b8c4e5605f0e817aff95a905cdaa621d4 100644 (file)
@@ -335,7 +335,7 @@ func buildModeInit() {
                        return p
                }
                switch platform {
-               case "darwin/arm":
+               case "darwin/arm", "darwin/arm64":
                        codegenArg = "-shared"
                default:
                }
@@ -361,6 +361,9 @@ func buildModeInit() {
                case "android/arm", "android/arm64", "android/amd64", "android/386":
                        codegenArg = "-shared"
                        ldBuildmode = "pie"
+               case "darwin/arm", "darwin/arm64":
+                       codegenArg = "-shared"
+                       fallthrough
                default:
                        ldBuildmode = "exe"
                }