mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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:
parent
a35c85c0cc
commit
9a476028c0
4 changed files with 9 additions and 5 deletions
|
|
@ -391,7 +391,7 @@ func buildModeInit() {
|
||||||
codegenArg = "-fPIC"
|
codegenArg = "-fPIC"
|
||||||
} else {
|
} else {
|
||||||
switch platform {
|
switch platform {
|
||||||
case "linux/386", "linux/amd64", "linux/arm", "linux/arm64":
|
case "linux/386", "linux/amd64", "linux/arm", "linux/arm64", "linux/ppc64le":
|
||||||
default:
|
default:
|
||||||
fatalf("-buildmode=shared not supported on %s\n", platform)
|
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":
|
case "linux/386", "linux/amd64", "linux/arm", "linux/arm64", "linux/ppc64le":
|
||||||
buildAsmflags = append(buildAsmflags, "-D=GOBUILDMODE_shared=1")
|
buildAsmflags = append(buildAsmflags, "-D=GOBUILDMODE_shared=1")
|
||||||
default:
|
default:
|
||||||
fatalf("-buildmode=shared not supported on %s\n", platform)
|
fatalf("-linkshared not supported on %s\n", platform)
|
||||||
}
|
}
|
||||||
codegenArg = "-dynlink"
|
codegenArg = "-dynlink"
|
||||||
// TODO(mwhudson): remove -w when that gets fixed in linker.
|
// TODO(mwhudson): remove -w when that gets fixed in linker.
|
||||||
|
|
|
||||||
|
|
@ -322,7 +322,7 @@ func (mode *BuildMode) Set(s string) error {
|
||||||
}
|
}
|
||||||
*mode = BuildmodeCShared
|
*mode = BuildmodeCShared
|
||||||
case "shared":
|
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()
|
return badmode()
|
||||||
}
|
}
|
||||||
*mode = BuildmodeShared
|
*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 {
|
if x.Type&obj.SHIDDEN != 0 {
|
||||||
other = STV_HIDDEN
|
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
|
// On ppc64 the top three bits of the st_other field indicate how
|
||||||
// many instructions separate the global and local entry points. In
|
// many instructions separate the global and local entry points. In
|
||||||
// our case it is two instructions, indicated by the value 3.
|
// our case it is two instructions, indicated by the value 3.
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,11 @@ func archinit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ld.Buildmode {
|
switch ld.Buildmode {
|
||||||
case ld.BuildmodePIE:
|
case ld.BuildmodePIE, ld.BuildmodeShared:
|
||||||
|
ld.Linkmode = ld.LinkExternal
|
||||||
|
}
|
||||||
|
|
||||||
|
if ld.Linkshared {
|
||||||
ld.Linkmode = ld.LinkExternal
|
ld.Linkmode = ld.LinkExternal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue