]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile, cmd/go, cmd/link: enable -buildmode=shared and related flags on linux...
authorMichael Hudson-Doyle <michael.hudson@canonical.com>
Thu, 29 Oct 2015 07:24:29 +0000 (20:24 +1300)
committerMichael Hudson-Doyle <michael.hudson@canonical.com>
Thu, 29 Oct 2015 19:27:47 +0000 (19:27 +0000)
Change-Id: Ibddbbf6f4a5bd336a8b234d40fad0fcea574cd6e
Reviewed-on: https://go-review.googlesource.com/13994
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/compile/internal/gc/lex.go
src/cmd/go/build.go
src/cmd/link/internal/arm64/obj.go
src/cmd/link/internal/ld/lib.go

index b6a43ac49ef6ae05bf67520bf5fa99c52eb756cf..6ea1482313305afbf9a77a6c49cb400576a492fd 100644 (file)
@@ -227,7 +227,8 @@ func Main() {
        if Thearch.Thechar == '6' {
                obj.Flagcount("largemodel", "generate code that assumes a large memory model", &flag_largemodel)
        }
-       if Thearch.Thechar == '5' || Thearch.Thechar == '6' || Thearch.Thechar == '8' || Thearch.Thechar == '9' {
+       switch Thearch.Thechar {
+       case '5', '6', '7', '8', '9':
                flag.BoolVar(&flag_dynlink, "dynlink", false, "support references to Go symbols defined in other shared libraries")
        }
        obj.Flagstr("cpuprofile", "write cpu profile to `file`", &cpuprofile)
index e25a56ac301e9100d031ac2cc6cce09341122553..b1c95220ccc660eb193cb6321cefc622a957cd40 100644 (file)
@@ -388,7 +388,7 @@ func buildModeInit() {
                        codegenArg = "-fPIC"
                } else {
                        switch platform {
-                       case "linux/386", "linux/amd64", "linux/arm":
+                       case "linux/386", "linux/amd64", "linux/arm", "linux/arm64":
                                buildAsmflags = append(buildAsmflags, "-D=shared=1")
                        default:
                                fatalf("-buildmode=shared not supported on %s\n", platform)
@@ -407,7 +407,7 @@ func buildModeInit() {
                        codegenArg = "-fPIC"
                } else {
                        switch platform {
-                       case "linux/386", "linux/amd64", "linux/arm":
+                       case "linux/386", "linux/amd64", "linux/arm", "linux/arm64":
                                buildAsmflags = append(buildAsmflags, "-D=shared=1")
                        default:
                                fatalf("-buildmode=shared not supported on %s\n", platform)
index 5c28551d65ee3836dc8f6ff7b9edfa3a4b76458f..ae121c28bf309ef17056e307c7c465943008ca68 100644 (file)
@@ -104,7 +104,7 @@ func archinit() {
                break
        }
 
-       if ld.Buildmode == ld.BuildmodeCShared {
+       if ld.Buildmode == ld.BuildmodeCShared || ld.DynlinkingGo() {
                ld.Linkmode = ld.LinkExternal
        }
 
index a311c780ed88730e5e0103a2b9bab8adf970410c..96ead2f044b061f74419cc9703f04cb6f282e6f4 100644 (file)
@@ -321,7 +321,7 @@ func (mode *BuildMode) Set(s string) error {
                }
                *mode = BuildmodeCShared
        case "shared":
-               if goos != "linux" || (goarch != "386" && goarch != "amd64" && goarch != "arm") {
+               if goos != "linux" || (goarch != "386" && goarch != "amd64" && goarch != "arm" && goarch != "arm64") {
                        return badmode()
                }
                *mode = BuildmodeShared