Commit 9a476028 authored by Michael Hudson-Doyle's avatar Michael Hudson-Doyle

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

Change-Id: Ifba76413b8aa78a221385bf505b92a3a5fbc3d24
Reviewed-on: https://go-review.googlesource.com/16713Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent a35c85c0
......@@ -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.
......
......@@ -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
......
......@@ -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.
......
......@@ -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
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment