Commit 2ffdbd7c authored by Michael Hudson-Doyle's avatar Michael Hudson-Doyle

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

Change-Id: I0d0abbb9503c3a3c35d846fc0379836b2c483dea
Reviewed-on: https://go-review.googlesource.com/15962Reviewed-by: default avatarRuss Cox <rsc@golang.org>
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 5e1d0fcb
...@@ -122,7 +122,7 @@ and test commands: ...@@ -122,7 +122,7 @@ and test commands:
arguments to pass on each go tool link invocation. arguments to pass on each go tool link invocation.
-linkshared -linkshared
link against shared libraries previously created with link against shared libraries previously created with
-buildmode=shared -buildmode=shared.
-pkgdir dir -pkgdir dir
install and load all packages from dir instead of the usual locations. install and load all packages from dir instead of the usual locations.
For example, when building with a non-standard configuration, For example, when building with a non-standard configuration,
......
...@@ -101,7 +101,7 @@ and test commands: ...@@ -101,7 +101,7 @@ and test commands:
arguments to pass on each go tool link invocation. arguments to pass on each go tool link invocation.
-linkshared -linkshared
link against shared libraries previously created with link against shared libraries previously created with
-buildmode=shared -buildmode=shared.
-pkgdir dir -pkgdir dir
install and load all packages from dir instead of the usual locations. install and load all packages from dir instead of the usual locations.
For example, when building with a non-standard configuration, For example, when building with a non-standard configuration,
...@@ -332,6 +332,9 @@ func buildModeInit() { ...@@ -332,6 +332,9 @@ func buildModeInit() {
_, gccgo := buildToolchain.(gccgoToolchain) _, gccgo := buildToolchain.(gccgoToolchain)
var codegenArg string var codegenArg string
platform := goos + "/" + goarch platform := goos + "/" + goarch
if buildBuildmode != "default" {
buildAsmflags = append(buildAsmflags, "-D=GOBUILDMODE_"+strings.Replace(buildBuildmode, "-", "_", -1)+"=1")
}
switch buildBuildmode { switch buildBuildmode {
case "archive": case "archive":
pkgsFilter = pkgsNotMain pkgsFilter = pkgsNotMain
...@@ -375,7 +378,7 @@ func buildModeInit() { ...@@ -375,7 +378,7 @@ func buildModeInit() {
fatalf("-buildmode=pie not supported by gccgo") fatalf("-buildmode=pie not supported by gccgo")
} else { } else {
switch platform { switch platform {
case "android/arm", "linux/amd64", "android/amd64": case "android/arm", "linux/amd64", "android/amd64", "linux/ppc64le":
codegenArg = "-shared" codegenArg = "-shared"
default: default:
fatalf("-buildmode=pie not supported on %s\n", platform) fatalf("-buildmode=pie not supported on %s\n", platform)
...@@ -389,7 +392,6 @@ func buildModeInit() { ...@@ -389,7 +392,6 @@ func buildModeInit() {
} else { } else {
switch platform { switch platform {
case "linux/386", "linux/amd64", "linux/arm", "linux/arm64": case "linux/386", "linux/amd64", "linux/arm", "linux/arm64":
buildAsmflags = append(buildAsmflags, "-D=GOBUILDMODE_shared=1")
default: default:
fatalf("-buildmode=shared not supported on %s\n", platform) fatalf("-buildmode=shared not supported on %s\n", platform)
} }
...@@ -407,7 +409,7 @@ func buildModeInit() { ...@@ -407,7 +409,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":
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("-buildmode=shared not supported on %s\n", platform)
......
...@@ -98,6 +98,11 @@ func archinit() { ...@@ -98,6 +98,11 @@ func archinit() {
ld.Linkmode = ld.LinkInternal ld.Linkmode = ld.LinkInternal
} }
switch ld.Buildmode {
case ld.BuildmodePIE:
ld.Linkmode = ld.LinkExternal
}
switch ld.HEADTYPE { switch ld.HEADTYPE {
default: default:
if ld.Linkmode == ld.LinkAuto { if ld.Linkmode == ld.LinkAuto {
......
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