cmd/go, cmd/link: enable -buildmode=shared on linux/ppc64le

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>
This commit is contained in:
Michael Hudson-Doyle 2015-11-05 09:55:44 +13:00
parent a35c85c0cc
commit 9a476028c0
4 changed files with 9 additions and 5 deletions

View 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.

View 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

View 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.

View 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
}