]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go, cmd/link: enable -buildmode=shared on linux/ppc64le
authorMichael Hudson-Doyle <michael.hudson@canonical.com>
Wed, 4 Nov 2015 20:55:44 +0000 (09:55 +1300)
committerMichael Hudson-Doyle <michael.hudson@canonical.com>
Thu, 12 Nov 2015 23:58:52 +0000 (23:58 +0000)
Change-Id: Ifba76413b8aa78a221385bf505b92a3a5fbc3d24
Reviewed-on: https://go-review.googlesource.com/16713
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/go/build.go
src/cmd/link/internal/ld/lib.go
src/cmd/link/internal/ld/symtab.go
src/cmd/link/internal/ppc64/obj.go

index 4c832d38d3019b4915445a98a104d6c89dcd4d46..40e1e41e4e3ee1fe292d638f437eaa49ff25ae3c 100644 (file)
@@ -391,7 +391,7 @@ func buildModeInit() {
                        codegenArg = "-fPIC"
                } else {
                        switch platform {
-                       case "linux/386", "linux/amd64", "linux/arm", "linux/arm64":
+                       case "linux/386", "linux/amd64", "linux/arm", "linux/arm64", "linux/ppc64le":
                        default:
                                fatalf("-buildmode=shared not supported on %s\n", platform)
                        }
@@ -412,7 +412,7 @@ func buildModeInit() {
                        case "linux/386", "linux/amd64", "linux/arm", "linux/arm64", "linux/ppc64le":
                                buildAsmflags = append(buildAsmflags, "-D=GOBUILDMODE_shared=1")
                        default:
-                               fatalf("-buildmode=shared not supported on %s\n", platform)
+                               fatalf("-linkshared not supported on %s\n", platform)
                        }
                        codegenArg = "-dynlink"
                        // TODO(mwhudson): remove -w when that gets fixed in linker.
index 8101353485a69729a38761066c87986bf6f3cd65..e2ffa1a123036877fb36fe5110800a30b73a051a 100644 (file)
@@ -322,7 +322,7 @@ func (mode *BuildMode) Set(s string) error {
                }
                *mode = BuildmodeCShared
        case "shared":
-               if goos != "linux" || (goarch != "386" && goarch != "amd64" && goarch != "arm" && goarch != "arm64") {
+               if goos != "linux" || (goarch != "386" && goarch != "amd64" && goarch != "arm" && goarch != "arm64" && goarch != "ppc64le") {
                        return badmode()
                }
                *mode = BuildmodeShared
index 16b6ee1a55d0f75727ae294b1d862cf4871adedd..3e6169e453210b913316889bd327e92ceda07269 100644 (file)
@@ -162,7 +162,7 @@ func putelfsym(x *LSym, s string, t int, addr int64, size int64, ver int, go_ *L
        if x.Type&obj.SHIDDEN != 0 {
                other = STV_HIDDEN
        }
-       if Buildmode == BuildmodePIE && Thearch.Thechar == '9' && type_ == STT_FUNC && x.Name != "runtime.duffzero" && x.Name != "runtime.duffcopy" {
+       if (Buildmode == BuildmodePIE || DynlinkingGo()) && Thearch.Thechar == '9' && type_ == STT_FUNC && x.Name != "runtime.duffzero" && x.Name != "runtime.duffcopy" {
                // On ppc64 the top three bits of the st_other field indicate how
                // many instructions separate the global and local entry points. In
                // our case it is two instructions, indicated by the value 3.
index 248c66e25b641c0704908bb844a894a66ea079bd..c604d3b4922566ce96d2a30dc258262b832de546 100644 (file)
@@ -99,7 +99,11 @@ func archinit() {
        }
 
        switch ld.Buildmode {
-       case ld.BuildmodePIE:
+       case ld.BuildmodePIE, ld.BuildmodeShared:
+               ld.Linkmode = ld.LinkExternal
+       }
+
+       if ld.Linkshared {
                ld.Linkmode = ld.LinkExternal
        }