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 { ...@@ -963,7 +963,8 @@ func (t *tester) supportedBuildmode(mode string) bool {
return false return false
case "pie": case "pie":
switch pair { 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": "android-amd64", "android-arm", "android-arm64", "android-386":
return true return true
case "darwin-amd64": case "darwin-amd64":
......
...@@ -164,6 +164,7 @@ func buildModeInit() { ...@@ -164,6 +164,7 @@ func buildModeInit() {
codegenArg = "-shared" codegenArg = "-shared"
case "darwin/amd64": case "darwin/amd64":
codegenArg = "-shared" codegenArg = "-shared"
case "aix/ppc64":
default: default:
base.Fatalf("-buildmode=pie not supported on %s\n", platform) base.Fatalf("-buildmode=pie not supported on %s\n", platform)
} }
......
...@@ -38,7 +38,7 @@ func (mode *BuildMode) Set(s string) error { ...@@ -38,7 +38,7 @@ func (mode *BuildMode) Set(s string) error {
*mode = BuildModeExe *mode = BuildModeExe
case "pie": case "pie":
switch objabi.GOOS { switch objabi.GOOS {
case "android", "linux": case "aix", "android", "linux":
case "darwin", "freebsd": case "darwin", "freebsd":
switch objabi.GOARCH { switch objabi.GOARCH {
case "amd64": case "amd64":
......
...@@ -179,7 +179,7 @@ func (ctxt *Link) CanUsePlugins() bool { ...@@ -179,7 +179,7 @@ func (ctxt *Link) CanUsePlugins() bool {
func (ctxt *Link) UseRelro() bool { func (ctxt *Link) UseRelro() bool {
switch ctxt.BuildMode { switch ctxt.BuildMode {
case BuildModeCArchive, BuildModeCShared, BuildModeShared, BuildModePIE, BuildModePlugin: case BuildModeCArchive, BuildModeCShared, BuildModeShared, BuildModePIE, BuildModePlugin:
return ctxt.IsELF return ctxt.IsELF || ctxt.HeadType == objabi.Haix
default: default:
return ctxt.linkShared || (ctxt.HeadType == objabi.Haix && ctxt.LinkMode == LinkExternal) return ctxt.linkShared || (ctxt.HeadType == objabi.Haix && ctxt.LinkMode == LinkExternal)
} }
...@@ -1173,7 +1173,7 @@ func (ctxt *Link) hostlink() { ...@@ -1173,7 +1173,7 @@ func (ctxt *Link) hostlink() {
} }
case BuildModePIE: case BuildModePIE:
// ELF. // ELF.
if ctxt.HeadType != objabi.Hdarwin { if ctxt.HeadType != objabi.Hdarwin && ctxt.HeadType != objabi.Haix {
if ctxt.UseRelro() { if ctxt.UseRelro() {
argv = append(argv, "-Wl,-z,relro") 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