Skip to content

Commit

Permalink
cmd/go, cmd/link: allow -buildmode=pie on linux/ppc64le
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mwhudson committed Nov 8, 2015
1 parent 5e1d0fc commit 2ffdbd7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/cmd/go/alldocs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 6 additions & 4 deletions src/cmd/go/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
}
Expand All @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions src/cmd/link/internal/ppc64/obj.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 2ffdbd7

Please sign in to comment.