1
0
mirror of https://github.com/golang/go synced 2024-11-23 17:50:06 -07:00

cmd/go, cmd/link: allow -buildmode=pie on linux/ppc64le

Change-Id: I0d0abbb9503c3a3c35d846fc0379836b2c483dea
Reviewed-on: https://go-review.googlesource.com/15962
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-10-12 12:32:03 +13:00
parent 5e1d0fcbed
commit 2ffdbd7ce4
3 changed files with 12 additions and 5 deletions

View File

@ -122,7 +122,7 @@ and test commands:
arguments to pass on each go tool link invocation.
-linkshared
link against shared libraries previously created with
-buildmode=shared
-buildmode=shared.
-pkgdir dir
install and load all packages from dir instead of the usual locations.
For example, when building with a non-standard configuration,

View File

@ -101,7 +101,7 @@ and test commands:
arguments to pass on each go tool link invocation.
-linkshared
link against shared libraries previously created with
-buildmode=shared
-buildmode=shared.
-pkgdir dir
install and load all packages from dir instead of the usual locations.
For example, when building with a non-standard configuration,
@ -332,6 +332,9 @@ func buildModeInit() {
_, gccgo := buildToolchain.(gccgoToolchain)
var codegenArg string
platform := goos + "/" + goarch
if buildBuildmode != "default" {
buildAsmflags = append(buildAsmflags, "-D=GOBUILDMODE_"+strings.Replace(buildBuildmode, "-", "_", -1)+"=1")
}
switch buildBuildmode {
case "archive":
pkgsFilter = pkgsNotMain
@ -375,7 +378,7 @@ func buildModeInit() {
fatalf("-buildmode=pie not supported by gccgo")
} else {
switch platform {
case "android/arm", "linux/amd64", "android/amd64":
case "android/arm", "linux/amd64", "android/amd64", "linux/ppc64le":
codegenArg = "-shared"
default:
fatalf("-buildmode=pie not supported on %s\n", platform)
@ -389,7 +392,6 @@ func buildModeInit() {
} else {
switch platform {
case "linux/386", "linux/amd64", "linux/arm", "linux/arm64":
buildAsmflags = append(buildAsmflags, "-D=GOBUILDMODE_shared=1")
default:
fatalf("-buildmode=shared not supported on %s\n", platform)
}
@ -407,7 +409,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":
buildAsmflags = append(buildAsmflags, "-D=GOBUILDMODE_shared=1")
default:
fatalf("-buildmode=shared not supported on %s\n", platform)

View File

@ -98,6 +98,11 @@ func archinit() {
ld.Linkmode = ld.LinkInternal
}
switch ld.Buildmode {
case ld.BuildmodePIE:
ld.Linkmode = ld.LinkExternal
}
switch ld.HEADTYPE {
default:
if ld.Linkmode == ld.LinkAuto {