Commit cf952e9e authored by Clément Chigot's avatar Clément Chigot Committed by Ian Lance Taylor

cmd: enable -buildmode=pie on aix/ppc64

Change-Id: I939518462c931ba9feb125b2f299ef0706b124ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/168879
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 08692bed
......@@ -963,7 +963,8 @@ func (t *tester) supportedBuildmode(mode string) bool {
return false
case "pie":
switch pair {
case "linux-386", "linux-amd64", "linux-arm", "linux-arm64", "linux-ppc64le", "linux-s390x",
case "aix/ppc64",
"linux-386", "linux-amd64", "linux-arm", "linux-arm64", "linux-ppc64le", "linux-s390x",
"android-amd64", "android-arm", "android-arm64", "android-386":
return true
case "darwin-amd64":
......
......@@ -164,6 +164,7 @@ func buildModeInit() {
codegenArg = "-shared"
case "darwin/amd64":
codegenArg = "-shared"
case "aix/ppc64":
default:
base.Fatalf("-buildmode=pie not supported on %s\n", platform)
}
......
......@@ -38,7 +38,7 @@ func (mode *BuildMode) Set(s string) error {
*mode = BuildModeExe
case "pie":
switch objabi.GOOS {
case "android", "linux":
case "aix", "android", "linux":
case "darwin", "freebsd":
switch objabi.GOARCH {
case "amd64":
......
......@@ -179,7 +179,7 @@ func (ctxt *Link) CanUsePlugins() bool {
func (ctxt *Link) UseRelro() bool {
switch ctxt.BuildMode {
case BuildModeCArchive, BuildModeCShared, BuildModeShared, BuildModePIE, BuildModePlugin:
return ctxt.IsELF
return ctxt.IsELF || ctxt.HeadType == objabi.Haix
default:
return ctxt.linkShared || (ctxt.HeadType == objabi.Haix && ctxt.LinkMode == LinkExternal)
}
......@@ -1173,7 +1173,7 @@ func (ctxt *Link) hostlink() {
}
case BuildModePIE:
// ELF.
if ctxt.HeadType != objabi.Hdarwin {
if ctxt.HeadType != objabi.Hdarwin && ctxt.HeadType != objabi.Haix {
if ctxt.UseRelro() {
argv = append(argv, "-Wl,-z,relro")
}
......
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